diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 59839f515..038c18d85 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.65 - ================================== + Fix "all" report field prefix matching to include label fields with pv_all. Delay resuming new preloaded mirror devices with core logs in deptree code. Accept new kernel version 3 uname formats in initialisation. diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c index dca69c848..021a21c83 100644 --- a/libdm/libdm-report.c +++ b/libdm/libdm-report.c @@ -367,33 +367,32 @@ static uint32_t _all_match(struct dm_report *rh, const char *field, size_t flen) { size_t prefix_len; const struct dm_report_object_type *t; - char prefixed_all[32]; + uint32_t report_types = 0; + unsigned unprefixed_all_matched = 0; if (!strncasecmp(field, "all", 3) && flen == 3) { - if (strlen(rh->field_prefix)) { - strcpy(prefixed_all, rh->field_prefix); - strcat(prefixed_all, "all"); - /* - * Add also prefix to receive all attributes - * (e.g.LABEL/PVS use the same prefix) - */ - return rh->report_types | - _all_match(rh, prefixed_all, - strlen(prefixed_all)); - } else - return (rh->report_types) - ? rh->report_types : REPORT_TYPES_ALL; + /* If there's no report prefix, match all report types */ + if (!(flen = strlen(rh->field_prefix))) + return rh->report_types ? : REPORT_TYPES_ALL; + + /* otherwise include all fields beginning with the report prefix. */ + unprefixed_all_matched = 1; + field = rh->field_prefix; + report_types = rh->report_types; } + /* Combine all report types that have a matching prefix. */ for (t = rh->types; t->data_fn; t++) { prefix_len = strlen(t->prefix); + if (!strncasecmp(t->prefix, field, prefix_len) && - !strncasecmp(field + prefix_len, "all", 3) && - flen == prefix_len + 3) - return t->id; + ((unprefixed_all_matched && (flen == prefix_len)) || + (!strncasecmp(field + prefix_len, "all", 3) && + (flen == prefix_len + 3)))) + report_types |= t->id; } - return 0; + return report_types; } /*