]> sourceware.org Git - lvm2.git/commitdiff
lvmlocdk: correct creation of dm path vg sanlock LV
authorZdenek Kabelac <zkabelac@redhat.com>
Sun, 14 Feb 2021 16:47:08 +0000 (17:47 +0100)
committerZdenek Kabelac <zkabelac@redhat.com>
Wed, 17 Feb 2021 10:53:19 +0000 (11:53 +0100)
Vgname may contain '-' and needs escaping '--' for /dev/mapper path.

lib/locking/lvmlockd.c

index 24b7ff6f783d529c6617928603719d5f3f94f76e..3b9abd6bf6249a8417ad260444053313e9476cdb 100644 (file)
@@ -382,6 +382,7 @@ static int _extend_sanlock_lv(struct cmd_context *cmd, struct volume_group *vg,
 {
        struct device *dev;
        char path[PATH_MAX];
+       char *name;
        uint64_t old_size_bytes;
        uint64_t new_size_bytes;
        uint32_t extend_bytes;
@@ -423,8 +424,10 @@ static int _extend_sanlock_lv(struct cmd_context *cmd, struct volume_group *vg,
 
        new_size_bytes = lv->size * SECTOR_SIZE;
 
-       if (dm_snprintf(path, sizeof(path), "%s/mapper/%s-%s", lv->vg->cmd->dev_dir,
-                       lv->vg->name, lv->name) < 0) {
+       if (!(name = dm_build_dm_name(lv->vg->cmd->mem, lv->vg->name, lv->name, NULL)))
+               return_0;
+
+       if (dm_snprintf(path, sizeof(path), "%s/%s", dm_dir(), name) < 0) {
                log_error("Extend sanlock LV %s name too long - extended size not zeroed.",
                          display_lvname(lv));
                return 0;
This page took 0.039539 seconds and 5 git commands to generate.