Skip to content

Commit

Permalink
fuse: check s_root when destroying sb
Browse files Browse the repository at this point in the history
Checking "fm" works because currently sb->s_fs_info is cleared on error
paths; however, sb->s_root is what generic_shutdown_super() checks to
determine whether the sb was fully initialized or not.

This change will allow cleanup of sb setup error paths.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
  • Loading branch information
Miklos Szeredi committed Oct 21, 2021
1 parent 519d819 commit d534d31
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fs/fuse/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1747,7 +1747,7 @@ static void fuse_sb_destroy(struct super_block *sb)
struct fuse_mount *fm = get_fuse_mount_super(sb);
bool last;

if (fm) {
if (sb->s_root) {
last = fuse_mount_remove(fm);
if (last)
fuse_conn_destroy(fm);
Expand Down
2 changes: 1 addition & 1 deletion fs/fuse/virtio_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ static void virtio_kill_sb(struct super_block *sb)
bool last;

/* If mount failed, we can still be called without any fc */
if (fm) {
if (sb->s_root) {
last = fuse_mount_remove(fm);
if (last)
virtio_fs_conn_destroy(fm);
Expand Down

0 comments on commit d534d31

Please sign in to comment.