if (must_be_container(dfd)) {
if (!st)
st = super_by_fd(dfd, NULL);
- if (st)
- st->ignore_hw_compat = 1;
if (st && st->ss->load_container)
rv = st->ss->load_container(st, dfd, NULL);
NULL, c->verbose);
goto out;
}
- st->ignore_hw_compat = 1;
+ st->ignore_hw_compat = 0;
+
if (st->ss->compare_super == NULL ||
- st->ss->load_super(st, dfd, NULL)) {
+ st->ss->load_super(st, dfd, c->verbose >= 0 ? devname : NULL)) {
if (c->verbose >= 0)
pr_err("no RAID superblock on %s.\n",
devname);
if (mdfd < 0) {
+ /* Skip the clustered ones. This should be started by
+ * clustering resource agents
+ */
+ if (info.array.state & (1 << MD_SB_CLUSTERED))
+ goto out;
+
/* Couldn't find an existing array, maybe make a new one */
mdfd = create_mddev(match ? match->devname : NULL,
name_to_use, c->autof, trustworthy, chosen_name);
if (st2 == NULL ||
st2->ss->load_super(st2, fd, NULL) < 0)
goto next;
+ st2->ignore_hw_compat = 0;
if (!st) {
/* Check domain policy again, this time referring to metadata */
struct supertype *st = super_by_fd(mdfd, NULL);
int ret = 0;
struct map_ent *map = NULL;
- if (st)
- st->ignore_hw_compat = 1;
+
if (st && st->ss->load_container)
ret = st->ss->load_container(st, mdfd, NULL);
close(mdfd);
return 1;
}
sysfs_init(&mdi, -1, ent->devnm);
- if (sysfs_get_str(&mdi, NULL, "array_state",
- buf, sizeof(buf)) > 0) {
- if (strncmp(buf, "active", 6) == 0 ||
- strncmp(buf, "clean", 5) == 0)
- sysfs_set_str(&mdi, NULL,
- "array_state", "read-auto");
+ mdfd = open_dev_excl(ent->devnm);
+ if (mdfd > 0) {
+ close(mdfd);
+ if (sysfs_get_str(&mdi, NULL, "array_state",
+ buf, sizeof(buf)) > 0) {
+ if (strncmp(buf, "active", 6) == 0 ||
+ strncmp(buf, "clean", 5) == 0)
+ sysfs_set_str(&mdi, NULL,
+ "array_state", "read-auto");
+ }
}
mdfd = open_dev(ent->devnm);
if (mdfd < 0) {
if (verbose >= 0)
- pr_err("Cannot open array %s!!\n", ent->dev);
+ pr_err("Cannot open array %s!!\n", ent->devnm);
free_mdstat(ent);
return 1;
}
struct mdstat_ent *mdstat = mdstat_read(0, 0);
struct mdstat_ent *memb;
for (memb = mdstat ; memb ; memb = memb->next)
- if (is_container_member(memb, ent->dev)) {
+ if (is_container_member(memb, ent->devnm)) {
int subfd = open_dev(memb->devnm);
if (subfd >= 0) {
rv |= Manage_subdevs(
- memb->dev, subfd,
+ memb->devnm, subfd,
&devlist, verbose, 0,
NULL, 0);
close(subfd);
}
free_mdstat(mdstat);
} else
- rv |= Manage_subdevs(ent->dev, mdfd, &devlist,
+ rv |= Manage_subdevs(ent->devnm, mdfd, &devlist,
verbose, 0, NULL, 0);
if (rv & 2) {
/* Failed due to EBUSY, try to stop the array.
*/
int devid = devnm2devid(ent->devnm);
run_udisks("--unmount", map_dev(major(devid),minor(devid), 0));
- rv = Manage_stop(ent->dev, mdfd, verbose, 1);
+ rv = Manage_stop(ent->devnm, mdfd, verbose, 1);
if (rv)
/* At least we can try to trigger a 'remove' */
sysfs_uevent(&mdi, "remove");
}
} else {
devlist.disposition = 'r';
- rv = Manage_subdevs(ent->dev, mdfd, &devlist,
+ rv = Manage_subdevs(ent->devnm, mdfd, &devlist,
verbose, 0, NULL, 0);
}
close(mdfd);