Skip to contentSkip to conversation

master - lv_manip: relocate check to proper function

PATCH Zdenek Kabelac 1 participant 1 message Sep 10, 2020

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bc0980362895ab64fb9f11811dc72937fe92c8a7
Commit:        bc0980362895ab64fb9f11811dc72937fe92c8a7
Parent:        e7f5acdfa674af473f31b23413afb1875cb3e078
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Thu Sep 10 17:39:43 2020 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Thu Sep 10 23:54:33 2020 +0200

lv_manip: relocate check to proper function

---
 lib/metadata/lv_manip.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
lib/metadata/lv_manip.c +5 -5
index ba143075d..e2c0f957b 100644
@@ -5068,6 +5068,11 @@ static int _lvresize_check(struct logical_volume *lv,
 	struct volume_group *vg = lv->vg;
 	struct lv_segment *seg = first_seg(lv);
 
+	if (lv_is_writecache(lv)) {
+		log_error("Resize not yet allowed on LVs with writecache attached.");
+		return 0;
+	}
+
 	if (lv_is_external_origin(lv)) {
 		/*
 		 * Since external-origin can be activated read-only,
@@ -5792,11 +5797,6 @@ int lv_resize(struct logical_volume *lv,
 	struct device *dev;
 	char name[PATH_MAX];
 
-	if (lv_is_writecache(lv)) {
-		log_error("Resize not yet allowed on LVs with writecache attached.");
-		return 0;
-	}
-
 	if (!_lvresize_check(lv, lp))
 		return_0;