All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dm-striped device sizes must be multiple of chunk-size
@ 2006-03-14 22:31 Kevin Corry
  2006-03-14 22:43 ` Darrick J. Wong
  0 siblings, 1 reply; 7+ messages in thread
From: Kevin Corry @ 2006-03-14 22:31 UTC (permalink / raw)
  To: DevMapper

The dm-striped target currently does not enforce that the size of a stripe 
device be a multiple of the chunk-size. Under certain conditions, this can 
lead to I/O requests going off the end of an underlying device. This 
test-case shows one example.

echo "0 100 linear /dev/hdb1 0" | dmsetup create linear0
echo "0 100 linear /dev/hdb1 100" | dmsetup create linear1
echo "0 200 striped 2 32 /dev/mapper/linear0 0 /dev/mapper/linear1 0" | \
   dmsetup create stripe0
dd if=/dev/zero of=/dev/mapper/stripe0 bs=1k

This will produce the output:
dd: writing '/dev/mapper/stripe0': Input/output error
97+0 records in
96+0 records out

And in the kernel log will be:
attempt to access beyond end of device
dm-0: rw=0, want=104, limit=100

The patch below will check that the table size is a multiple of the stripe 
chunk-size when the table is created, which will prevent the above striped 
device from being created.

This should not effect tools like LVM or EVMS, since in all the cases I can 
think of, striped devices are always created with the sizes being a multiple 
of the chunk-size.

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


The size of a stripe device must be a multiple of its chunk-size.

Signed-off-by: Kevin Corry <kevcorry@us.ibm.com>

 dm-stripe.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- diff/drivers/md/dm-stripe.c	2006-03-14 15:57:30.000000000 -0600
+++ source/drivers/md/dm-stripe.c	2006-03-14 16:01:41.000000000 -0600
@@ -103,6 +103,12 @@
 		return -EINVAL;
 	}
 
+	if (((uint32_t)ti->len) & (chunk_size - 1)) {
+		ti->error = "dm-stripe: Target length not divisable by "
+		    "chunk size";
+		return -EINVAL;
+	}
+
 	width = ti->len;
 	if (sector_div(width, stripes)) {
 		ti->error = "dm-stripe: Target length not divisable by "

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] dm-striped device sizes must be multiple of chunk-size
  2006-03-14 22:31 Kevin Corry
@ 2006-03-14 22:43 ` Darrick J. Wong
  0 siblings, 0 replies; 7+ messages in thread
From: Darrick J. Wong @ 2006-03-14 22:43 UTC (permalink / raw)
  To: device-mapper development


