Skip to contentSkip to conversation

master - thin: fix feature compare function

PATCH Zdenek Kabelac 1 participant 1 message Jan 23, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f8b20fb8e8e54561321b030fae7249ac2c2ac950
Commit:        f8b20fb8e8e54561321b030fae7249ac2c2ac950
Parent:        902b343e0ed071e684dfe89086c740db2e20c663
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Thu Jan 23 13:47:23 2014 +0100
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Thu Jan 23 14:22:31 2014 +0100

thin: fix feature compare function

Comparing for available feature missed the code path, when maj is already bigger.

The bug would be only hit in the case, thin pool target would have increased major version.

---
 WHATS_NEW       |    1 +
 lib/thin/thin.c |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)
WHATS_NEW +1 -0
index c385951..04d62e5 100644
@@ -1,5 +1,6 @@
 Version 2.02.106 - 
 ====================================
+  Fix test when checking target version for available thin features.
   Detect thin feature external_origin_extend and limit extend when missing.
   Rename internal pool_can_resize_metadata() to thin_pool_feature_supported().
   Issue error if libbblkid detects signature and fails to return offset/length.
lib/thin/thin.c +2 -1
index cf74964..0b8eaf8 100644
@@ -651,7 +651,8 @@ static int _thin_target_present(struct cmd_context *cmd,
 		}
 
 		for (i = 0; i < sizeof(_features)/sizeof(*_features); i++)
-			if (maj >= _features[i].maj && min >= _features[i].min)
+			if ((maj > _features[i].maj) ||
+			    (maj == _features[i].maj && min >= _features[i].min))
 				_attrs |= _features[i].thin_feature;
 			else
 				log_very_verbose("Target %s does not support %s.",