Skip to contentSkip to conversation

master - cache: Disallow resizing of cache related LVs

PATCH Jonathan Brassow 1 participant 1 message Feb 24, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f3d1debb18cc58d36eed75ba6610e5a3ef498d12
Commit:        f3d1debb18cc58d36eed75ba6610e5a3ef498d12
Parent:        46223c4284552b23cac7c49c49dc1612b45bb66e
Author:        Jonathan Brassow <[email protected]>
AuthorDate:    Mon Feb 24 10:19:50 2014 -0600
Committer:     Jonathan Brassow <[email protected]>
CommitterDate: Mon Feb 24 10:19:50 2014 -0600

cache: Disallow resizing of cache related LVs

For now, disallow lvextend/lvreduce/lvresize of cache LVs, cache pool LVs, and cache pool sub-LVs.

---
 lib/metadata/lv_manip.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
lib/metadata/lv_manip.c +5 -0
index e25dd17..92e65ae 100644
@@ -4274,6 +4274,11 @@ int lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
 	struct logical_volume *lock_lv = NULL;
 	int inactive = 0;
 
+	if (lv_is_cache_type(lv)) {
+		log_error("Unable to resize logical volumes of cache type.");
+		return 0;
+	}
+
 	if (lp->sizeargs &&
 	    !(lock_lv = _lvresize_volume(cmd, lv, lp, pvh)))
 		return_0;