From: David Sterba Date: Mon, 26 Jun 2017 13:19:00 +0000 (+0200) Subject: btrfs: scrub: fix target device intialization while setting up scrub context X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ded56184a562b925a588b6e78688e2e60757b425;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: David Sterba --- diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 58a249cd5adc..738e784ba20d 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -714,9 +714,9 @@ struct scrub_ctx *scrub_setup_ctx(struct btrfs_device *dev, int is_dev_replace) mutex_init(&sctx->wr_lock); sctx->wr_curr_bio = NULL; if (is_dev_replace) { - WARN_ON(!dev->bdev); + WARN_ON(!fs_info->dev_replace.tgtdev); sctx->pages_per_wr_bio = SCRUB_PAGES_PER_WR_BIO; - sctx->wr_tgtdev = dev; + sctx->wr_tgtdev = fs_info->dev_replace.tgtdev; atomic_set(&sctx->flush_all_writes, 0); }