Skip to content

Commit 29e0e4d

Browse files
gkurzMiklos Szeredi
authored andcommitted
fuse: Switch to fc_mount() for submounts
fc_mount() already handles the vfs_get_tree(), sb->s_umount unlocking and vfs_create_mount() sequence. Using it greatly simplifies fuse_dentry_automount(). Signed-off-by: Greg Kurz <groug@kaod.org> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
1 parent 266eb3f commit 29e0e4d

1 file changed

Lines changed: 6 additions & 23 deletions

File tree

fs/fuse/dir.c

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -311,38 +311,21 @@ static struct vfsmount *fuse_dentry_automount(struct path *path)
311311
struct fs_context *fsc;
312312
struct vfsmount *mnt;
313313
struct fuse_inode *mp_fi = get_fuse_inode(d_inode(path->dentry));
314-
int err;
315314

316315
fsc = fs_context_for_submount(path->mnt->mnt_sb->s_type, path->dentry);
317-
if (IS_ERR(fsc)) {
318-
err = PTR_ERR(fsc);
319-
goto out;
320-
}
316+
if (IS_ERR(fsc))
317+
return ERR_CAST(fsc);
321318

322319
/* Pass the FUSE inode of the mount for fuse_get_tree_submount() */
323320
fsc->fs_private = mp_fi;
324321

325-
err = vfs_get_tree(fsc);
326-
if (err)
327-
goto out_put_fsc;
328-
329-
/* We are done configuring the superblock, so unlock it */
330-
up_write(&fsc->root->d_sb->s_umount);
331-
332322
/* Create the submount */
333-
mnt = vfs_create_mount(fsc);
334-
if (IS_ERR(mnt)) {
335-
err = PTR_ERR(mnt);
336-
goto out_put_fsc;
337-
}
338-
mntget(mnt);
339-
put_fs_context(fsc);
340-
return mnt;
323+
mnt = fc_mount(fsc);
324+
if (!IS_ERR(mnt))
325+
mntget(mnt);
341326

342-
out_put_fsc:
343327
put_fs_context(fsc);
344-
out:
345-
return ERR_PTR(err);
328+
return mnt;
346329
}
347330

348331
const struct dentry_operations fuse_dentry_operations = {

0 commit comments

Comments
 (0)