Don't abort starting the array if kernel does not support ppl

Change the behavior of assemble and create for consistency-policy=ppl
for external metadata arrays. If the kernel does not support ppl, don't
abort but print a warning and start the array without ppl
(consistency-policy=resync). No change for native md arrays because the
kernel will not allow starting the array if it finds an unsupported
feature bit in the superblock.

In sysfs_add_disk() check consistency_policy in the mdinfo structure
that represents the array, not the disk and read the current consistency
policy from sysfs in mdmon's manage_member(). This is necessary to make
sysfs_add_disk() honor the actual consistency policy and not what is in
the metadata. Also remove all the places where consistency_policy is set
for a disk's mdinfo - it is a property of the array, not the disk.

Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
This commit is contained in:
Artur Paszkiewicz 2017-09-28 14:41:07 +02:00 committed by Jes Sorensen
parent 5c1dec3e3e
commit 2c8890e926
3 changed files with 12 additions and 9 deletions

View File

@ -477,7 +477,7 @@ static void manage_member(struct mdstat_ent *mdstat,
char buf[64];
int frozen;
struct supertype *container = a->container;
unsigned long long int component_size = 0;
struct mdinfo *mdi;
if (container == NULL)
/* Raced with something */
@ -489,8 +489,13 @@ static void manage_member(struct mdstat_ent *mdstat,
// MORE
}
if (sysfs_get_ll(&a->info, NULL, "component_size", &component_size) >= 0)
a->info.component_size = component_size << 1;
mdi = sysfs_read(-1, mdstat->devnm,
GET_COMPONENT|GET_CONSISTENCY_POLICY);
if (mdi) {
a->info.component_size = mdi->component_size;
a->info.consistency_policy = mdi->consistency_policy;
sysfs_free(mdi);
}
/* honor 'frozen' */
if (sysfs_get_str(&a->info, NULL, "metadata_version", buf, sizeof(buf)) > 0)

View File

@ -7669,7 +7669,6 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
} else {
info_d->component_size = blocks_per_member(map);
}
info_d->consistency_policy = this->consistency_policy;
info_d->bb.supported = 1;
get_volume_badblocks(super->bbm_log, ord_to_idx(ord),
@ -8758,8 +8757,7 @@ static struct mdinfo *imsm_activate_spare(struct active_array *a,
di->component_size = a->info.component_size;
di->container_member = inst;
di->bb.supported = 1;
if (dev->rwh_policy == RWH_DISTRIBUTED) {
di->consistency_policy = CONSISTENCY_POLICY_PPL;
if (a->info.consistency_policy == CONSISTENCY_POLICY_PPL) {
di->ppl_sector = get_ppl_sector(super, inst);
di->ppl_size = (PPL_HEADER_SIZE + PPL_ENTRY_SPACE) >> 9;
}

View File

@ -709,8 +709,8 @@ int sysfs_set_array(struct mdinfo *info, int vers)
if (sysfs_set_str(info, NULL, "consistency_policy",
map_num(consistency_policies,
info->consistency_policy))) {
pr_err("This kernel does not support PPL\n");
return 1;
pr_err("This kernel does not support PPL. Falling back to consistency-policy=resync.\n");
info->consistency_policy = CONSISTENCY_POLICY_RESYNC;
}
}
@ -745,7 +745,7 @@ int sysfs_add_disk(struct mdinfo *sra, struct mdinfo *sd, int resume)
rv = sysfs_set_num(sra, sd, "offset", sd->data_offset);
rv |= sysfs_set_num(sra, sd, "size", (sd->component_size+1) / 2);
if (sra->array.level != LEVEL_CONTAINER) {
if (sd->consistency_policy == CONSISTENCY_POLICY_PPL) {
if (sra->consistency_policy == CONSISTENCY_POLICY_PPL) {
rv |= sysfs_set_num(sra, sd, "ppl_sector", sd->ppl_sector);
rv |= sysfs_set_num(sra, sd, "ppl_size", sd->ppl_size);
}