[dm-devel] bio's bi_size bug also be founded at dm-stripe.c and dm-snap.c (resend in correct charset)

Kevin Corry kevcorry at us.ibm.com
Wed Jun 29 11:46:00 UTC 2005


On Wed June 29 2005 6:30 am, Kevin Corry wrote:
> > in such situation, bio's
> > bi_size could exceed strip target's chunk size and snap target's chunk
> > size, but in current code, we never care about this. so in strip target
> > we could read/write bad position after stripe_map() function, and cause
> > same effect in dm-snap.c.
>
> I'm quite certain there is code in dm.c to prevent bio's from spanning the
> internal boundaries in the mirror, snapshot, and stripe targets. Have you
> read through the code starting in dm.c::dm_request()? The targets specify
> where their internal boundaries are, and the core driver is responsible for
> splitting up bio's so the targets never get a request that span those
> boundaries.

And now that I've said this, I've gone back and looked, and indeed the 
dm-raid1.c code isn't setting the ti->split_io field (it does get set in 
dm-stripe.c and dm-snap.c).

Alasdair, should that field be set for dm-mirror targets? I'm not as familiar 
with that code, so I'll have to leave that up to you. If it does need to be 
set, I think the following patch should work.

-- 
Kevin Corry
kevcorry at us.ibm.com
http://www.ibm.com/linux/
http://evms.sourceforge.net/


Set the target's split_io field when building a dm-mirror device so incoming 
bio's won't span the mirror's internal regions.

--- a/drivers/md/dm-raid1.c 2005-06-29 06:38:16.000000000 -0500
+++ b/drivers/md/dm-raid1.c 2005-06-29 06:41:59.000000000 -0500
@@ -1060,6 +1060,7 @@
  }
 
  ti->private = ms;
+ ti->split_io = ms->rh->region_size;
 
  r = kcopyd_client_create(DM_IO_PAGES, &ms->kcopyd_client);
  if (r) {




More information about the dm-devel mailing list