+
+ loop:
+ if (tst)
+ tst->ss->free_super(tst);
+ }
+
+ if (mdfd < 0) {
+ /* So... it is up to me to open the device.
+ * We create a name '/dev/md/XXX' based on the info in the
+ * superblock, and call open_mddev on that
+ */
+ mdu_array_info_t inf;
+ char *c;
+ if (!st || !st->sb) {
+ return 2;
+ }
+ st->ss->getinfo_super(st, &info);
+ c = strchr(info.name, ':');
+ if (c) c++; else c= info.name;
+ if (isdigit(*c) && ((ident->autof & 7)==4 || (ident->autof&7)==6))
+ /* /dev/md/d0 style for partitionable */
+ asprintf(&mddev, "/dev/md/d%s", c);
+ else
+ asprintf(&mddev, "/dev/md/%s", c);
+ mdfd = open_mddev(mddev, ident->autof);
+ if (mdfd < 0) {
+ st->ss->free_super(st);
+ free(devices);
+ goto try_again;
+ }
+ vers = md_get_version(mdfd);
+ if (ioctl(mdfd, GET_ARRAY_INFO, &inf)==0) {
+ for (tmpdev = devlist ;
+ tmpdev && tmpdev->used != 1;
+ tmpdev = tmpdev->next)
+ ;
+ fprintf(stderr, Name ": %s already active, cannot restart it!\n", mddev);
+ if (tmpdev)
+ fprintf(stderr, Name ": %s needed for %s...\n",
+ mddev, tmpdev->devname);
+ close(mdfd);
+ mdfd = -1;
+ st->ss->free_super(st);
+ free(devices);
+ goto try_again;
+ }
+ must_close = 1;