@@ -100,6 +100,12 @@ struct fuse_mount_data {
/* fuse_dev pointer to fill in, should contain NULL on entry */
void **fudptr;
+
+ /* version table length in bytes */
+ size_t vertab_len;
+
+ /* version table kernel address */
+ void *vertab_kaddr;
};
/* One forget request */
@@ -898,6 +904,12 @@ struct fuse_conn {
struct list_head free_ranges;
unsigned long nr_ranges;
+
+ /** Size of version table */
+ uint64_t version_table_size;
+
+ /** Shared version entry for each active inode */
+ s64 *version_table;
};
static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb)
@@ -52,6 +52,7 @@ MODULE_PARM_DESC(max_user_congthresh,
"unprivileged user can set");
#define FUSE_SUPER_MAGIC 0x65735546
+#define VERSION_TABLE_MAGIC 0x7265566465726853
#define FUSE_DEFAULT_BLKSIZE 512
@@ -1215,6 +1216,15 @@ int fuse_fill_super_common(struct super_block *sb,
fuse_conn_init(fc, sb->s_user_ns, mount_data->dax_dev,
mount_data->fiq_ops, mount_data->fiq_priv);
fc->release = fuse_free_conn;
+ fc->version_table_size = mount_data->vertab_len / sizeof(s64);
+ fc->version_table = mount_data->vertab_kaddr;
+
+ if (fc->version_table[0] != VERSION_TABLE_MAGIC) {
+ pr_warn("bad version table magic: 0x%16llx\n",
+ fc->version_table[0]);
+ fc->version_table_size = 0;
+ fc->version_table = NULL;
+ }
if (mount_data->dax_dev) {
err = fuse_dax_mem_range_init(fc, mount_data->dax_dev);
@@ -1246,6 +1246,8 @@ static int virtio_fs_fill_super(struct super_block *sb, void *data,
d.fiq_priv = fs;
d.fudptr = (void **)&fs->vqs[2].fud;
d.destroy = true; /* Send destroy request on unmount */
+ d.vertab_len = fs->vertab_len;
+ d.vertab_kaddr = fs->vertab_kaddr;
err = fuse_fill_super_common(sb, &d);
if (err < 0)