Skip to contentSkip to conversation

master - lvresize: check pvh list is vg->pvs

PATCH Zdenek Kabelac 1 participant 1 message Jun 23, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d30c2cec880e22ac2ce6cb6a1ee09584f2dc6aae
Commit:        d30c2cec880e22ac2ce6cb6a1ee09584f2dc6aae
Parent:        f45b68940667563e1a8d3bbd5d30864c04381bdf
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Thu Jun 16 14:39:26 2016 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Thu Jun 23 14:57:09 2016 +0200

lvresize: check pvh list is vg->pvs

Instead of checking lp->argc for arg count, compare directly whether passed pvh is vg->pvs.

---
 lib/metadata/lv_manip.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
lib/metadata/lv_manip.c +2 -2
index 562047c..f4abc4f 100644
@@ -4785,7 +4785,7 @@ static int _lvresize_extents_from_percent(struct logical_volume *lv, struct lvre
 							 (lp->sign != SIGN_MINUS));
 			break;
 		case PERCENT_PVS:
-			if (lp->argc) {
+			if (pvh != &vg->pvs) {
 				pv_extent_count = pv_list_extents_free(pvh);
 				lp->extents = percent_of_extents(lp->extents, pv_extent_count,
 								 (lp->sign != SIGN_MINUS));
@@ -5228,7 +5228,7 @@ static struct logical_volume *_lvresize_volume(struct cmd_context *cmd,
 	}
 	alloc = lp->alloc ? : lv->alloc;
 
-	if ((lp->resize == LV_REDUCE) && lp->argc)
+	if ((lp->resize == LV_REDUCE) && (pvh != &vg->pvs))
 		log_print_unless_silent("Ignoring PVs on command line when reducing.");
 
 	/* Request confirmation before operations that are often mistakes. */