int remaining_disks;
int last_disk;
int new_array = 0;
+ int retval;
if (test)
alert("TestMessage", dev, NULL, ainfo);
+ retval = 0;
+
fd = open(dev, O_RDONLY);
if (fd < 0) {
if (!st->err)
alert("DeviceDisappeared", dev, NULL, ainfo);
st->err++;
- return 0;
+ goto out;
}
if (!md_array_active(fd)) {
if (!st->err)
alert("DeviceDisappeared", dev, NULL, ainfo);
st->err++;
- return 0;
+ goto out;
}
fcntl(fd, F_SETFD, FD_CLOEXEC);
alert("DeviceDisappeared", dev, NULL, ainfo);
st->err++;
close(fd);
- return 0;
+ goto out;
}
/* It's much easier to list what array levels can't
* have a device disappear than all of them that can
alert("DeviceDisappeared", dev, " Wrong-Level", ainfo);
st->err++;
close(fd);
- return 0;
+ goto out;
}
if (st->devnm[0] == 0)
strcpy(st->devnm, fd2devnm(fd));
* or re-created after reading mdstat*/
st->err++;
close(fd);
- return 0;
+ goto out;
}
/* this array is in /proc/mdstat */
if (array.utime == 0)
(mse == NULL || (mse->percent == st->percent))) {
close(fd);
if ((st->active < st->raid) && st->spare == 0)
- return 1;
- else
- return 0;
+ retval = 1;
+ goto out;
}
if (st->utime == 0 && /* new array */
mse->pattern && strchr(mse->pattern, '_') /* degraded */)
st->raid = array.raid_disks;
st->err = 0;
if ((st->active < st->raid) && st->spare == 0)
- return 1;
- return 0;
+ retval = 1;
+
+ out:
+ return retval;
}
static int add_new_arrays(struct mdstat_ent *mdstat, struct state **statelist,