]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
fuse: check s_root when destroying sb
authorMiklos Szeredi <mszeredi@redhat.com>
Thu, 21 Oct 2021 08:01:38 +0000 (10:01 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Thu, 21 Oct 2021 08:01:38 +0000 (10:01 +0200)
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>
fs/fuse/inode.c
fs/fuse/virtio_fs.c

index 36cd03114b6d9f8b23956ae70966b9c0aeff2d0a..60ceaf33284053447ff51323647c00728220b41d 100644 (file)
@@ -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);
index 0ad89c6629d74167836246a77c49609cead850af..32fd138c621eeda41c60b473823a086d0837f2fd 100644 (file)
@@ -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);