*/
st2 = dup_super(st);
if (st2->ss->load_super(st2, dfd, NULL) == 0) {
- st2->ss->getinfo_super(st, &info, NULL);
+ st2->ss->getinfo_super(st2, &info, NULL);
if (st->ss->compare_super(st, st2) == 0 &&
info.disk.raid_disk >= 0) {
/* Looks like a good member of array.
/* Raced with something */
return;
- // FIXME
- a->info.array.raid_disks = mdstat->raid_disks;
- // MORE
+ if (mdstat->active) {
+ // FIXME
+ a->info.array.raid_disks = mdstat->raid_disks;
+ // MORE
+ }
if (sysfs_get_ll(&a->info, NULL, "component_size", &component_size) >= 0)
a->info.component_size = component_size << 1;
if (a->container == NULL)
return;
- if (sigterm && a->info.safe_mode_delay > 1) {
+ if (sigterm && a->info.safe_mode_delay != 1) {
sysfs_set_safemode(&a->info, 1);
a->info.safe_mode_delay = 1;
}
mdi = sysfs_read(-1, mdstat->devnm,
GET_LEVEL|GET_CHUNK|GET_DISKS|GET_COMPONENT|
GET_DEGRADED|GET_SAFEMODE|
- GET_DEVS|GET_OFFSET|GET_SIZE|GET_STATE);
+ GET_DEVS|GET_OFFSET|GET_SIZE|GET_STATE|GET_LAYOUT);
if (!mdi)
return;
new->resync_start_fd = sysfs_open(new->info.sys_name, NULL, "resync_start");
new->metadata_fd = sysfs_open(new->info.sys_name, NULL, "metadata_version");
new->sync_completed_fd = sysfs_open(new->info.sys_name, NULL, "sync_completed");
- dprintf("%s: inst: %d action: %d state: %d\n", __func__, atoi(inst),
+ dprintf("%s: inst: %s action: %d state: %d\n", __func__, inst,
new->action_fd, new->info.state_fd);
if (sigterm)