All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Ledford <dledford@redhat.com>
To: NeilBrown <neilb@suse.de>, linux-raid@vger.kernel.org
Subject: [Patch mdadm-3.2.2] Fix the fix for the readd bug
Date: Wed, 27 Jul 2011 14:30:35 -0400	[thread overview]
Message-ID: <4E30594B.9030306@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

The readd bug fix didn't work due to a faulty test.  We need to check 
raid_disks to get an upper bound of the found slots to check since 
nr_disks only counts good disks and we could have faulty or spares that 
aren't counted but amount to an occupied slot.

Signed-off-by: Doug Ledford <dledford@redhat.com>

[-- Attachment #2: mdadm-3.2.2-readd.patch --]
[-- Type: text/plain, Size: 759 bytes --]

--- mdadm-3.2.2/util.c.readd	2011-06-17 01:15:50.000000000 -0400
+++ mdadm-3.2.2/util.c	2011-07-18 14:43:40.776150946 -0400
@@ -364,19 +364,21 @@ int enough_fd(int fd)
 	struct mdu_disk_info_s disk;
 	int avail_disks = 0;
 	int i;
+	int raid_disks;
 	char *avail;
 
 	if (ioctl(fd, GET_ARRAY_INFO, &array) != 0 ||
 	    array.raid_disks <= 0)
 		return 0;
 	avail = calloc(array.raid_disks, 1);
-	for (i=0; i < 1024 && array.nr_disks > 0; i++) {
+	raid_disks = array.raid_disks;
+	for (i=0; i < 1024 && raid_disks > 0; i++) {
 		disk.number = i;
 		if (ioctl(fd, GET_DISK_INFO, &disk) != 0)
 			continue;
 		if (disk.major == 0 && disk.minor == 0)
 			continue;
-		array.nr_disks--;
+		raid_disks--;
 
 		if (! (disk.state & (1<<MD_DISK_SYNC)))
 			continue;

             reply	other threads:[~2011-07-27 18:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-27 18:30 Doug Ledford [this message]
2011-09-19  3:06 ` [Patch mdadm-3.2.2] Fix the fix for the readd bug NeilBrown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E30594B.9030306@redhat.com \
    --to=dledford@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.