Assemble: ignore devices= if container= is present.
If "container=" is present, then we are going to assemble from the given container where that container is made of those devices or not. So in this case the "devices=" is purely documentation and is best ignored. As part of this, move the test on the "container=" value when that start with "/" up before the device is opened. There sooner we test things, the better. Reported-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
eb2306f841
commit
c39b2e633f
47
Assemble.c
47
Assemble.c
|
@ -171,8 +171,20 @@ static int select_devices(struct mddev_dev *devlist,
|
||||||
if (tmpdev->used > 1)
|
if (tmpdev->used > 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ident->devices &&
|
if (ident->container) {
|
||||||
!match_oneof(ident->devices, devname)) {
|
if (ident->container[0] == '/' &&
|
||||||
|
!same_dev(ident->container, devname)) {
|
||||||
|
if (report_mismatch)
|
||||||
|
pr_err("%s is not the container required (%s)\n",
|
||||||
|
devname, ident->container);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} else if (ident->devices &&
|
||||||
|
!match_oneof(ident->devices, devname)) {
|
||||||
|
/* Note that we ignore the "device=" identifier if a
|
||||||
|
* "container=" is given. Checking both is unnecessarily
|
||||||
|
* complicated.
|
||||||
|
*/
|
||||||
if (report_mismatch)
|
if (report_mismatch)
|
||||||
pr_err("%s is not one of %s\n", devname, ident->devices);
|
pr_err("%s is not one of %s\n", devname, ident->devices);
|
||||||
continue;
|
continue;
|
||||||
|
@ -289,29 +301,20 @@ static int select_devices(struct mddev_dev *devlist,
|
||||||
}
|
}
|
||||||
close(dfd);
|
close(dfd);
|
||||||
|
|
||||||
if (ident->container) {
|
if (ident->container && ident->container[0] != '/') {
|
||||||
if (ident->container[0] == '/' &&
|
/* we have a uuid */
|
||||||
!same_dev(ident->container, devname)) {
|
int uuid[4];
|
||||||
|
|
||||||
|
content = *contentp;
|
||||||
|
tst->ss->getinfo_super(tst, content, NULL);
|
||||||
|
|
||||||
|
if (!parse_uuid(ident->container, uuid) ||
|
||||||
|
!same_uuid(content->uuid, uuid, tst->ss->swapuuid)) {
|
||||||
if (report_mismatch)
|
if (report_mismatch)
|
||||||
pr_err("%s is not the container required (%s)\n",
|
pr_err("%s has wrong UUID to be required container\n",
|
||||||
devname, ident->container);
|
devname);
|
||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
if (ident->container[0] != '/') {
|
|
||||||
/* we have a uuid */
|
|
||||||
int uuid[4];
|
|
||||||
|
|
||||||
content = *contentp;
|
|
||||||
tst->ss->getinfo_super(tst, content, NULL);
|
|
||||||
|
|
||||||
if (!parse_uuid(ident->container, uuid) ||
|
|
||||||
!same_uuid(content->uuid, uuid, tst->ss->swapuuid)) {
|
|
||||||
if (report_mismatch)
|
|
||||||
pr_err("%s has wrong UUID to be required container\n",
|
|
||||||
devname);
|
|
||||||
goto loop;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* It is worth looking inside this container.
|
/* It is worth looking inside this container.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue