mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
libdm: separate dm_stats_populate() error cases
There are two possible errors in _dm_stats_populate_region(): * No region struct in dms->regions[region_id] * Failure to parse data from @stats_print These have very different causes: the first occurs where a client program is populating one region at a time (region_id is a single region identifier), and has not previously called dm_stats_list() to dimension the region tables; this is an API usage error. The second occurs when either we read unparseable data from the kernel (kernel bug), or where various resource allocations fail. Separate these two cases out and log separate messages for each (allocation failures in the path already have their own distinct message), since the "failed to parse.." message in the un-listed handle case is confusing and misleading.
This commit is contained in:
parent
6de05cf5f5
commit
2a86f54b09
@ -2241,7 +2241,11 @@ static int _dm_stats_populate_region(struct dm_stats *dms, uint64_t region_id,
|
|||||||
if (!_stats_bound(dms))
|
if (!_stats_bound(dms))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
if (!region || !_stats_parse_region(dms, resp, region, region->timescale)) {
|
if (!region) {
|
||||||
|
log_error("Cannot populate empty handle before dm_stats_list().");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (!_stats_parse_region(dms, resp, region, region->timescale)) {
|
||||||
log_error("Could not parse @stats_print message response.");
|
log_error("Could not parse @stats_print message response.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user