From 685be1dc7a58b74b2168cf682be0f1580edd2ceb Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 11 Dec 2009 13:11:56 +0000 Subject: [PATCH] Fix unlocking vg in some pvresize and toollib error paths. --- WHATS_NEW | 1 + WHATS_NEW_DM | 1 + tools/pvresize.c | 8 ++++++-- tools/toollib.c | 6 +++--- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 7ea36396b..09afc08c7 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.57 - ==================================== + Fix unlocking vg in some pvresize and toollib error paths. Explicitly call suspend for temporary mirror layer. Allow use precommited metadata when a PV is missing. Add memlock information to do_lock_lv debug output. diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 26053cc4e..d436d6dec 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.41 - ==================================== + Fix coredump and memory leak for 'dmsetup help -c'. Disable udev rules for change events with DISK_RO set. Version 1.02.40 - 19th November 2009 diff --git a/tools/pvresize.c b/tools/pvresize.c index 7a911ac83..292e3cc1c 100644 --- a/tools/pvresize.c +++ b/tools/pvresize.c @@ -60,8 +60,12 @@ static int _pv_resize_single(struct cmd_context *cmd, vg = vg_read_for_update(cmd, vg_name, NULL, 0); - if (vg_read_error(vg)) - goto bad; + if (vg_read_error(vg)) { + vg_release(vg); + log_error("Unable to read volume group \"%s\".", + vg_name); + return 0; + } if (!(pvl = find_pv_in_vg(vg, pv_name))) { log_error("Unable to find \"%s\" in volume group \"%s\"", diff --git a/tools/toollib.c b/tools/toollib.c index 33daf3089..fce399b5d 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -315,7 +315,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv, dm_pool_strdup(cmd->mem, lv_name + 1))) { log_error("strlist allocation failed"); - vg_release(vg); + unlock_and_release_vg(cmd, vg, vgname); return ECMD_FAILED; } } @@ -367,8 +367,8 @@ int process_each_segment_in_pv(struct cmd_context *cmd, if (!(pvl = find_pv_in_vg(vg, pv_dev_name(pv)))) { log_error("Unable to find %s in volume group %s", pv_dev_name(pv), vg_name); - vg_release(vg); - return ECMD_FAILED; + unlock_and_release_vg(cmd, vg, vg_name); + return ECMD_FAILED; } pv = pvl->pv;