]> sourceware.org Git - lvm2.git/commitdiff
lvrename: always allow to rename pools
authorZdenek Kabelac <zkabelac@redhat.com>
Wed, 9 Dec 2015 12:52:47 +0000 (13:52 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Thu, 10 Dec 2015 20:01:24 +0000 (21:01 +0100)
Since we mark cache-pool as 'hidden/private' while it is in-use,
we may still allow user to change it's name.

It should not cause any harm and user may prefer better naming
for a cache-pool in use.

lib/metadata/lv_manip.c

index 6a93a76f2ebbe2870b69e3c8be220c275a101fca..76e7895ac543385f3ec910f12fd8bfffeaea0265 100644 (file)
@@ -4230,8 +4230,12 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
        struct volume_group *vg = lv->vg;
        struct lv_names lv_names = { .old = lv->name };
 
-       /* rename is not allowed on sub LVs */
-       if (!lv_is_visible(lv)) {
+       /*
+        * rename is not allowed on sub LVs except for pools
+        * (thin pool is 'visible', but cache may not)
+        */
+       if (!lv_is_pool(lv) &&
+           !lv_is_visible(lv)) {
                log_error("Cannot rename internal LV \"%s\".", lv->name);
                return 0;
        }
@@ -4265,7 +4269,7 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
        if (lv_is_cow(lv))
                lv = origin_from_cow(lv);
 
-       if (update_mda && !lv_update_and_reload(lv))
+       if (update_mda && !lv_update_and_reload((struct logical_volume *)lv_lock_holder(lv)))
                return_0;
 
        return 1;
This page took 0.050073 seconds and 5 git commands to generate.