Skip to contentSkip to conversation

master - thin: fix pool_has_message return for NULL params

PATCH Zdenek Kabelac 1 participant 1 message Mar 11, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1850a6e454ebbb54aae80a0ad4d5482ecdffcd28
Commit:        1850a6e454ebbb54aae80a0ad4d5482ecdffcd28
Parent:        7574b3bc80c8b2db5f4a9da9e7de00c0a3239e26
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Tue Mar 11 22:50:23 2014 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Mar 12 00:13:21 2014 +0100

thin: fix pool_has_message return for NULL params

When pool_has_message() is queried with NULL lv and 0 device_id it should just return 'true' when there is any message queued. So it needs to return negative value dm_list_empty().

Since there is no user for this code path in code currently, this bug has not been triggered.

---
 WHATS_NEW                 |    1 +
 lib/metadata/thin_manip.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)
WHATS_NEW +1 -0
index 7d6f4d6..0fd0657 100644
@@ -1,5 +1,6 @@
 Version 2.02.106 - 
 ====================================
+  Fix return value in pool_has_message() when quering for any message.
   Cleanup all client resources on clvmd exit.
   Use dm_zalloc to clear members of clvmd client struct.
   Use BLKID_CFLAGS when compiling with blkid support.
lib/metadata/thin_manip.c +1 -1
index 2e49019..78231a2 100644
@@ -160,7 +160,7 @@ int pool_has_message(const struct lv_segment *seg,
 	}
 
 	if (!lv && !device_id)
-		return dm_list_empty(&seg->thin_messages);
+		return !dm_list_empty(&seg->thin_messages);
 
 	dm_list_iterate_items(tmsg, &seg->thin_messages) {
 		switch (tmsg->type) {