Skip to content

Commit

Permalink
fuse: dissociate DESTROY from fuseblk
Browse files Browse the repository at this point in the history
Allow virtio-fs to also send DESTROY request.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
  • Loading branch information
Miklos Szeredi committed Sep 12, 2019
1 parent 8fab010 commit 783863d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
9 changes: 9 additions & 0 deletions fs/fuse/fuse_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ struct fuse_fs_context {
bool group_id_present:1;
bool default_permissions:1;
bool allow_other:1;
bool destroy:1;
unsigned int max_read;
unsigned int blksize;
const char *subtype;
Expand Down Expand Up @@ -945,6 +946,13 @@ void fuse_send_init(struct fuse_conn *fc);
*/
int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx);

/**
* Disassociate fuse connection from superblock and kill the superblock
*
* Calls kill_anon_super(), do not use with bdev mounts.
*/
void fuse_kill_sb_anon(struct super_block *sb);

/**
* Add connection to control filesystem
*/
Expand Down Expand Up @@ -1057,5 +1065,6 @@ unsigned int fuse_len_args(unsigned int numargs, struct fuse_arg *args);
* Get the next unique ID for a request
*/
u64 fuse_get_unique(struct fuse_iqueue *fiq);
void fuse_free_conn(struct fuse_conn *fc);

#endif /* _FS_FUSE_I_H */
12 changes: 8 additions & 4 deletions fs/fuse/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -999,11 +999,12 @@ void fuse_send_init(struct fuse_conn *fc)
}
EXPORT_SYMBOL_GPL(fuse_send_init);

static void fuse_free_conn(struct fuse_conn *fc)
void fuse_free_conn(struct fuse_conn *fc)
{
WARN_ON(!list_empty(&fc->devices));
kfree_rcu(fc, rcu);
}
EXPORT_SYMBOL_GPL(fuse_free_conn);

static int fuse_bdi_init(struct fuse_conn *fc, struct super_block *sb)
{
Expand Down Expand Up @@ -1169,7 +1170,7 @@ int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx)
fc->user_id = ctx->user_id;
fc->group_id = ctx->group_id;
fc->max_read = max_t(unsigned, 4096, ctx->max_read);
fc->destroy = ctx->is_bdev;
fc->destroy = ctx->destroy;

err = -ENOMEM;
root = fuse_get_root_inode(sb, ctx->rootmode);
Expand Down Expand Up @@ -1293,8 +1294,10 @@ static int fuse_init_fs_context(struct fs_context *fc)
ctx->blksize = FUSE_DEFAULT_BLKSIZE;

#ifdef CONFIG_BLOCK
if (fc->fs_type == &fuseblk_fs_type)
if (fc->fs_type == &fuseblk_fs_type) {
ctx->is_bdev = true;
ctx->destroy = true;
}
#endif

fc->fs_private = ctx;
Expand All @@ -1319,11 +1322,12 @@ static void fuse_sb_destroy(struct super_block *sb)
}
}

static void fuse_kill_sb_anon(struct super_block *sb)
void fuse_kill_sb_anon(struct super_block *sb)
{
fuse_sb_destroy(sb);
kill_anon_super(sb);
}
EXPORT_SYMBOL_GPL(fuse_kill_sb_anon);

static struct file_system_type fuse_fs_type = {
.owner = THIS_MODULE,
Expand Down

0 comments on commit 783863d

Please sign in to comment.