From linux-kernel@vger.kernel.org Sun Dec 28 14:29:04 2003 Date: Mon, 22 Dec 2003 11:32:50 +0000 From: Linux Kernel Mailing List To: bk-commits-24@vger.kernel.org Subject: [PATCH] Fix RAID1 blocksize check ChangeSet 1.1313, 2003/12/22 09:32:50-02:00, neilb@cse.unsw.edu.au [PATCH] Fix RAID1 blocksize check 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 # This patch includes the following deltas: # ChangeSet 1.1312 -> 1.1313 # drivers/md/raid1.c 1.16 -> 1.17 # raid1.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -Nru a/drivers/md/raid1.c b/drivers/md/raid1.c --- a/drivers/md/raid1.c Mon Dec 22 04:03:08 2003 +++ b/drivers/md/raid1.c Mon Dec 22 04:03:08 2003 @@ -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; } - To unsubscribe from this list: send the line "unsubscribe bk-commits-24" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html