linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug in RAID1 in 2.4
@ 2003-12-20  8:25 Pete Zaitcev
  2003-12-21  9:44 ` Neil Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Pete Zaitcev @ 2003-12-20  8:25 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid, Ingo Molnar, Pete Zaitcev

In drivers/md/raid1.c, raid1_sync_request contains the following:
  
        block_nr = sector_nr;
        bsize = 512;
        while (!(block_nr & 1) && bsize < PAGE_SIZE
                        && (block_nr+2)*(bsize>>9) < (mddev->sb->size *2)) {
                block_nr >>= 1;
                bsize <<= 1;
        }

Suppose that a mirror is 4K in size. The code above produces
reads (and writes) of the following offsets and sizes:
 0K[2K], 2K[1K], 3K[0.5K], 3.5K[0.5K]

The above is correct, but it makes the RAID1 completely unuseable
on s390, because I/O with sizes less than 4K is not supported.
I would like the attached patch applied to correct the issue.

-- Pete

--- linux-2.4.23/drivers/md/raid1.c	2003-06-13 07:51:34.000000000 -0700
+++ linux-2.4.23-nip/drivers/md/raid1.c	2003-12-19 23:57:57.000000000 -0800
@@ -1436,7 +1436,7 @@
 	block_nr = sector_nr;
 	bsize = 512;
 	while (!(block_nr & 1) && bsize < PAGE_SIZE
-			&& (block_nr+2)*(bsize>>9) < (mddev->sb->size *2)) {
+			&& (block_nr+2)*(bsize>>9) <= (mddev->sb->size *2)) {
 		block_nr >>= 1;
 		bsize <<= 1;
 	}

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

* Re: Bug in RAID1 in 2.4
  2003-12-20  8:25 Bug in RAID1 in 2.4 Pete Zaitcev
@ 2003-12-21  9:44 ` Neil Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Brown @ 2003-12-21  9:44 UTC (permalink / raw)
  To: Pete Zaitcev; +Cc: Marcelo Tosatti, linux-raid, Ingo Molnar

On Saturday December 20, zaitcev@redhat.com wrote:
> In drivers/md/raid1.c, raid1_sync_request contains the following:
>   
>         block_nr = sector_nr;
>         bsize = 512;
>         while (!(block_nr & 1) && bsize < PAGE_SIZE
>                         && (block_nr+2)*(bsize>>9) < (mddev->sb->size *2)) {
>                 block_nr >>= 1;
>                 bsize <<= 1;
>         }
> 
> Suppose that a mirror is 4K in size. The code above produces
> reads (and writes) of the following offsets and sizes:
>  0K[2K], 2K[1K], 3K[0.5K], 3.5K[0.5K]
> 
> The above is correct, but it makes the RAID1 completely unuseable
> on s390, because I/O with sizes less than 4K is not supported.
> I would like the attached patch applied to correct the issue.

Yes, I agree.  Marcelo, could you please apply this patch.
The '<' test is just to make sure a request of 2*bsize at block_nr
will still fit within the size of the device, so a <= is appropriate.

NeilBrown

--- linux-2.4.23/drivers/md/raid1.c	2003-06-13 07:51:34.000000000 -0700
+++ linux-2.4.23-nip/drivers/md/raid1.c	2003-12-19 23:57:57.000000000 -0800
@@ -1436,7 +1436,7 @@
 	block_nr = sector_nr;
 	bsize = 512;
 	while (!(block_nr & 1) && bsize < PAGE_SIZE
-			&& (block_nr+2)*(bsize>>9) < (mddev->sb->size *2)) {
+			&& (block_nr+2)*(bsize>>9) <= (mddev->sb->size *2)) {
 		block_nr >>= 1;
 		bsize <<= 1;
 	}

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

end of thread, other threads:[~2003-12-21  9:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-20  8:25 Bug in RAID1 in 2.4 Pete Zaitcev
2003-12-21  9:44 ` Neil Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).