Skip to content

Commit

Permalink
Btrfs: remove misleading handling of missing device scrub
Browse files Browse the repository at this point in the history
scrub_submit() claims that it can handle a bio with a NULL block device,
but this is misleading, as calling bio_add_page() on a bio with a NULL
->bi_bdev would've already crashed. Delete this, as we're about to
properly handle a missing block device.

Signed-off-by: Omar Sandoval <[email protected]>
Signed-off-by: Chris Mason <[email protected]>
  • Loading branch information
osandov authored and masoncl committed Aug 9, 2015
1 parent 293a848 commit 03679ad
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions fs/btrfs/scrub.c
Original file line number Diff line number Diff line change
Expand Up @@ -2096,21 +2096,7 @@ static void scrub_submit(struct scrub_ctx *sctx)
sbio = sctx->bios[sctx->curr];
sctx->curr = -1;
scrub_pending_bio_inc(sctx);

if (!sbio->bio->bi_bdev) {
/*
* this case should not happen. If btrfs_map_block() is
* wrong, it could happen for dev-replace operations on
* missing devices when no mirrors are available, but in
* this case it should already fail the mount.
* This case is handled correctly (but _very_ slowly).
*/
printk_ratelimited(KERN_WARNING
"BTRFS: scrub_submit(bio bdev == NULL) is unexpected!\n");
bio_endio(sbio->bio, -EIO);
} else {
btrfsic_submit_bio(READ, sbio->bio);
}
btrfsic_submit_bio(READ, sbio->bio);
}

static int scrub_add_page_to_rd_bio(struct scrub_ctx *sctx,
Expand Down

0 comments on commit 03679ad

Please sign in to comment.