Skip to contentSkip to conversation

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

PATCH New Luca Berra 1 participant 1 message Aug 28, 2006 MD RAID

lore
Share & tools
lore

Luca Berra

author
#0 lore raw

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

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.

Signature · 6 lines
Luca Berra -- [email protected]
       Communication Media & Services S.r.l.
/"\
\ /     ASCII RIBBON CAMPAIGN
 X        AGAINST HTML MAIL
/ \

* Sat Aug 19 2006 Luca Berra <[email protected]>
- do not fail when autoassembling everything and some md are already active

mdadm.c +1 -1
@@ -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,
mdopen.c +1 -4
@@ -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);