Skip to content

Commit 0dc16ef

Browse files
fdmananakdave
authored andcommitted
btrfs: zoned: fix unpaired block group unfreeze during device replace
When doing a device replace on a zoned filesystem, if we find a block group with ->to_copy == 0, we jump to the label 'done', which will result in later calling btrfs_unfreeze_block_group(), even though at this point we never called btrfs_freeze_block_group(). Since at this point we have neither turned the block group to RO mode nor made any progress, we don't need to jump to the label 'done'. So fix this by jumping instead to the label 'skip' and dropping our reference on the block group before the jump. Fixes: 78ce9fc ("btrfs: zoned: mark block groups to copy for device-replace") CC: [email protected] # 5.12 Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent f9690f4 commit 0dc16ef

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

fs/btrfs/scrub.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3674,8 +3674,8 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx,
36743674
spin_lock(&cache->lock);
36753675
if (!cache->to_copy) {
36763676
spin_unlock(&cache->lock);
3677-
ro_set = 0;
3678-
goto done;
3677+
btrfs_put_block_group(cache);
3678+
goto skip;
36793679
}
36803680
spin_unlock(&cache->lock);
36813681
}
@@ -3833,7 +3833,6 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx,
38333833
cache, found_key.offset))
38343834
ro_set = 0;
38353835

3836-
done:
38373836
down_write(&dev_replace->rwsem);
38383837
dev_replace->cursor_left = dev_replace->cursor_right;
38393838
dev_replace->item_needs_writeback = 1;

0 commit comments

Comments
 (0)