Skip to content

Commit 7c4cb50

Browse files
falbrechtskirchingerKent Overstreet
authored andcommitted
bcachefs: Fix bch2_fs_get_tree() error path
When a filesystem is mounted read-only, subsequent attempts to mount it as read-write fail with EBUSY. Previously, the error path in bch2_fs_get_tree() would unconditionally call __bch2_fs_stop(), improperly freeing resources for a filesystem that was still actively mounted. This change modifies the error path to only call __bch2_fs_stop() if the superblock has no valid root dentry, ensuring resources are not cleaned up prematurely when the filesystem is in use. Signed-off-by: Florian Albrechtskirchinger <[email protected]> Signed-off-by: Kent Overstreet <[email protected]>
1 parent 6b1e0b9 commit 7c4cb50

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/bcachefs/fs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2290,7 +2290,8 @@ static int bch2_fs_get_tree(struct fs_context *fc)
22902290
goto err;
22912291

22922292
err_put_super:
2293-
__bch2_fs_stop(c);
2293+
if (!sb->s_root)
2294+
__bch2_fs_stop(c);
22942295
deactivate_locked_super(sb);
22952296
goto err;
22962297
}

0 commit comments

Comments
 (0)