From c98868181fa3ee0816d525ef186c1059a46f1d0b Mon Sep 17 00:00:00 2001 From: "Bryn M. Reeves" Date: Thu, 9 Mar 2017 17:33:02 +0000 Subject: [PATCH] libdm: remove unnecessary backtrace in _stats_group_id_present() It's not an error to call dm_stats_group_present() on a handle that contains no regions. This causes dmfilemap to log a false backtrace during shutdown if all regions are removed from the corresponding device: exiting _filemap_monitor_get_events() with deleted=0, check=0 waiting for FILEMAPD_WAIT dm message (253:1) [ opencount flush ] @stats_list dmstats [32768] (*1) Filemap group removed: exiting. Change this to only emit a backtrace if the handle is NULL. --- libdm/libdm-stats.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c index 3f6730eac..f0a7dbfef 100644 --- a/libdm/libdm-stats.c +++ b/libdm/libdm-stats.c @@ -264,9 +264,12 @@ static int _stats_group_id_present(const struct dm_stats *dms, uint64_t id) if (id == DM_STATS_GROUP_NOT_PRESENT) return 0; - if (!dms || !dms->regions) + if (!dms) return_0; + if (!dms->regions) + return 0; + if (id > dms->max_region) return 0;