btrfs: zoned: fix unpaired block group unfreeze during device replace
[platform/kernel/linux-rpi.git] / fs / btrfs / scrub.c
index 17e49ca..485cda3 100644 (file)
@@ -3674,8 +3674,8 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx,
                        spin_lock(&cache->lock);
                        if (!cache->to_copy) {
                                spin_unlock(&cache->lock);
-                               ro_set = 0;
-                               goto done;
+                               btrfs_put_block_group(cache);
+                               goto skip;
                        }
                        spin_unlock(&cache->lock);
                }
@@ -3833,7 +3833,6 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx,
                                                      cache, found_key.offset))
                        ro_set = 0;
 
-done:
                down_write(&dev_replace->rwsem);
                dev_replace->cursor_left = dev_replace->cursor_right;
                dev_replace->item_needs_writeback = 1;