linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch mdadm-3.2.2] Fix the fix for the readd bug
@ 2011-07-27 18:30 Doug Ledford
  2011-09-19  3:06 ` NeilBrown
  0 siblings, 1 reply; 2+ messages in thread
From: Doug Ledford @ 2011-07-27 18:30 UTC (permalink / raw)
  To: NeilBrown, linux-raid

[-- 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;

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

* Re: [Patch mdadm-3.2.2] Fix the fix for the readd bug
  2011-07-27 18:30 [Patch mdadm-3.2.2] Fix the fix for the readd bug Doug Ledford
@ 2011-09-19  3:06 ` NeilBrown
  0 siblings, 0 replies; 2+ messages in thread
From: NeilBrown @ 2011-09-19  3:06 UTC (permalink / raw)
  To: Doug Ledford; +Cc: linux-raid

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

On Wed, 27 Jul 2011 14:30:35 -0400 Doug Ledford <dledford@redhat.com> wrote:

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

Sorry for late review.

I don't agree with this patch.
'nr_disks' is exactly the number of devices in the mddev->disks list in the
kernel.   get_array_info() counts them.  This includes failed and spare
devices.

When GET_DISK_INFO is used, these devices will return a meaningful
major/minor and all others will return '0' for major and minor.
So the code should work as is.

Do you remember if you had a case where this failed?  Can you describe it?
Can you reproduce it?
Thanks,
NeilBrown


--- 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;

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 190 bytes --]

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

end of thread, other threads:[~2011-09-19  3:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-27 18:30 [Patch mdadm-3.2.2] Fix the fix for the readd bug Doug Ledford
2011-09-19  3:06 ` 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).