--- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -3682,8 +3682,8 @@ int scrub_enumerate_chunks(struct scrub_ 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); } @@ -3841,7 +3841,6 @@ int scrub_enumerate_chunks(struct scrub_ 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;