bcachefs: Improve error handling in bch2_ioctl_subvolume_destroy()
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 16 Mar 2023 16:47:35 +0000 (12:47 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:57 +0000 (17:09 -0400)
Pure style fixes

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/fs-ioctl.c

index b51053130f282c1f7355b1b99e3fefea86bad8dd..269af9393824c14348a2c62b5544e8abb70b2b3c 100644 (file)
@@ -451,19 +451,20 @@ static long bch2_ioctl_subvolume_destroy(struct bch_fs *c, struct file *filp,
                return ret;
 
        if (path.dentry->d_sb->s_fs_info != c) {
-               path_put(&path);
-               return -EXDEV;
+               ret = -EXDEV;
+               goto err;
        }
 
        dir = path.dentry->d_parent->d_inode;
 
        ret = __bch2_unlink(dir, path.dentry, true);
-       if (!ret) {
-               fsnotify_rmdir(dir, path.dentry);
-               d_delete(path.dentry);
-       }
-       path_put(&path);
+       if (ret)
+               goto err;
 
+       fsnotify_rmdir(dir, path.dentry);
+       d_delete(path.dentry);
+err:
+       path_put(&path);
        return ret;
 }