[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH] Fix segfault if %PVS is used in lvresize without PVs list



Fix segfault if %PVS in lvresize without PVs list.

... and use the all available PVs instaed.

diff --git a/tools/lvresize.c b/tools/lvresize.c
index 033078f..36c1717 100644
--- a/tools/lvresize.c
+++ b/tools/lvresize.c
@@ -367,8 +367,11 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
 			lp->extents = lp->extents * lv->le_count / 100;
 			break;
 		case PERCENT_PVS:
-			pv_extent_count = pv_list_extents_free(pvh);
-			lp->extents = lp->extents * pv_extent_count / 100;
+			if (lp->argc) {
+				pv_extent_count = pv_list_extents_free(pvh);
+				lp->extents = lp->extents * pv_extent_count / 100;
+			} else
+				lp->extents = lp->extents * vg->extent_count / 100;
 			break;
 		case PERCENT_NONE:
 			break;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]