Assemble: block attempts to reassemble container members
Attempting to open(O_EXCL) each candidate device usually filters out all busy raid components. However, containers do not behave like components and will return container_content that may describe active member arrays. This patch just adds a function that will be used to check if a container member is busy. It will be used shortly. Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
6234c63ccc
commit
2de8884f0f
25
Assemble.c
25
Assemble.c
|
@ -50,6 +50,31 @@ static int name_matches(char *found, char *required, char *homehost)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*static */ int is_member_busy(char *metadata_version)
|
||||
{
|
||||
/* check if the given member array is active */
|
||||
struct mdstat_ent *mdstat = mdstat_read(1, 0);
|
||||
struct mdstat_ent *ent;
|
||||
int busy = 0;
|
||||
|
||||
for (ent = mdstat; ent; ent = ent->next) {
|
||||
if (ent->metadata_version == NULL)
|
||||
continue;
|
||||
if (strncmp(ent->metadata_version, "external:", 9) != 0)
|
||||
continue;
|
||||
if (!is_subarray(&ent->metadata_version[9]))
|
||||
continue;
|
||||
/* Skip first char - it can be '/' or '-' */
|
||||
if (strcmp(&ent->metadata_version[10], metadata_version+1) == 0) {
|
||||
busy = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
free_mdstat(mdstat);
|
||||
|
||||
return busy;
|
||||
}
|
||||
|
||||
int Assemble(struct supertype *st, char *mddev,
|
||||
mddev_ident_t ident,
|
||||
mddev_dev_t devlist, char *backup_file,
|
||||
|
|
Loading…
Reference in New Issue