diff --git a/VERSION b/VERSION index 6ded15816..eafa04b2c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.02.46-cvs (2009-03-03) +2.02.46-cvs (2009-05-21) diff --git a/VERSION_DM b/VERSION_DM index 1d60043fb..1316eb404 100644 --- a/VERSION_DM +++ b/VERSION_DM @@ -1 +1 @@ -1.02.32-cvs (2009-03-03) +1.02.32-cvs (2009-05-21) diff --git a/WHATS_NEW b/WHATS_NEW index 012c21968..819d6b1f2 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,9 +1,11 @@ -Version 2.02.46 - -================================ - Inherit read ahead from underlying device. - Use lock query instead of activate_lv_excl. +Version 2.02.46 - 21st May 2009 +=============================== + Inherit readahead setting from underlying devices during activation. + Detect LVs active on remote nodes by querying locks if supported. Enable online resizing of mirrors. Use suspend with flush when device size was changed during table preload. + Implement query_resource_fn for cluster_locking. + Support query_resource_fn in locking modules. Introduce CLVMD_CMD_LOCK_QUERY command for clvmd. Fix pvmove to revert operation if temporary mirror creation fails. Fix metadata export for VG with missing PVs. @@ -11,7 +13,7 @@ Version 2.02.46 - Force max_lv restriction only for newly created LV. Remove unneeded import parameter from lv_create_empty. Merge lv_is_displayable and lv_is_visible functions. - Introduce lv_set_visible & lv_set_invisible functions. + Introduce lv_set_visible & lv_set_hidden functions. Fix lv_is_visible to handle virtual origin. Introduce link_lv_to_vg and unlink_lv_from_vg functions. Remove lv_count from VG and use counter function instead. @@ -20,15 +22,18 @@ Version 2.02.46 - Remove NON_BLOCKING lock flag from tools and set a policy to auto-set. Remove snapshot_count from VG and use function instead. Fix first_seg() call for empty segment list. - Add make install_lvm2 as complement to device-mapper install. + Add install_lvm2 makefile target to install only the LVM2 components. Reject missing PVs from allocation in toollib. Fix PV datalignment for values starting prior to MDA area. (2.02.45) Add sparse devices: lvcreate -s --virtualoriginsize (hidden zero origin). + Fix minimum width of devices column in reports. Add lvs origin_size field. Fix linux configure --enable-debug to exclude -O2. - Implement lvconvert --repair, for repairing partially failed mirrors. + Implement lvconvert --repair for repairing partially-failed mirrors. Fix vgreduce --removemissing failure exit code. Fix remote metadata backup for clvmd. + Introduce unlock_and_release_vg macro. + Introduce vg_release() to be called to free every struct volume_group. Alloc PV internal structure from VG mempool if possible. Fix metadata backup to run after vg_commit always. Tidy clvmd volume lock cache functions. @@ -36,12 +41,11 @@ Version 2.02.46 - Fix pvs -a output to not read volume groups from non-PV devices. Add MMC (mmcblk) device type to filters. Introduce memory pools per volume group (to reduce memory for large VGs). - Add memory pool leaks detection. - Use copy of PV structure when manipulating with global PV lists. + Use copy of PV structure when manipulating global PV lists. Always return exit error status when locking of volume group fails. Fix mirror log convert validation question. Avoid referencing files from DESTDIR during build process. - Avoid creating some static libraries without static_link. + Avoid creating some static libraries unless configured --enable-static_link. Enable use of cached metadata for pvs and pvdisplay commands. Add missing 'device-mapper' internal subdir build dependency. Fix memory leak in mirror allocation code. @@ -52,14 +56,15 @@ Version 2.02.46 - Block SIGTERM & SIGINT in clvmd subthreads. Detect and conditionally wipe swapspace signatures in pvcreate. Fix maximal volume count check for snapshots if max_lv set for volume group. - Fix lvcreate to remove cow volume if the snapshot creation fails. + Fix lvcreate to remove unused cow volume if the snapshot creation fails. Fix error messages when PV uuid or pe_start reading fails. - Rename liblvm.a to liblvm-internal.a and build new application library. + Build new liblvm application-level library. + Rename liblvm.a to liblvm-internal.a. Flush memory pool and fix locking in clvmd refresh and backup command. - Fix unlocks in clvmd-corosync. Broken in 2.02.45. + Fix unlocks in clvmd-corosync. (2.02.45) Fix error message when adding metadata directory to internal list fails. Fix size and error message of memory allocation at backup initialization. - Remove old metadata backup file after renaming vg. + Remove old metadata backup file after renaming VG. Restore log_suppress state when metadata backup file is up-to-date. Version 2.02.45 - 3rd March 2009 diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 8921e3beb..31b0d6315 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,5 @@ -Version 1.02.32 - -================================ +Version 1.02.32 - 21st May 2009 +=============================== Only generate libdevmapper.a when configured to link statically. Export dm_tree_node_size_changed() from libdevmapper. Propagate the table size_changed property up the dm device tree. diff --git a/lib/activate/activate.c b/lib/activate/activate.c index efc3b61bc..12e8b20e8 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -711,7 +711,7 @@ int lv_is_active(struct logical_volume *lv) */ if (activate_lv_excl(lv->vg->cmd, lv)) { deactivate_lv(lv->vg->cmd, lv); - return 0; + return 0; } /* diff --git a/lib/locking/.exported_symbols b/lib/locking/.exported_symbols index ec92d131f..0a2cae7cd 100644 --- a/lib/locking/.exported_symbols +++ b/lib/locking/.exported_symbols @@ -1,5 +1,5 @@ locking_init locking_end lock_resource -lock_resource_query +query_resource reset_locking diff --git a/lib/locking/cluster_locking.c b/lib/locking/cluster_locking.c index 25a7d5bab..c8bc17090 100644 --- a/lib/locking/cluster_locking.c +++ b/lib/locking/cluster_locking.c @@ -33,7 +33,7 @@ #ifndef CLUSTER_LOCKING_INTERNAL int lock_resource(struct cmd_context *cmd, const char *resource, uint32_t flags); -int lock_resource_query(const char *resource, int *mode); +int query_resource(const char *resource, int *mode); void locking_end(void); int locking_init(int type, struct config_tree *cf, uint32_t *flags); #endif @@ -472,9 +472,9 @@ static int decode_lock_type(const char *response) } #ifdef CLUSTER_LOCKING_INTERNAL -static int _lock_resource_query(const char *resource, int *mode) +static int _query_resource(const char *resource, int *mode) #else -int lock_resource_query(const char *resource, int *mode) +int query_resource(const char *resource, int *mode) #endif { int i, status, len, num_responses, saved_errno; @@ -549,7 +549,7 @@ void reset_locking(void) int init_cluster_locking(struct locking_type *locking, struct cmd_context *cmd) { locking->lock_resource = _lock_resource; - locking->lock_resource_query = _lock_resource_query; + locking->query_resource = _query_resource; locking->fin_locking = _locking_end; locking->reset_locking = _reset_locking; locking->flags = LCK_PRE_MEMLOCK | LCK_CLUSTERED; diff --git a/lib/locking/external_locking.c b/lib/locking/external_locking.c index 73cb15269..949d0650a 100644 --- a/lib/locking/external_locking.c +++ b/lib/locking/external_locking.c @@ -89,8 +89,8 @@ int init_external_locking(struct locking_type *locking, struct cmd_context *cmd) return 0; } - if (!(_lock_query_fn = dlsym(_locking_lib, "lock_resource_query"))) - log_warn("WARNING: %s: _lock_resource_query() missing: " + if (!(_lock_query_fn = dlsym(_locking_lib, "query_resource"))) + log_warn("WARNING: %s: _query_resource() missing: " "Using inferior activation method.", libname); log_verbose("Loaded external locking library %s", libname); diff --git a/lib/locking/locking.c b/lib/locking/locking.c index d711a767b..5c04b4f07 100644 --- a/lib/locking/locking.c +++ b/lib/locking/locking.c @@ -489,13 +489,13 @@ int remote_lock_held(const char *vol) if (!locking_is_clustered()) return 0; - if (!_locking.lock_resource_query) + if (!_locking.query_resource) return -1; /* * If an error occured, expect that volume is active */ - if (!_locking.lock_resource_query(vol, &mode)) { + if (!_locking.query_resource(vol, &mode)) { stack; return 1; } diff --git a/lib/locking/locking.h b/lib/locking/locking.h index 57738a6ee..9bae92c0f 100644 --- a/lib/locking/locking.h +++ b/lib/locking/locking.h @@ -118,9 +118,11 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname); lock_vol(cmd, (lv)->lvid.s, flags | LCK_LV_CLUSTERED(lv)) #define unlock_vg(cmd, vol) lock_vol(cmd, vol, LCK_VG_UNLOCK) -#define unlock_release_vg(cmd, vg, vol) do { unlock_vg(cmd, vol); \ - vg_release(vg); \ - } while (0) +#define unlock_and_release_vg(cmd, vg, vol) \ + do { \ + unlock_vg(cmd, vol); \ + vg_release(vg); \ + } while (0) #define resume_lv(cmd, lv) lock_lv_vol(cmd, lv, LCK_LV_RESUME) #define suspend_lv(cmd, lv) lock_lv_vol(cmd, lv, LCK_LV_SUSPEND | LCK_HOLD) diff --git a/lib/locking/locking_types.h b/lib/locking/locking_types.h index 425a7722c..65b39f52e 100644 --- a/lib/locking/locking_types.h +++ b/lib/locking/locking_types.h @@ -18,7 +18,7 @@ typedef int (*lock_resource_fn) (struct cmd_context * cmd, const char *resource, uint32_t flags); -typedef int (*lock_resource_query_fn) (const char *resource, int *mode); +typedef int (*query_resource_fn) (const char *resource, int *mode); typedef void (*fin_lock_fn) (void); typedef void (*reset_lock_fn) (void); @@ -29,7 +29,7 @@ typedef void (*reset_lock_fn) (void); struct locking_type { uint32_t flags; lock_resource_fn lock_resource; - lock_resource_query_fn lock_resource_query; + query_resource_fn query_resource; reset_lock_fn reset_locking; fin_lock_fn fin_locking; diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 9a8045a59..eeb471015 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -1503,7 +1503,7 @@ int lv_add_mirror_lvs(struct logical_volume *lv, if (!set_lv_segment_area_lv(seg, m, sub_lvs[m - old_area_count], 0, status)) return_0; - lv_set_invisible(sub_lvs[m - old_area_count]); + lv_set_hidden(sub_lvs[m - old_area_count]); } lv->status |= MIRRORED; @@ -1982,14 +1982,14 @@ void lv_set_visible(struct logical_volume *lv) log_debug("LV %s in VG %s is now visible.", lv->name, lv->vg->name); } -void lv_set_invisible(struct logical_volume *lv) +void lv_set_hidden(struct logical_volume *lv) { if (!lv_is_visible(lv)) return; lv->status &= ~VISIBLE_LV; - log_debug("LV %s in VG %s is now invisible.", lv->name, lv->vg->name); + log_debug("LV %s in VG %s is now hidden.", lv->name, lv->vg->name); } int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv, diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h index 212c37ca0..022c44b4b 100644 --- a/lib/metadata/metadata-exported.h +++ b/lib/metadata/metadata-exported.h @@ -372,7 +372,7 @@ struct dm_list *get_pvs(struct cmd_context *cmd); int link_lv_to_vg(struct volume_group *vg, struct logical_volume *lv); int unlink_lv_from_vg(struct logical_volume *lv); void lv_set_visible(struct logical_volume *lv); -void lv_set_invisible(struct logical_volume *lv); +void lv_set_hidden(struct logical_volume *lv); /* Set full_scan to 1 to re-read every (filtered) device label */ struct dm_list *get_vgnames(struct cmd_context *cmd, int full_scan); @@ -442,7 +442,12 @@ int vg_change_pesize(struct cmd_context *cmd, struct volume_group *vg, int vg_split_mdas(struct cmd_context *cmd, struct volume_group *vg_from, struct volume_group *vg_to); +/* + * vg_release() must be called on every struct volume_group allocated + * by vg_create() or vg_read_internal() to free it when no longer required. + */ void vg_release(struct volume_group *vg); + /* Manipulate LVs */ struct logical_volume *lv_create_empty(const char *name, union lvid *lvid, diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index d71a4fafe..f16cd55a9 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -2633,12 +2633,12 @@ vg_t *vg_lock_and_read(struct cmd_context *cmd, const char *vg_name, if (!(vg = vg_read_internal(cmd, vg_name, vgid, &consistent)) || ((misc_flags & FAIL_INCONSISTENT) && !consistent)) { log_error("Volume group \"%s\" not found", vg_name); - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); return NULL; } if (!vg_check_status(vg, status_flags)) { - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); return NULL; } diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c index 6e0e465ec..53ec33e55 100644 --- a/lib/metadata/mirror.c +++ b/lib/metadata/mirror.c @@ -303,7 +303,7 @@ static int _init_mirror_log(struct cmd_context *cmd, return 0; } - lv_set_invisible(log_lv); + lv_set_hidden(log_lv); if (was_active && !activate_lv(cmd, log_lv)) return_0; @@ -1340,7 +1340,7 @@ int attach_mirror_log(struct lv_segment *seg, struct logical_volume *log_lv) { seg->log_lv = log_lv; log_lv->status |= MIRROR_LOG; - lv_set_invisible(log_lv); + lv_set_hidden(log_lv); return add_seg_to_segs_using_this_lv(log_lv, seg); } @@ -1466,7 +1466,7 @@ int add_mirror_images(struct cmd_context *cmd, struct logical_volume *lv, !(log_lv = _set_up_mirror_log(cmd, ah, lv, log_count, region_size, alloc, mirror_in_sync()))) { stack; - goto out_remove_imgs; + goto out_remove_images; } /* The log initialization involves vg metadata commit. @@ -1498,7 +1498,7 @@ int add_mirror_images(struct cmd_context *cmd, struct logical_volume *lv, region_size)) { log_error("Aborting. Failed to add mirror segment. " "Remove new LV and retry."); - goto out_remove_imgs; + goto out_remove_images; } if (log_count && !attach_mirror_log(first_seg(lv), log_lv)) @@ -1517,7 +1517,7 @@ int add_mirror_images(struct cmd_context *cmd, struct logical_volume *lv, else backup(log_lv->vg); } - out_remove_imgs: + out_remove_images: alloc_destroy(ah); return 0; } diff --git a/lib/metadata/snapshot_manip.c b/lib/metadata/snapshot_manip.c index a298f4ec2..83bc38514 100644 --- a/lib/metadata/snapshot_manip.c +++ b/lib/metadata/snapshot_manip.c @@ -68,7 +68,7 @@ void init_snapshot_seg(struct lv_segment *seg, struct logical_volume *origin, seg->origin = origin; seg->cow = cow; - lv_set_invisible(cow); + lv_set_hidden(cow); cow->snapshot = seg; diff --git a/lib/report/columns.h b/lib/report/columns.h index 04a377384..49ebab49e 100644 --- a/lib/report/columns.h +++ b/lib/report/columns.h @@ -29,18 +29,17 @@ * 3. Field type. This must be either 'STR' or 'NUM'. * 4. Report heading. This is the field heading that is displayed by the * reporting commands. - * 5. Data value pointer. This argument is is always a member of the - * containing struct. In some cases, the member points to the data value - * of the field (for example, lv_uuid - see _uuid_disp()). In other cases - * it is pointer that may be used to derive the data value (for example, - * seg_count - see _lvsegcount_disp()). In the FIELD macro definition, - * this is used in an offset calculation to derive the offset to the - * data value from the containing struct base address. Note that in some + * 5. Data value pointer. This argument is always a member of the + * containing struct. It may point directly to the data value (for example, + * lv_uuid - see _uuid_disp()) or may be used to derive the data value (for + * example, seg_count - see _lvsegcount_disp()). In the FIELD macro + * definition, it is used in an offset calculation to derive the offset to + * the data value from the containing struct base address. Note that in some * cases, the argument is the first member of the struct, in which case the * data value pointer points to the start of the struct itself (for example, * 'lvid' field of struct 'lv'). * 6. Minimum display width. This is the minimum width used to display - * the field value. + * the field value, typically matching the width of the column heading. * 7. Display function identifier. Used to derive the full name of the * function that displays this field. Derivation is done by appending '_' * then prepending this argument to '_disp'. For example, if this argument diff --git a/tools/lvconvert.c b/tools/lvconvert.c index 41fed51d7..f1186cf81 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -371,56 +371,61 @@ static int _area_missing(struct lv_segment *lvseg, int s) if (seg_type(lvseg, s) == AREA_LV) { if (seg_lv(lvseg, s)->status & PARTIAL_LV) return 1; - } else if (seg_type(lvseg, s) == AREA_PV) { - if (seg_pv(lvseg, s)->status & MISSING_PV) - return 1; - } + } else if ((seg_type(lvseg, s) == AREA_PV) && + (seg_pv(lvseg, s)->status & MISSING_PV)) + return 1; + return 0; } /* FIXME we want to handle mirror stacks here... */ -static int _count_failed_mirrors(struct logical_volume *lv) +static int _failed_mirrors_count(struct logical_volume *lv) { struct lv_segment *lvseg; int ret = 0; int s; + dm_list_iterate_items(lvseg, &lv->segments) { if (!seg_is_mirrored(lvseg)) return -1; - for(s = 0; s < lvseg->area_count; ++s) { + for (s = 0; s < lvseg->area_count; s++) if (_area_missing(lvseg, s)) - ++ ret; - } + ret++; } + return ret; } static struct dm_list *_failed_pv_list(struct volume_group *vg) { - struct dm_list *r; + struct dm_list *failed_pvs; struct pv_list *pvl, *new_pvl; - if (!(r = dm_pool_alloc(vg->vgmem, sizeof(*r)))) { - log_error("Allocation of list failed"); - return_0; + if (!(failed_pvs = dm_pool_alloc(vg->vgmem, sizeof(*failed_pvs)))) { + log_error("Allocation of list of failed_pvs failed."); + return_NULL; } - dm_list_init(r); + dm_list_init(failed_pvs); + dm_list_iterate_items(pvl, &vg->pvs) { if (!(pvl->pv->status & MISSING_PV)) continue; if (!(new_pvl = dm_pool_alloc(vg->vgmem, sizeof(*new_pvl)))) { - log_error("Unable to allocate physical volume list."); - return_0; + log_error("Allocation of failed_pvs list entry failed."); + return_NULL; } new_pvl->pv = pvl->pv; - dm_list_add(r, &new_pvl->list); + dm_list_add(failed_pvs, &new_pvl->list); } - return r; + + return failed_pvs; } -/* walk down the stacked mirror LV to the original mirror LV */ +/* + * Walk down the stacked mirror LV to the original mirror LV. + */ static struct logical_volume *_original_lv(struct logical_volume *lv) { struct logical_volume *next_lv = lv, *tmp_lv; @@ -431,8 +436,8 @@ static struct logical_volume *_original_lv(struct logical_volume *lv) return next_lv; } -static int lvconvert_mirrors(struct cmd_context * cmd, struct logical_volume * lv, - struct lvconvert_params *lp) +static int _lvconvert_mirrors(struct cmd_context *cmd, struct logical_volume *lv, + struct lvconvert_params *lp) { struct lv_segment *seg; uint32_t existing_mirrors; @@ -485,7 +490,7 @@ static int lvconvert_mirrors(struct cmd_context * cmd, struct logical_volume * l log_error("The mirror is consistent, nothing to repair."); return 0; } - if ((failed_mirrors = _count_failed_mirrors(lv)) < 0) + if ((failed_mirrors = _failed_mirrors_count(lv)) < 0) return_0; lp->mirrors -= failed_mirrors; log_error("Mirror status: %d/%d legs failed.", @@ -828,7 +833,7 @@ static int lvconvert_single(struct cmd_context *cmd, struct logical_volume *lv, } else if (arg_count(cmd, mirrors_ARG) || (lv->status & MIRRORED)) { if (!archive(lv->vg)) return ECMD_FAILED; - if (!lvconvert_mirrors(cmd, lv, lp)) + if (!_lvconvert_mirrors(cmd, lv, lp)) return ECMD_FAILED; } diff --git a/tools/lvcreate.c b/tools/lvcreate.c index ed2985593..67d065c2f 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -998,6 +998,6 @@ int lvcreate(struct cmd_context *cmd, int argc, char **argv) if (!_lvcreate(cmd, vg, &lp)) r = ECMD_FAILED; - unlock_release_vg(cmd, vg, lp.vg_name); + unlock_and_release_vg(cmd, vg, lp.vg_name); return r; } diff --git a/tools/lvrename.c b/tools/lvrename.c index f816152d0..fae82c3f8 100644 --- a/tools/lvrename.c +++ b/tools/lvrename.c @@ -121,6 +121,6 @@ int lvrename(struct cmd_context *cmd, int argc, char **argv) r = ECMD_PROCESSED; error: - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); return r; } diff --git a/tools/lvresize.c b/tools/lvresize.c index 966e33bb5..420e5708e 100644 --- a/tools/lvresize.c +++ b/tools/lvresize.c @@ -681,7 +681,7 @@ int lvresize(struct cmd_context *cmd, int argc, char **argv) if (!(r = _lvresize(cmd, vg, &lp))) stack; - unlock_release_vg(cmd, vg, lp.vg_name); + unlock_and_release_vg(cmd, vg, lp.vg_name); return r; } diff --git a/tools/polldaemon.c b/tools/polldaemon.c index 0f6da372f..7684d335e 100644 --- a/tools/polldaemon.c +++ b/tools/polldaemon.c @@ -157,17 +157,17 @@ static int _wait_for_single_mirror(struct cmd_context *cmd, const char *name, parms->lv_type))) { log_error("ABORTING: Can't find mirror LV in %s for %s", vg->name, name); - unlock_release_vg(cmd, vg, vg->name); + unlock_and_release_vg(cmd, vg, vg->name); return 0; } if (!_check_mirror_status(cmd, vg, lv_mirr, name, parms, &finished)) { - unlock_release_vg(cmd, vg, vg->name); + unlock_and_release_vg(cmd, vg, vg->name); return 0; } - unlock_release_vg(cmd, vg, vg->name); + unlock_and_release_vg(cmd, vg, vg->name); } return 1; diff --git a/tools/pvchange.c b/tools/pvchange.c index d5ca3f10f..6f90ec783 100644 --- a/tools/pvchange.c +++ b/tools/pvchange.c @@ -201,7 +201,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct physical_volume *pv, log_print("Physical volume \"%s\" changed", pv_name); r = 1; out: - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); return r; } diff --git a/tools/pvmove.c b/tools/pvmove.c index 3e12ec10d..9ece646af 100644 --- a/tools/pvmove.c +++ b/tools/pvmove.c @@ -459,7 +459,7 @@ static int _set_up_pvmove(struct cmd_context *cmd, const char *pv_name, /* LVs are all in status LOCKED */ r = ECMD_PROCESSED; out: - unlock_release_vg(cmd, vg, pv_vg_name(pv)); + unlock_and_release_vg(cmd, vg, pv_vg_name(pv)); return r; } diff --git a/tools/toollib.c b/tools/toollib.c index aa33468ed..7f9eef17f 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -319,7 +319,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv, } if (!vg_check_status(vg, CLUSTERED)) { - unlock_release_vg(cmd, vg, vgname); + unlock_and_release_vg(cmd, vg, vgname); if (ret_max < ECMD_FAILED) ret_max = ECMD_FAILED; continue; @@ -350,7 +350,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv, ret = process_each_lv_in_vg(cmd, vg, &lvnames, tags_arg, handle, process_single); - unlock_release_vg(cmd, vg, vgname); + unlock_and_release_vg(cmd, vg, vgname); if (ret > ret_max) ret_max = ret; if (sigint_caught()) @@ -469,7 +469,7 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name, } if (!vg_check_status(vg, CLUSTERED)) { - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); return ECMD_FAILED; } @@ -477,7 +477,7 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name, /* Only process if a tag matches or it's on arg_vgnames */ if (!str_list_match_item(arg_vgnames, vg_name) && !str_list_match_list(tags, &vg->tags)) { - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); return ret_max; } } @@ -487,7 +487,7 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name, ret_max = ret; } - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); return ret_max; } @@ -771,12 +771,12 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv, continue; } if (!consistent) { - unlock_release_vg(cmd, vg, sll->str); + unlock_and_release_vg(cmd, vg, sll->str); continue; } if (!vg_check_status(vg, CLUSTERED)) { - unlock_release_vg(cmd, vg, sll->str); + unlock_and_release_vg(cmd, vg, sll->str); continue; } @@ -784,7 +784,7 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv, handle, process_single); - unlock_release_vg(cmd, vg, sll->str); + unlock_and_release_vg(cmd, vg, sll->str); if (ret > ret_max) ret_max = ret; diff --git a/tools/vgchange.c b/tools/vgchange.c index 25a1b3b25..84cbf1a7a 100644 --- a/tools/vgchange.c +++ b/tools/vgchange.c @@ -532,7 +532,7 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name, } if (!consistent) { - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); dev_close_all(); log_error("Volume group \"%s\" inconsistent", vg_name); if (!(vg = recover_vg(cmd, vg_name, LCK_VG_WRITE))) diff --git a/tools/vgconvert.c b/tools/vgconvert.c index eb841d7d8..b37cf49e4 100644 --- a/tools/vgconvert.c +++ b/tools/vgconvert.c @@ -38,7 +38,7 @@ static int vgconvert_single(struct cmd_context *cmd, const char *vg_name, } if (!consistent) { - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); dev_close_all(); log_error("Volume group \"%s\" inconsistent", vg_name); if (!(vg = recover_vg(cmd, vg_name, LCK_VG_WRITE))) diff --git a/tools/vgextend.c b/tools/vgextend.c index 280017ff3..4b2044c5f 100644 --- a/tools/vgextend.c +++ b/tools/vgextend.c @@ -76,7 +76,7 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv) r = ECMD_PROCESSED; error: - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); unlock_vg(cmd, VG_ORPHANS); return r; } diff --git a/tools/vgmerge.c b/tools/vgmerge.c index 57a700e13..f5072193e 100644 --- a/tools/vgmerge.c +++ b/tools/vgmerge.c @@ -38,7 +38,7 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to, LCK_VG_WRITE, CLUSTERED | EXPORTED_VG | LVM_WRITE, CORRECT_INCONSISTENT | FAIL_INCONSISTENT))) { - unlock_release_vg(cmd, vg_to, vg_name_to); + unlock_and_release_vg(cmd, vg_to, vg_name_to); return ECMD_FAILED; } @@ -116,8 +116,8 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to, vg_from->name, vg_to->name); r = ECMD_PROCESSED; bad: - unlock_release_vg(cmd, vg_from, vg_name_from); - unlock_release_vg(cmd, vg_to, vg_name_to); + unlock_and_release_vg(cmd, vg_from, vg_name_from); + unlock_and_release_vg(cmd, vg_to, vg_name_to); return r; } diff --git a/tools/vgreduce.c b/tools/vgreduce.c index cf55afeda..014d33793 100644 --- a/tools/vgreduce.c +++ b/tools/vgreduce.c @@ -454,7 +454,7 @@ static int _vgreduce_single(struct cmd_context *cmd, struct volume_group *vg, log_print("Removed \"%s\" from volume group \"%s\"", name, vg->name); r = ECMD_PROCESSED; bad: - unlock_release_vg(cmd, orphan_vg, VG_ORPHANS); + unlock_and_release_vg(cmd, orphan_vg, VG_ORPHANS); return r; } @@ -574,7 +574,7 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv) } out: - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); return ret; diff --git a/tools/vgrename.c b/tools/vgrename.c index 205ba3e34..932c4d7b4 100644 --- a/tools/vgrename.c +++ b/tools/vgrename.c @@ -83,7 +83,7 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path, } if (!vg_check_status(vg, CLUSTERED | LVM_WRITE)) { - unlock_release_vg(cmd, vg, vg_name_old); + unlock_and_release_vg(cmd, vg, vg_name_old); return 0; } @@ -91,7 +91,7 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path, vg_check_status(vg, EXPORTED_VG); if (lvs_in_vg_activated_by_uuid_only(vg)) { - unlock_release_vg(cmd, vg, vg_name_old); + unlock_and_release_vg(cmd, vg, vg_name_old); log_error("Volume group \"%s\" still has active LVs", vg_name_old); /* FIXME Remove this restriction */ @@ -101,7 +101,7 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path, log_verbose("Checking for new volume group \"%s\"", vg_name_new); if (!lock_vol(cmd, vg_name_new, LCK_VG_WRITE)) { - unlock_release_vg(cmd, vg, vg_name_old); + unlock_and_release_vg(cmd, vg, vg_name_old); log_error("Can't get lock for %s", vg_name_new); return 0; } @@ -151,8 +151,8 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path, backup(vg); backup_remove(cmd, vg_name_old); - unlock_release_vg(cmd, vg_new, vg_name_new); - unlock_release_vg(cmd, vg, vg_name_old); + unlock_and_release_vg(cmd, vg_new, vg_name_new); + unlock_and_release_vg(cmd, vg, vg_name_old); log_print("Volume group \"%s\" successfully renamed to \"%s\"", vg_name_old, vg_name_new); @@ -164,8 +164,8 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path, return 1; error: - unlock_release_vg(cmd, vg_new, vg_name_new); - unlock_release_vg(cmd, vg, vg_name_old); + unlock_and_release_vg(cmd, vg_new, vg_name_new); + unlock_and_release_vg(cmd, vg, vg_name_old); return 0; } diff --git a/tools/vgscan.c b/tools/vgscan.c index e2543aa1f..3ac0d8491 100644 --- a/tools/vgscan.c +++ b/tools/vgscan.c @@ -25,7 +25,7 @@ static int vgscan_single(struct cmd_context *cmd, const char *vg_name, } if (!consistent) { - unlock_release_vg(cmd, vg, vg_name); + unlock_and_release_vg(cmd, vg, vg_name); dev_close_all(); log_error("Volume group \"%s\" inconsistent", vg_name); /* Don't allow partial switch to this program */ diff --git a/tools/vgsplit.c b/tools/vgsplit.c index 317aac112..dce11274e 100644 --- a/tools/vgsplit.c +++ b/tools/vgsplit.c @@ -323,7 +323,7 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv) log_verbose("Checking for new volume group \"%s\"", vg_name_to); if (!lock_vol(cmd, vg_name_to, LCK_VG_WRITE)) { log_error("Can't get lock for %s", vg_name_to); - unlock_release_vg(cmd, vg_from, vg_name_from); + unlock_and_release_vg(cmd, vg_from, vg_name_from); return ECMD_FAILED; } @@ -466,7 +466,7 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv) r = ECMD_PROCESSED; bad: - unlock_release_vg(cmd, vg_from, vg_name_from); - unlock_release_vg(cmd, vg_to, vg_name_to); + unlock_and_release_vg(cmd, vg_from, vg_name_from); + unlock_and_release_vg(cmd, vg_to, vg_name_to); return r; }