[Patch mdadm-3.2.2] Fix the fix for the readd bug

[Patch mdadm-3.2.2] Fix the fix for the readd bug

am 27.07.2011 20:30:35 von Doug Ledford

This is a multi-part message in MIME format.
--------------060603020900020401090907
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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

--------------060603020900020401090907
Content-Type: text/plain;
name="mdadm-3.2.2-readd.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="mdadm-3.2.2-readd.patch"

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

--------------060603020900020401090907--
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [Patch mdadm-3.2.2] Fix the fix for the readd bug

am 19.09.2011 05:06:23 von NeilBrown

--Sig_/OVUfIGYWhf.XjtF2vIl0h2H
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

On Wed, 27 Jul 2011 14:30:35 -0400 Doug Ledford wrote:

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

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 =3D 0;
int i;
+ int raid_disks;
char *avail;
=20
if (ioctl(fd, GET_ARRAY_INFO, &array) !=3D 0 ||
array.raid_disks <=3D 0)
return 0;
avail =3D calloc(array.raid_disks, 1);
- for (i=3D0; i < 1024 && array.nr_disks > 0; i++) {
+ raid_disks =3D array.raid_disks;
+ for (i=3D0; i < 1024 && raid_disks > 0; i++) {
disk.number =3D i;
if (ioctl(fd, GET_DISK_INFO, &disk) !=3D 0)
continue;
if (disk.major == 0 && disk.minor == 0)
continue;
- array.nr_disks--;
+ raid_disks--;
=20
if (! (disk.state & (1< continue;

--Sig_/OVUfIGYWhf.XjtF2vIl0h2H
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)

iD8DBQFOdrGvG5fc6gV+Wb0RAkRIAKCfxnWbnKOPkxlS5mmb2jCnSg16lwCf ditJ
X6D7ax3M5tVyIrKB+Lxr90Y=
=bXOZ
-----END PGP SIGNATURE-----

--Sig_/OVUfIGYWhf.XjtF2vIl0h2H--
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html