Skip to content

Commit ded5618

Browse files
committed
btrfs: scrub: fix target device intialization while setting up scrub context
The commit "btrfs: scrub: inline helper scrub_setup_wr_ctx" inlined a helper but wrongly sets up the target device. Incidentally there's a local variable with the same name as a parameter in the previous function, so this got caught during runtime as crash in test btrfs/027. Reported-by: Chris Mason <clm@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent bc42bda commit ded5618

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/btrfs/scrub.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,9 +714,9 @@ struct scrub_ctx *scrub_setup_ctx(struct btrfs_device *dev, int is_dev_replace)
714714
mutex_init(&sctx->wr_lock);
715715
sctx->wr_curr_bio = NULL;
716716
if (is_dev_replace) {
717-
WARN_ON(!dev->bdev);
717+
WARN_ON(!fs_info->dev_replace.tgtdev);
718718
sctx->pages_per_wr_bio = SCRUB_PAGES_PER_WR_BIO;
719-
sctx->wr_tgtdev = dev;
719+
sctx->wr_tgtdev = fs_info->dev_replace.tgtdev;
720720
atomic_set(&sctx->flush_all_writes, 0);
721721
}
722722

0 commit comments

Comments
 (0)