summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2019-08-29 05:01:20 -0400
committerMiklos Szeredi <mszeredi@redhat.com>2019-09-12 08:59:41 -0400
commit783863d6476ce9f27fa87227f76ae9134caf43fa (patch)
tree98acd92b40d5a92fa7afbd704ed39d42f639c932
parent8fab010644363f8f80194322aa7a81e38c867af3 (diff)
fuse: dissociate DESTROY from fuseblk
Allow virtio-fs to also send DESTROY request. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
-rw-r--r--fs/fuse/fuse_i.h9
-rw-r--r--fs/fuse/inode.c12
2 files changed, 17 insertions, 4 deletions
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index fed68a427a4c..48d214df9172 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -467,6 +467,7 @@ struct fuse_fs_context {
467 bool group_id_present:1; 467 bool group_id_present:1;
468 bool default_permissions:1; 468 bool default_permissions:1;
469 bool allow_other:1; 469 bool allow_other:1;
470 bool destroy:1;
470 unsigned int max_read; 471 unsigned int max_read;
471 unsigned int blksize; 472 unsigned int blksize;
472 const char *subtype; 473 const char *subtype;
@@ -946,6 +947,13 @@ void fuse_send_init(struct fuse_conn *fc);
946int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx); 947int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx);
947 948
948/** 949/**
950 * Disassociate fuse connection from superblock and kill the superblock
951 *
952 * Calls kill_anon_super(), do not use with bdev mounts.
953 */
954void fuse_kill_sb_anon(struct super_block *sb);
955
956/**
949 * Add connection to control filesystem 957 * Add connection to control filesystem
950 */ 958 */
951int fuse_ctl_add_conn(struct fuse_conn *fc); 959int fuse_ctl_add_conn(struct fuse_conn *fc);
@@ -1057,5 +1065,6 @@ unsigned int fuse_len_args(unsigned int numargs, struct fuse_arg *args);
1057 * Get the next unique ID for a request 1065 * Get the next unique ID for a request
1058 */ 1066 */
1059u64 fuse_get_unique(struct fuse_iqueue *fiq); 1067u64 fuse_get_unique(struct fuse_iqueue *fiq);
1068void fuse_free_conn(struct fuse_conn *fc);
1060 1069
1061#endif /* _FS_FUSE_I_H */ 1070#endif /* _FS_FUSE_I_H */
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 6a0f31faaeaa..cd6ffb3fe69e 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -999,11 +999,12 @@ void fuse_send_init(struct fuse_conn *fc)
999} 999}
1000EXPORT_SYMBOL_GPL(fuse_send_init); 1000EXPORT_SYMBOL_GPL(fuse_send_init);
1001 1001
1002static void fuse_free_conn(struct fuse_conn *fc) 1002void fuse_free_conn(struct fuse_conn *fc)
1003{ 1003{
1004 WARN_ON(!list_empty(&fc->devices)); 1004 WARN_ON(!list_empty(&fc->devices));
1005 kfree_rcu(fc, rcu); 1005 kfree_rcu(fc, rcu);
1006} 1006}
1007EXPORT_SYMBOL_GPL(fuse_free_conn);
1007 1008
1008static int fuse_bdi_init(struct fuse_conn *fc, struct super_block *sb) 1009static int fuse_bdi_init(struct fuse_conn *fc, struct super_block *sb)
1009{ 1010{
@@ -1169,7 +1170,7 @@ int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx)
1169 fc->user_id = ctx->user_id; 1170 fc->user_id = ctx->user_id;
1170 fc->group_id = ctx->group_id; 1171 fc->group_id = ctx->group_id;
1171 fc->max_read = max_t(unsigned, 4096, ctx->max_read); 1172 fc->max_read = max_t(unsigned, 4096, ctx->max_read);
1172 fc->destroy = ctx->is_bdev; 1173 fc->destroy = ctx->destroy;
1173 1174
1174 err = -ENOMEM; 1175 err = -ENOMEM;
1175 root = fuse_get_root_inode(sb, ctx->rootmode); 1176 root = fuse_get_root_inode(sb, ctx->rootmode);
@@ -1293,8 +1294,10 @@ static int fuse_init_fs_context(struct fs_context *fc)
1293 ctx->blksize = FUSE_DEFAULT_BLKSIZE; 1294 ctx->blksize = FUSE_DEFAULT_BLKSIZE;
1294 1295
1295#ifdef CONFIG_BLOCK 1296#ifdef CONFIG_BLOCK
1296 if (fc->fs_type == &fuseblk_fs_type) 1297 if (fc->fs_type == &fuseblk_fs_type) {
1297 ctx->is_bdev = true; 1298 ctx->is_bdev = true;
1299 ctx->destroy = true;
1300 }
1298#endif 1301#endif
1299 1302
1300 fc->fs_private = ctx; 1303 fc->fs_private = ctx;
@@ -1319,11 +1322,12 @@ static void fuse_sb_destroy(struct super_block *sb)
1319 } 1322 }
1320} 1323}
1321 1324
1322static void fuse_kill_sb_anon(struct super_block *sb) 1325void fuse_kill_sb_anon(struct super_block *sb)
1323{ 1326{
1324 fuse_sb_destroy(sb); 1327 fuse_sb_destroy(sb);
1325 kill_anon_super(sb); 1328 kill_anon_super(sb);
1326} 1329}
1330EXPORT_SYMBOL_GPL(fuse_kill_sb_anon);
1327 1331
1328static struct file_system_type fuse_fs_type = { 1332static struct file_system_type fuse_fs_type = {
1329 .owner = THIS_MODULE, 1333 .owner = THIS_MODULE,