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

libdm-stats: fix error messages

When function dm_stats_populate() returns 0 it's an error and needs
log_error() message -  function can't have 'success' returning 0 or
error without reasons.
This commit is contained in:
Zdenek Kabelac 2018-03-14 21:00:46 +01:00
parent a082ce2613
commit 043f58452a
2 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.147 - Version 1.02.147 -
===================================== =====================================
Add missing log_error() into dm_stats_populate() returning 0.
Avoid calling dm_stats_populat() for DM devices without any stats regions. 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.

View File

@ -403,7 +403,7 @@ static int _stats_bound(const struct dm_stats *dms)
if (dms->bind_major > 0 || dms->bind_name || dms->bind_uuid) if (dms->bind_major > 0 || dms->bind_name || dms->bind_uuid)
return 1; return 1;
/* %p format specifier expects a void pointer. */ /* %p format specifier expects a void pointer. */
log_debug("Stats handle at %p is not bound.", dms); log_error("Stats handle at %p is not bound.", dms);
return 0; return 0;
} }
@ -2336,6 +2336,11 @@ int dm_stats_populate(struct dm_stats *dms, const char *program_id,
return 0; return 0;
} }
if (!dms->nr_regions) {
log_error("No regions registered.");
return 0;
}
/* allow zero-length program_id for populate */ /* allow zero-length program_id for populate */
if (!program_id) if (!program_id)
program_id = dms->program_id; program_id = dms->program_id;
@ -2347,10 +2352,6 @@ int dm_stats_populate(struct dm_stats *dms, const char *program_id,
goto_bad; goto_bad;
} }
/* successful list but no regions registered */
if (!dms->nr_regions)
return 0;
dms->walk_flags = DM_STATS_WALK_REGION; dms->walk_flags = DM_STATS_WALK_REGION;
dm_stats_walk_start(dms); dm_stats_walk_start(dms);
do { do {