[-- Attachment #1.1: Type: text/plain, Size: 1330 bytes --]

Also, those error messages should read "Target length not divisible...",
not "divisable".

--D

On Tue, 2006-03-14 at 16:31 -0600, Kevin Corry wrote:
> The dm-striped target currently does not enforce that the size of a stripe 
> device be a multiple of the chunk-size. Under certain conditions, this can 
> lead to I/O requests going off the end of an underlying device. This 
> test-case shows one example.
> 
> echo "0 100 linear /dev/hdb1 0" | dmsetup create linear0
> echo "0 100 linear /dev/hdb1 100" | dmsetup create linear1
> echo "0 200 striped 2 32 /dev/mapper/linear0 0 /dev/mapper/linear1 0" | \
>    dmsetup create stripe0
> dd if=/dev/zero of=/dev/mapper/stripe0 bs=1k
> 
> This will produce the output:
> dd: writing '/dev/mapper/stripe0': Input/output error
> 97+0 records in
> 96+0 records out
> 
> And in the kernel log will be:
> attempt to access beyond end of device
> dm-0: rw=0, want=104, limit=100
> 
> The patch below will check that the table size is a multiple of the stripe 
> chunk-size when the table is created, which will prevent the above striped 
> device from being created.
> 
> This should not effect tools like LVM or EVMS, since in all the cases I can 
> think of, striped devices are always created with the sizes being a multiple 
> of the chunk-size.
> 

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] dm-striped device sizes must be multiple of chunk-size
@ 2006-03-23  5:28 Joseph Yasi
  2006-03-25  4:46 ` Kevin Corry
  0 siblings, 1 reply; 7+ messages in thread
From: Joseph Yasi @ 2006-03-23  5:28 UTC (permalink / raw)
  To: dm-devel

Hello,

    I am using the dmraid utility to detect and configure my Intel
Software Raid RAID0 array.  When upgrading to 2.6.16 from 2.6.15, the
system failed to boot because the device-mapper array was not built. 
I have traced the problem to this patch that limits dm-stripe to
targets that are multiples of the chunk size.  I don't know whether to
consider this a problem with device-mapper or with the Intel Software
Raid BIOS that built the array.  Dmraid is giving me a target of
980460038 blocks with a chunk size of 256 blocks.  Is this a problem
with device-mapper, the dmraid utility or the raid bios?  Should
device-mapper handle striped targets that are not multiples of the
chunk size?

Thank You,
Joe Yasi

dmesg gives these pertinent lines:
device-mapper: dm-stripe: Target length not divisible by chunk size.
device-mapper: error adding target to table.

dmsetup status
isw_caejhbcidd_Volume03: 0 976173660 linear
isw_caejhbcidd_Volume02: 0 4209030 linear
isw_caejhbcidd_Volume01: 0 64197 linear
isw_caejhbcidd_Volume0: 0 980460038 striped

dmraid -s
*** Group superset isw_caejhbcidd
--> Active Subset
name   : isw_caejhbcidd_Volume0
size   : 980460038
stride : 256
type   : stripe
status : ok
subsets: 0
devs   : 2
spares : 0

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] dm-striped device sizes must be multiple of chunk-size
  2006-03-25  4:46 ` Kevin Corry
@ 2006-03-26  0:01   ` Dwaine Garden
  0 siblings, 0 replies; 7+ messages in thread
From: Dwaine Garden @ 2006-03-26  0:01 UTC (permalink / raw)
  To: dm-devel

Kevin Corry <kevcorry <at> us.ibm.com> writes:
> 
> I'm thinking that this mapping would do what the BIOS is actually intending. 
> It ought to be relatively straight-forward to recognize this situation in 
> dmraid and set up a mapping similar to the one above.
> 

I have the same problem.  How would you resolve this?

Dwaine

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] dm-striped device sizes must be multiple of chunk-size
@ 2006-05-30 13:14 Peyrotau Yannick
  0 siblings, 0 replies; 7+ messages in thread
From: Peyrotau Yannick @ 2006-05-30 13:14 UTC (permalink / raw)
  To: dm-devel

Hi, I have the same problem too when i try to upgrade to 2.6.16 kernel.

My motherbord is ASUS A8N-E with a nvidia raid chip.

I have make an archive with my metadata at this adress :
http://crashteam1.free.fr/metadata/metadata_isw-Yannick_Peyrotau-raid0.tar.bz2

Can i resolve it ?


Thanks,
Yannick

 > Dwaine,
 >
 > can you please send me your metadata for refernence as well so
 > that I can confirm that my fix is good for bz #186842 ?
 >
 > Thanks,
 > Heinz
 >
 > On Sun, Mar 26, 2006 at 12:01:17AM +0000, Dwaine Garden wrote:
 > > Kevin Corry <kevcorry <at> us.ibm.com> writes:
 > > >
 > > > I'm thinking that this mapping would do what the BIOS is actually
 > > > intending.
 > > > It ought to be relatively straight-forward to recognize this
 > > > situation in
 > > > dmraid and set up a mapping similar to the one above.
 > > >
 > >
 > > I have the same problem.  How would you resolve this?
 > >
 > > Dwaine
 > >
 > >
 > >
 > >
 > > --
 > > dm-devel mailing list
 > > dm-devel redhat com
 > > https://www.redhat.com/mailman/listinfo/dm-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] dm-striped device sizes must be multiple of chunk-size
@ 2006-05-31 16:17 Peyrotau Yannick
  2006-05-31 23:28 ` Heinz Mauelshagen
  0 siblings, 1 reply; 7+ messages in thread
From: Peyrotau Yannick @ 2006-05-31 16:17 UTC (permalink / raw)
  To: dm-devel

