Skip to content

Commit 5796230

Browse files
Brian FosterKent Overstreet
authored andcommitted
bcachefs: don't attempt rw on unfreeze when shutdown
The internal freeze mechanism in bcachefs mostly reuses the generic rw<->ro transition code. If the fs happens to shutdown during or after freeze, a transition back to rw can fail. This is expected, but returning an error from the unfreeze callout prevents the filesystem from being unfrozen. Skip the read write transition if the fs is shutdown. This allows the fs to unfreeze at the vfs level so writes will no longer block, but will still fail due to the emergency read-only state of the fs. Signed-off-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 7aebaab commit 5796230

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

fs/bcachefs/fs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,6 +1733,9 @@ static int bch2_unfreeze(struct super_block *sb)
17331733
struct bch_fs *c = sb->s_fs_info;
17341734
int ret;
17351735

1736+
if (test_bit(BCH_FS_EMERGENCY_RO, &c->flags))
1737+
return 0;
1738+
17361739
down_write(&c->state_lock);
17371740
ret = bch2_fs_read_write(c);
17381741
up_write(&c->state_lock);

0 commit comments

Comments
 (0)