[PATCH] mdadm -As --auto=yes fails if some of the md are already active

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hello, since i started forcing auto=yes to mdadm, due to udev
i discovered a small problem.

basically when starting an array the routine that should check and
create the device file in mdopen.c errors if the md is already active.
this is not needed since trying to activate an already active array is
checked further in the code path.

also i believe that running mdadm -As when all devices are active should
return with 0 exit code. (that is the reason for the hunk patching
mdadm.c)

please apply

Regards,
L.


--
Luca Berra -- bluca@xxxxxxxxxx
       Communication Media & Services S.r.l.
/"\
\ /     ASCII RIBBON CAMPAIGN
 X        AGAINST HTML MAIL
/ \
* Sat Aug 19 2006 Luca Berra <bluca@xxxxxxxx>
- do not fail when autoassembling everything and some md are already active

--- mdadm-2.5.3/mdadm.c	2006-08-19 17:00:51.000000000 +0200
+++ mdadm-2.5.3/mdadm.c	2006-08-19 16:30:16.000000000 +0200
@@ -1020,7 +1020,7 @@
 				}
 				if (ioctl(mdfd, GET_ARRAY_INFO, &array)>=0)
 					/* already assembled, skip */
-					;
+					cnt++;
 				else {
 					rv |= Assemble(ss, array_list->devname, mdfd,
 						       array_list,
--- mdadm-2.5.3/mdopen.c	2006-06-26 07:11:00.000000000 +0200
+++ mdadm-2.5.3/mdopen.c	2006-08-19 17:03:24.000000000 +0200
@@ -166,10 +166,7 @@
 			}
 			if (ioctl(mdfd, GET_ARRAY_INFO, &array)==0) {
 				/* already active */
-				close(mdfd);
-				fprintf(stderr, Name ": %s is already active.\n",
-					dev);
-				return -1;
+				return mdfd;
 			} else {
 				if (major != MD_MAJOR && parts > 0)
 					make_parts(dev, parts);

[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux