From 2f25c320fb184d4347217539d49d2f5ac91bcb06 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Wed, 9 Mar 2011 12:44:42 +0000 Subject: [PATCH] Use empty string instead of /dev// for LV path when there's no VG. Don't allocate unused VG mempool in _pvsegs_sub_single. --- WHATS_NEW | 4 +++- lib/metadata/lv.c | 4 ++++ tools/reporter.c | 7 ++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 82249a58d..0b6706da5 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,6 +1,8 @@ Version 2.02.85 - =================================== - Send 1 byte shorted fully initialised local clvmd messages. + Use empty string instead of /dev// for LV path when there's no VG. + Don't allocate unused VG mempool in _pvsegs_sub_single. + Remove uninitialised byte from end of local clvmd messages. Support --help option for clvmd and return error for unknown option. Use system page size and not hardcoded value in locking code check. Fix reading of released memory for printing segment type. diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c index 1c027e89f..96416b9a5 100644 --- a/lib/metadata/lv.c +++ b/lib/metadata/lv.c @@ -160,6 +160,9 @@ char *lv_path_dup(struct dm_pool *mem, const struct logical_volume *lv) char *repstr; size_t len; + if (!*lv->vg->name) + return dm_pool_strdup(mem, ""); + len = strlen(lv->vg->cmd->dev_dir) + strlen(lv->vg->name) + strlen(lv->name) + 2; @@ -173,6 +176,7 @@ char *lv_path_dup(struct dm_pool *mem, const struct logical_volume *lv) log_error("lvpath snprintf failed"); return 0; } + return repstr; } diff --git a/tools/reporter.c b/tools/reporter.c index ebe85e7f5..c8a6bb41b 100644 --- a/tools/reporter.c +++ b/tools/reporter.c @@ -51,7 +51,6 @@ static int _segs_single(struct cmd_context *cmd __attribute__((unused)), return ECMD_PROCESSED; } - static int _pvsegs_sub_single(struct cmd_context *cmd, struct volume_group *vg, struct pv_segment *pvseg, void *handle) @@ -62,11 +61,9 @@ static int _pvsegs_sub_single(struct cmd_context *cmd, struct volume_group _free_vg = { .cmd = cmd, .name = "", + .vgmem = NULL, }; - if (!(_free_vg.vgmem = dm_pool_create("_free_vg", 10240))) - return ECMD_FAILED; - struct logical_volume _free_logical_volume = { .vg = vg ?: &_free_vg, .name = "", @@ -109,8 +106,8 @@ static int _pvsegs_sub_single(struct cmd_context *cmd, ret = ECMD_FAILED; goto_out; } + out: - free_vg(&_free_vg); return ret; }