[lvm-devel] master - cache: Disallow resizing of cache related LVs

Jonathan Brassow jbrassow at fedoraproject.org
Mon Feb 24 16:21:21 UTC 2014


Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f3d1debb18cc58d36eed75ba6610e5a3ef498d12
Commit:        f3d1debb18cc58d36eed75ba6610e5a3ef498d12
Parent:        46223c4284552b23cac7c49c49dc1612b45bb66e
Author:        Jonathan Brassow <jbrassow at redhat.com>
AuthorDate:    Mon Feb 24 10:19:50 2014 -0600
Committer:     Jonathan Brassow <jbrassow at redhat.com>
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(-)

diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index e25dd17..92e65ae 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -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;




More information about the lvm-devel mailing list