Hi, I have the same problem too when i try to upgrade to 2.6.16 kernel.

My motherbord is ASUS A8N-E with a nvidia raid chip.

I have make an archive with my metadata at this adress :
http://crashteam1.free.fr/metadata/metadata_isw-Yannick_Peyrotau-raid0.tar.bz2

Can i resolve it ?


Thanks,
Yannick

> Dwaine,
>
> can you please send me your metadata for refernence as well so
> that I can confirm that my fix is good for bz #186842 ?
>
> Thanks,
> Heinz
>
> On Sun, Mar 26, 2006 at 12:01:17AM +0000, Dwaine Garden wrote:
> > Kevin Corry <kevcorry <at> us.ibm.com> writes:
> > >
> > > I'm thinking that this mapping would do what the BIOS is actually
> > > intending.
> > > It ought to be relatively straight-forward to recognize this
> > > situation in
> > > dmraid and set up a mapping similar to the one above.
> > >
> >
> > I have the same problem.  How would you resolve this?
> >
> > Dwaine
> >
> >
> >
> >
> > --
> > dm-devel mailing list
> > dm-devel redhat com
> > https://www.redhat.com/mailman/listinfo/dm-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Re: [PATCH] dm-striped device sizes must be multiple of chunk-size
  2006-05-31 16:17 [PATCH] dm-striped device sizes must be multiple of chunk-size Peyrotau Yannick
@ 2006-05-31 23:28 ` Heinz Mauelshagen
  0 siblings, 0 replies; 7+ messages in thread
From: Heinz Mauelshagen @ 2006-05-31 23:28 UTC (permalink / raw)
  To: device-mapper development

On Wed, May 31, 2006 at 06:17:58PM +0200, Peyrotau Yannick wrote:
> Hi, I have the same problem too when i try to upgrade to 2.6.16 kernel.
> 
> My motherbord is ASUS A8N-E with a nvidia raid chip.
> 
> I have make an archive with my metadata at this adress :
> http://crashteam1.free.fr/metadata/metadata_isw-Yannick_Peyrotau-raid0.tar.bz2
> 
> Can i resolve it ?

Pull dmraid-1.0.0.rc11 from FC5.

Heinz

> 
> 
> Thanks,
> Yannick
> 
> >Dwaine,
> >
> >can you please send me your metadata for refernence as well so
> >that I can confirm that my fix is good for bz #186842 ?
> >
> >Thanks,
> >Heinz
> >
> >On Sun, Mar 26, 2006 at 12:01:17AM +0000, Dwaine Garden wrote:
> >> Kevin Corry <kevcorry <at> us.ibm.com> writes:
> >> >
> >> > I'm thinking that this mapping would do what the BIOS is actually
> >> > intending.
> >> > It ought to be relatively straight-forward to recognize this
> >> > situation in
> >> > dmraid and set up a mapping similar to the one above.
> >> >
> >>
> >> I have the same problem.  How would you resolve this?
> >>
> >> Dwaine
> >>
> >>
> >>
> >>
> >> --
> >> dm-devel mailing list
> >> dm-devel redhat com
> >> https://www.redhat.com/mailman/listinfo/dm-devel
> 
> --
> dm-devel mailing list
> dm-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Heinz Mauelshagen                                 Red Hat GmbH
Consulting Development Engineer                   Am Sonnenhang 11
Storage Development                               56242 Marienrachdorf
                                                  Germany
Mauelshagen@RedHat.com                            PHONE +49  171 7803392
                                                  FAX   +49 2626 924446
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-05-31 23:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-31 16:17 [PATCH] dm-striped device sizes must be multiple of chunk-size Peyrotau Yannick
2006-05-31 23:28 ` Heinz Mauelshagen
  -- strict thread matches above, loose matches on Subject: below --
2006-05-30 13:14 Peyrotau Yannick
2006-03-23  5:28 Joseph Yasi
2006-03-25  4:46 ` Kevin Corry
2006-03-26  0:01   ` Dwaine Garden
2006-03-14 22:31 Kevin Corry
2006-03-14 22:43 ` Darrick J. Wong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.