Re: [PATCH 16/22] dm: Refactor for new bio cloning/splitting

From: Mike Snitzer
Date: Wed Oct 02 2013 - 23:23:43 EST


On Wed, Oct 02 2013 at 11:17pm -0400,
Kent Overstreet <kmo@xxxxxxxxxxxxx> wrote:

> On Sat, Sep 28, 2013 at 12:59:09AM -0400, Mike Snitzer wrote:
> > Hey Kent,
> >
> > I haven't been able to pinpoint the issue yet, but using your for-jens
> > branch, if I create a dm-thin volume with this lvm command:
> > lvcreate -L20G -V20G -T vg/pool --name thinlv
> >
> > and try to format /dev/vg/thinlv with XFS the kernel warns and then
> > hangs with the following:
>
> Thanks, for whatever reason ext4 wasn't tickling that codepath but xfs
> does. I folded the fix into my for-jens branch, here's what changed:
>
> diff --git a/drivers/md/dm.c b/drivers/md/dm.c
> index b60b350..79cee1a 100644
> --- a/drivers/md/dm.c
> +++ b/drivers/md/dm.c
> @@ -1098,7 +1098,7 @@ static void clone_bio(struct dm_target_io *tio, struct bio *bio,
> bio_integrity_clone(clone, bio, GFP_NOIO);
>
> bio_advance(clone, to_bytes(sector - clone->bi_iter.bi_sector));
> - bio->bi_iter.bi_size = to_bytes(len);
> + clone->bi_iter.bi_size = to_bytes(len);
>
> if (bio_integrity(bio))
> bio_integrity_trim(clone, 0, len);

The above change matches my findings during review (I clearly should've
shared it sooner)

> @@ -1267,7 +1267,7 @@ static int __split_and_process_non_flush(struct clone_info *ci)
> if (!dm_target_is_valid(ti))
> return -EIO;
>
> - len = min_t(unsigned, max_io_len(ci->sector, ti), bio_sectors(bio));
> + len = min_t(sector_t, max_io_len(ci->sector, ti), ci->sector_count);
>
> __clone_and_map_data_bio(ci, ti, ci->sector, len);
>

Great, thanks for finding this, I'll test and review the code further.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/