From: Johannes Thumshirn Date: Fri, 4 Nov 2022 14:12:35 +0000 (-0700) Subject: btrfs: zoned: fix locking imbalance on scrub X-Git-Tag: v6.6.17~6129^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c62f6bec53e63b11112e1ebce6bbaa39ce6f6706;p=platform%2Fkernel%2Flinux-rpi.git btrfs: zoned: fix locking imbalance on scrub If we're doing device replace on a zoned filesystem and discover in scrub_enumerate_chunks() that we don't have to copy the block group it is unlocked before it gets skipped. But as the block group hasn't yet been locked before it leads to a locking imbalance. To fix this simply remove the unlock. This was uncovered by fstests' testcase btrfs/163. Fixes: 9283b9e09a6d ("btrfs: remove lock protection for BLOCK_GROUP_FLAG_TO_COPY") Signed-off-by: Johannes Thumshirn Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index b659c67..196c4c6 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -3911,7 +3911,6 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx, if (sctx->is_dev_replace && btrfs_is_zoned(fs_info)) { if (!test_bit(BLOCK_GROUP_FLAG_TO_COPY, &cache->runtime_flags)) { - spin_unlock(&cache->lock); btrfs_put_block_group(cache); goto skip; }