1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

dmstatus: check nr_regions ahead of find call

Prevent call of dm_stats_populate(), when there has been no
stats region detected for a DM device.
Such skip is evaluated as 'correct' visit of stats call and
not causing 'dmstats' command failure.
This commit is contained in:
Zdenek Kabelac 2018-03-14 21:01:22 +01:00
parent 4c925692f5
commit a082ce2613
2 changed files with 7 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.147 - Version 1.02.147 -
===================================== =====================================
Avoid calling dm_stats_populat() for DM devices without any stats regions.
Support DM_DEBUG_WITH_LINE_NUMBERS envvar for debug msg with source:line. Support DM_DEBUG_WITH_LINE_NUMBERS envvar for debug msg with source:line.
Configured command for thin pool threshold handling gets whole environment. Configured command for thin pool threshold handling gets whole environment.
Fix tests for failing dm_snprintf() in stats code. Fix tests for failing dm_snprintf() in stats code.

View File

@ -910,6 +910,12 @@ static int _display_info_cols(struct dm_task *dmt, struct dm_info *info)
if (!(obj.stats = dm_stats_create(DM_STATS_PROGRAM_ID))) if (!(obj.stats = dm_stats_create(DM_STATS_PROGRAM_ID)))
goto_out; goto_out;
if (!dm_stats_get_nr_regions(obj.stats)) {
log_debug("Skipping %s with no regions.", dm_task_get_name(dmt));
r = 1;
goto out;
}
dm_stats_bind_devno(obj.stats, info->major, info->minor); dm_stats_bind_devno(obj.stats, info->major, info->minor);
if (!dm_stats_populate(obj.stats, _program_id, DM_STATS_REGIONS_ALL)) if (!dm_stats_populate(obj.stats, _program_id, DM_STATS_REGIONS_ALL))