[lvm-devel] master - libdm: remove unnecessary backtrace in _stats_group_id_present()

Bryn Reeves bmr at sourceware.org
Thu Mar 9 17:53:50 UTC 2017


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c98868181fa3ee0816d525ef186c1059a46f1d0b
Commit:        c98868181fa3ee0816d525ef186c1059a46f1d0b
Parent:        fab088cbc79211966f654245299347261fd5cb9f
Author:        Bryn M. Reeves <bmr at redhat.com>
AuthorDate:    Thu Mar 9 17:33:02 2017 +0000
Committer:     Bryn M. Reeves <bmr at redhat.com>
CommitterDate: Thu Mar 9 17:53:15 2017 +0000

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)
  <backtrace>
  Filemap group removed: exiting.

Change this to only emit a backtrace if the handle is NULL.
---
 libdm/libdm-stats.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 3f6730e..f0a7dbf 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;
 




More information about the lvm-devel mailing list