From: Czarnowska, Anna Sent: Monday, July 05, 2010 11:26 AM To: Neil Brown Cc: linux-raid@xxxxxxxxxxxxxxx; Czarnowska, Anna; Hawrylewicz Czarnowski, Przemyslaw; Labun, Marcin; Neubauer, Wojciech; Williams, Dan J; Ciechanowski, Ed; dledford@xxxxxxxxxx Subject: [PATCH 12/33] assembly: user domain/subset from configuration file in assembly process From: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@xxxxxxxxx> Device and volume/container must be in the same domain/subset to be assembled. Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@xxxxxxxxx> --- Assemble.c | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/Assemble.c b/Assemble.c index 1504f1f..cc51428 100644 --- a/Assemble.c +++ b/Assemble.c @@ -169,6 +169,9 @@ int Assemble(struct supertype *st, char *mddev, int trustworthy; char chosen_name[1024]; + struct domain_ent *domain = NULL, *de; + struct subset *subset = NULL, *ss; + if (get_linux_version() < 2004000) old_linux = 1; @@ -384,6 +387,35 @@ int Assemble(struct supertype *st, char *mddev, if (tst == NULL || tst->sb == NULL) continue; } + + if (!tst->loaded_container) { /* do not test container, just members */ + de = conf_get_domain(devname, (char *)tst->ss->name); + if (!de) { + fprintf(stderr, Name ": Can't determine domain of %s.", + devname); + if (st) + st->ss->free_super(st); + return 1; + } + ss = conf_get_subset(devname, st, de); + if (!domain) { + if (report_missmatch) { + fprintf(stderr, Name ": Base domain set for " + "device: %s\n", + devname); + } + domain = de; + subset = ss; + } else { + if (domain != de || subset != ss) { + if (report_missmatch) + fprintf(stderr, Name ": %s does not belong to the same " + "domain/subset.\n", + devname); + goto loop; + } + } + } /* If we are this far, then we are nearly commited to this device. * If the super_block doesn't exist, or doesn't match others, * then we probably cannot continue -- 1.6.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html