LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 000 of 4] md: Introduction - Assorted bugfixes
@ 2007-01-23  0:26 NeilBrown
  2007-01-23  0:26 ` [PATCH 001 of 4] md: Update email address and status for MD in MAINTAINERS NeilBrown
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: NeilBrown @ 2007-01-23  0:26 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-raid, linux-kernel

Following are 4 patches suitable for inclusion in 2.6.20.

Thanks,
NeilBrown

 [PATCH 001 of 4] md: Update email address and status for MD in MAINTAINERS.
 [PATCH 002 of 4] md: Make 'repair' actually work for raid1.
 [PATCH 003 of 4] md: Make sure the events count in an md array never returns to zero.
 [PATCH 004 of 4] md: Avoid reading past the end of a bitmap file.

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

* [PATCH 001 of 4] md: Update email address and status for MD in MAINTAINERS.
  2007-01-23  0:26 [PATCH 000 of 4] md: Introduction - Assorted bugfixes NeilBrown
@ 2007-01-23  0:26 ` NeilBrown
  2007-01-23  0:26 ` [PATCH 002 of 4] md: Make 'repair' actually work for raid1 NeilBrown
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: NeilBrown @ 2007-01-23  0:26 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-raid, linux-kernel



Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./MAINTAINERS |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff .prev/MAINTAINERS ./MAINTAINERS
--- .prev/MAINTAINERS	2007-01-23 11:14:14.000000000 +1100
+++ ./MAINTAINERS	2007-01-23 11:23:03.000000000 +1100
@@ -3011,9 +3011,9 @@ SOFTWARE RAID (Multiple Disks) SUPPORT
 P:	Ingo Molnar
 M:	mingo@redhat.com
 P:	Neil Brown
-M:	neilb@cse.unsw.edu.au
+M:	neilb@suse.de
 L:	linux-raid@vger.kernel.org
-S:	Maintained
+S:	Supported
 
 SOFTWARE SUSPEND:
 P:	Pavel Machek

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

* [PATCH 002 of 4] md: Make 'repair' actually work for raid1.
  2007-01-23  0:26 [PATCH 000 of 4] md: Introduction - Assorted bugfixes NeilBrown
  2007-01-23  0:26 ` [PATCH 001 of 4] md: Update email address and status for MD in MAINTAINERS NeilBrown
@ 2007-01-23  0:26 ` NeilBrown
  2007-01-24  6:57   ` Andrew Morton
  2007-01-23  0:26 ` [PATCH 003 of 4] md: Make sure the events count in an md array never returns to zero NeilBrown
  2007-01-23  0:27 ` [PATCH 004 of 4] md: Avoid reading past the end of a bitmap file NeilBrown
  3 siblings, 1 reply; 7+ messages in thread
From: NeilBrown @ 2007-01-23  0:26 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-raid, linux-kernel


When 'repair' finds a block that is different one the various
parts of the mirror. it is meant to write a chosen good version
to the others.  However it currently writes out the original data
to each. The memcpy to make all the data the same is missing.


Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./drivers/md/raid1.c |    5 +++++
 1 file changed, 5 insertions(+)

diff .prev/drivers/md/raid1.c ./drivers/md/raid1.c
--- .prev/drivers/md/raid1.c	2007-01-23 11:13:45.000000000 +1100
+++ ./drivers/md/raid1.c	2007-01-23 11:23:43.000000000 +1100
@@ -1221,6 +1221,11 @@ static void sync_request_write(mddev_t *
 					sbio->bi_sector = r1_bio->sector +
 						conf->mirrors[i].rdev->data_offset;
 					sbio->bi_bdev = conf->mirrors[i].rdev->bdev;
+					for (j = 0; j < vcnt ; j++)
+						memcpy(page_address(sbio->bi_io_vec[j].bv_page),
+						       page_address(pbio->bi_io_vec[j].bv_page),
+						       PAGE_SIZE);
+
 				}
 			}
 	}

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

* [PATCH 003 of 4] md: Make sure the events count in an md array never returns to zero.
  2007-01-23  0:26 [PATCH 000 of 4] md: Introduction - Assorted bugfixes NeilBrown
  2007-01-23  0:26 ` [PATCH 001 of 4] md: Update email address and status for MD in MAINTAINERS NeilBrown
  2007-01-23  0:26 ` [PATCH 002 of 4] md: Make 'repair' actually work for raid1 NeilBrown
@ 2007-01-23  0:26 ` NeilBrown
  2007-01-23  0:27 ` [PATCH 004 of 4] md: Avoid reading past the end of a bitmap file NeilBrown
  3 siblings, 0 replies; 7+ messages in thread
From: NeilBrown @ 2007-01-23  0:26 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-raid, linux-kernel


Now that we sometimes step the array events count backwards
(when transitioning dirty->clean where nothing else interesting
has happened - so that we don't need to write to spares all the time),
it is possible for the event count to return to zero, which is
potentially confusing and triggers and MD_BUG.

We could possibly remove the MD_BUG, but is just as easy, and
probably safer, to make sure we never return to zero.

Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./drivers/md/md.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff .prev/drivers/md/md.c ./drivers/md/md.c
--- .prev/drivers/md/md.c	2007-01-23 11:13:44.000000000 +1100
+++ ./drivers/md/md.c	2007-01-23 11:23:58.000000000 +1100
@@ -1633,7 +1633,8 @@ repeat:
 	 * and 'events' is odd, we can roll back to the previous clean state */
 	if (nospares
 	    && (mddev->in_sync && mddev->recovery_cp == MaxSector)
-	    && (mddev->events & 1))
+	    && (mddev->events & 1)
+	    && mddev->events != 1)
 		mddev->events--;
 	else {
 		/* otherwise we have to go forward and ... */

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

* [PATCH 004 of 4] md: Avoid reading past the end of a bitmap file.
  2007-01-23  0:26 [PATCH 000 of 4] md: Introduction - Assorted bugfixes NeilBrown
                   ` (2 preceding siblings ...)
  2007-01-23  0:26 ` [PATCH 003 of 4] md: Make sure the events count in an md array never returns to zero NeilBrown
@ 2007-01-23  0:27 ` NeilBrown
  3 siblings, 0 replies; 7+ messages in thread
From: NeilBrown @ 2007-01-23  0:27 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-raid, linux-kernel


In most cases we check the size of the bitmap file before
reading data from it.  However when reading the superblock,
we always read the first PAGE_SIZE bytes, which might not 
always be appropriate.  So limit that read to the size of the
file if appropriate.

Also, we get the count of available bytes wrong in one place,
so that too can read past the end of the file.

Cc:  "yang yin" <yinyang801120@gmail.com>

Signed-off-by: Neil Brown <neilb@suse.de>

### Diffstat output
 ./drivers/md/bitmap.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff .prev/drivers/md/bitmap.c ./drivers/md/bitmap.c
--- .prev/drivers/md/bitmap.c	2007-01-23 11:13:43.000000000 +1100
+++ ./drivers/md/bitmap.c	2007-01-23 11:24:09.000000000 +1100
@@ -479,9 +479,12 @@ static int bitmap_read_sb(struct bitmap 
 	int err = -EINVAL;
 
 	/* page 0 is the superblock, read it... */
-	if (bitmap->file)
-		bitmap->sb_page = read_page(bitmap->file, 0, bitmap, PAGE_SIZE);
-	else {
+	if (bitmap->file) {
+		loff_t isize = i_size_read(bitmap->file->f_mapping->host);
+		int bytes = isize > PAGE_SIZE ? PAGE_SIZE : isize;
+
+		bitmap->sb_page = read_page(bitmap->file, 0, bitmap, bytes);
+	} else {
 		bitmap->sb_page = read_sb_page(bitmap->mddev, bitmap->offset, 0);
 	}
 	if (IS_ERR(bitmap->sb_page)) {
@@ -877,7 +880,8 @@ static int bitmap_init_from_disk(struct 
 			int count;
 			/* unmap the old page, we're done with it */
 			if (index == num_pages-1)
-				count = bytes - index * PAGE_SIZE;
+				count = bytes + sizeof(bitmap_super_t)
+					- index * PAGE_SIZE;
 			else
 				count = PAGE_SIZE;
 			if (index == 0) {

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

* Re: [PATCH 002 of 4] md: Make 'repair' actually work for raid1.
  2007-01-23  0:26 ` [PATCH 002 of 4] md: Make 'repair' actually work for raid1 NeilBrown
@ 2007-01-24  6:57   ` Andrew Morton
  2007-01-24  7:27     ` Neil Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2007-01-24  6:57 UTC (permalink / raw)
  To: NeilBrown; +Cc: linux-raid, linux-kernel

On Tue, 23 Jan 2007 11:26:52 +1100
NeilBrown <neilb@suse.de> wrote:

> +					for (j = 0; j < vcnt ; j++)
> +						memcpy(page_address(sbio->bi_io_vec[j].bv_page),
> +						       page_address(pbio->bi_io_vec[j].bv_page),
> +						       PAGE_SIZE);

I trust these BIOs are known to only contain suitably-allocated, MD-private
pages?  Because if these pages can be user pages then this change is
spectacularly buggy ;)


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

* Re: [PATCH 002 of 4] md: Make 'repair' actually work for raid1.
  2007-01-24  6:57   ` Andrew Morton
@ 2007-01-24  7:27     ` Neil Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Neil Brown @ 2007-01-24  7:27 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-raid, linux-kernel

On Tuesday January 23, akpm@osdl.org wrote:
> On Tue, 23 Jan 2007 11:26:52 +1100
> NeilBrown <neilb@suse.de> wrote:
> 
> > +					for (j = 0; j < vcnt ; j++)
> > +						memcpy(page_address(sbio->bi_io_vec[j].bv_page),
> > +						       page_address(pbio->bi_io_vec[j].bv_page),
> > +						       PAGE_SIZE);
> 
> I trust these BIOs are known to only contain suitably-allocated, MD-private
> pages?  Because if these pages can be user pages then this change is
> spectacularly buggy ;)

Your trust is well placed.
This is in the 'resync' path, were all buffers are allocated in lowmem
and are full pages and so-forth, so this is perfectly safe.

NeilBrown

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

end of thread, other threads:[~2007-01-24  7:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-23  0:26 [PATCH 000 of 4] md: Introduction - Assorted bugfixes NeilBrown
2007-01-23  0:26 ` [PATCH 001 of 4] md: Update email address and status for MD in MAINTAINERS NeilBrown
2007-01-23  0:26 ` [PATCH 002 of 4] md: Make 'repair' actually work for raid1 NeilBrown
2007-01-24  6:57   ` Andrew Morton
2007-01-24  7:27     ` Neil Brown
2007-01-23  0:26 ` [PATCH 003 of 4] md: Make sure the events count in an md array never returns to zero NeilBrown
2007-01-23  0:27 ` [PATCH 004 of 4] md: Avoid reading past the end of a bitmap file NeilBrown

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).