1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Pre-release cleanups.

This commit is contained in:
Alasdair Kergon 2009-05-21 03:04:52 +00:00
parent 58e57a05c0
commit 25a2e7b80e
33 changed files with 126 additions and 110 deletions

View File

@ -1 +1 @@
2.02.46-cvs (2009-03-03) 2.02.46-cvs (2009-05-21)

View File

@ -1 +1 @@
1.02.32-cvs (2009-03-03) 1.02.32-cvs (2009-05-21)

View File

@ -1,9 +1,11 @@
Version 2.02.46 - Version 2.02.46 - 21st May 2009
================================ ===============================
Inherit read ahead from underlying device. Inherit readahead setting from underlying devices during activation.
Use lock query instead of activate_lv_excl. Detect LVs active on remote nodes by querying locks if supported.
Enable online resizing of mirrors. Enable online resizing of mirrors.
Use suspend with flush when device size was changed during table preload. 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. Introduce CLVMD_CMD_LOCK_QUERY command for clvmd.
Fix pvmove to revert operation if temporary mirror creation fails. Fix pvmove to revert operation if temporary mirror creation fails.
Fix metadata export for VG with missing PVs. 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. Force max_lv restriction only for newly created LV.
Remove unneeded import parameter from lv_create_empty. Remove unneeded import parameter from lv_create_empty.
Merge lv_is_displayable and lv_is_visible functions. 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. Fix lv_is_visible to handle virtual origin.
Introduce link_lv_to_vg and unlink_lv_from_vg functions. Introduce link_lv_to_vg and unlink_lv_from_vg functions.
Remove lv_count from VG and use counter function instead. 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 NON_BLOCKING lock flag from tools and set a policy to auto-set.
Remove snapshot_count from VG and use function instead. Remove snapshot_count from VG and use function instead.
Fix first_seg() call for empty segment list. 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. Reject missing PVs from allocation in toollib.
Fix PV datalignment for values starting prior to MDA area. (2.02.45) Fix PV datalignment for values starting prior to MDA area. (2.02.45)
Add sparse devices: lvcreate -s --virtualoriginsize (hidden zero origin). Add sparse devices: lvcreate -s --virtualoriginsize (hidden zero origin).
Fix minimum width of devices column in reports.
Add lvs origin_size field. Add lvs origin_size field.
Fix linux configure --enable-debug to exclude -O2. 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 vgreduce --removemissing failure exit code.
Fix remote metadata backup for clvmd. 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. Alloc PV internal structure from VG mempool if possible.
Fix metadata backup to run after vg_commit always. Fix metadata backup to run after vg_commit always.
Tidy clvmd volume lock cache functions. 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. Fix pvs -a output to not read volume groups from non-PV devices.
Add MMC (mmcblk) device type to filters. Add MMC (mmcblk) device type to filters.
Introduce memory pools per volume group (to reduce memory for large VGs). Introduce memory pools per volume group (to reduce memory for large VGs).
Add memory pool leaks detection. Use copy of PV structure when manipulating global PV lists.
Use copy of PV structure when manipulating with global PV lists.
Always return exit error status when locking of volume group fails. Always return exit error status when locking of volume group fails.
Fix mirror log convert validation question. Fix mirror log convert validation question.
Avoid referencing files from DESTDIR during build process. 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. Enable use of cached metadata for pvs and pvdisplay commands.
Add missing 'device-mapper' internal subdir build dependency. Add missing 'device-mapper' internal subdir build dependency.
Fix memory leak in mirror allocation code. Fix memory leak in mirror allocation code.
@ -52,14 +56,15 @@ Version 2.02.46 -
Block SIGTERM & SIGINT in clvmd subthreads. Block SIGTERM & SIGINT in clvmd subthreads.
Detect and conditionally wipe swapspace signatures in pvcreate. Detect and conditionally wipe swapspace signatures in pvcreate.
Fix maximal volume count check for snapshots if max_lv set for volume group. 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. 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. 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 error message when adding metadata directory to internal list fails.
Fix size and error message of memory allocation at backup initialization. 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. Restore log_suppress state when metadata backup file is up-to-date.
Version 2.02.45 - 3rd March 2009 Version 2.02.45 - 3rd March 2009

View File

@ -1,5 +1,5 @@
Version 1.02.32 - Version 1.02.32 - 21st May 2009
================================ ===============================
Only generate libdevmapper.a when configured to link statically. Only generate libdevmapper.a when configured to link statically.
Export dm_tree_node_size_changed() from libdevmapper. Export dm_tree_node_size_changed() from libdevmapper.
Propagate the table size_changed property up the dm device tree. Propagate the table size_changed property up the dm device tree.

View File

@ -711,7 +711,7 @@ int lv_is_active(struct logical_volume *lv)
*/ */
if (activate_lv_excl(lv->vg->cmd, lv)) { if (activate_lv_excl(lv->vg->cmd, lv)) {
deactivate_lv(lv->vg->cmd, lv); deactivate_lv(lv->vg->cmd, lv);
return 0; return 0;
} }
/* /*

View File

@ -1,5 +1,5 @@
locking_init locking_init
locking_end locking_end
lock_resource lock_resource
lock_resource_query query_resource
reset_locking reset_locking

View File

@ -33,7 +33,7 @@
#ifndef CLUSTER_LOCKING_INTERNAL #ifndef CLUSTER_LOCKING_INTERNAL
int lock_resource(struct cmd_context *cmd, const char *resource, uint32_t flags); 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); void locking_end(void);
int locking_init(int type, struct config_tree *cf, uint32_t *flags); int locking_init(int type, struct config_tree *cf, uint32_t *flags);
#endif #endif
@ -472,9 +472,9 @@ static int decode_lock_type(const char *response)
} }
#ifdef CLUSTER_LOCKING_INTERNAL #ifdef CLUSTER_LOCKING_INTERNAL
static int _lock_resource_query(const char *resource, int *mode) static int _query_resource(const char *resource, int *mode)
#else #else
int lock_resource_query(const char *resource, int *mode) int query_resource(const char *resource, int *mode)
#endif #endif
{ {
int i, status, len, num_responses, saved_errno; 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) int init_cluster_locking(struct locking_type *locking, struct cmd_context *cmd)
{ {
locking->lock_resource = _lock_resource; locking->lock_resource = _lock_resource;
locking->lock_resource_query = _lock_resource_query; locking->query_resource = _query_resource;
locking->fin_locking = _locking_end; locking->fin_locking = _locking_end;
locking->reset_locking = _reset_locking; locking->reset_locking = _reset_locking;
locking->flags = LCK_PRE_MEMLOCK | LCK_CLUSTERED; locking->flags = LCK_PRE_MEMLOCK | LCK_CLUSTERED;

View File

@ -89,8 +89,8 @@ int init_external_locking(struct locking_type *locking, struct cmd_context *cmd)
return 0; return 0;
} }
if (!(_lock_query_fn = dlsym(_locking_lib, "lock_resource_query"))) if (!(_lock_query_fn = dlsym(_locking_lib, "query_resource")))
log_warn("WARNING: %s: _lock_resource_query() missing: " log_warn("WARNING: %s: _query_resource() missing: "
"Using inferior activation method.", libname); "Using inferior activation method.", libname);
log_verbose("Loaded external locking library %s", libname); log_verbose("Loaded external locking library %s", libname);

View File

@ -489,13 +489,13 @@ int remote_lock_held(const char *vol)
if (!locking_is_clustered()) if (!locking_is_clustered())
return 0; return 0;
if (!_locking.lock_resource_query) if (!_locking.query_resource)
return -1; return -1;
/* /*
* If an error occured, expect that volume is active * If an error occured, expect that volume is active
*/ */
if (!_locking.lock_resource_query(vol, &mode)) { if (!_locking.query_resource(vol, &mode)) {
stack; stack;
return 1; return 1;
} }

View File

@ -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)) 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_vg(cmd, vol) lock_vol(cmd, vol, LCK_VG_UNLOCK)
#define unlock_release_vg(cmd, vg, vol) do { unlock_vg(cmd, vol); \ #define unlock_and_release_vg(cmd, vg, vol) \
vg_release(vg); \ do { \
} while (0) unlock_vg(cmd, vol); \
vg_release(vg); \
} while (0)
#define resume_lv(cmd, lv) lock_lv_vol(cmd, lv, LCK_LV_RESUME) #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) #define suspend_lv(cmd, lv) lock_lv_vol(cmd, lv, LCK_LV_SUSPEND | LCK_HOLD)

View File

@ -18,7 +18,7 @@
typedef int (*lock_resource_fn) (struct cmd_context * cmd, const char *resource, typedef int (*lock_resource_fn) (struct cmd_context * cmd, const char *resource,
uint32_t flags); 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 (*fin_lock_fn) (void);
typedef void (*reset_lock_fn) (void); typedef void (*reset_lock_fn) (void);
@ -29,7 +29,7 @@ typedef void (*reset_lock_fn) (void);
struct locking_type { struct locking_type {
uint32_t flags; uint32_t flags;
lock_resource_fn lock_resource; lock_resource_fn lock_resource;
lock_resource_query_fn lock_resource_query; query_resource_fn query_resource;
reset_lock_fn reset_locking; reset_lock_fn reset_locking;
fin_lock_fn fin_locking; fin_lock_fn fin_locking;

View File

@ -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], if (!set_lv_segment_area_lv(seg, m, sub_lvs[m - old_area_count],
0, status)) 0, status))
return_0; return_0;
lv_set_invisible(sub_lvs[m - old_area_count]); lv_set_hidden(sub_lvs[m - old_area_count]);
} }
lv->status |= MIRRORED; 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); 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)) if (!lv_is_visible(lv))
return; return;
lv->status &= ~VISIBLE_LV; 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, int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,

View File

@ -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 link_lv_to_vg(struct volume_group *vg, struct logical_volume *lv);
int unlink_lv_from_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_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 */ /* Set full_scan to 1 to re-read every (filtered) device label */
struct dm_list *get_vgnames(struct cmd_context *cmd, int full_scan); 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, int vg_split_mdas(struct cmd_context *cmd, struct volume_group *vg_from,
struct volume_group *vg_to); 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); void vg_release(struct volume_group *vg);
/* Manipulate LVs */ /* Manipulate LVs */
struct logical_volume *lv_create_empty(const char *name, struct logical_volume *lv_create_empty(const char *name,
union lvid *lvid, union lvid *lvid,

View File

@ -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)) || if (!(vg = vg_read_internal(cmd, vg_name, vgid, &consistent)) ||
((misc_flags & FAIL_INCONSISTENT) && !consistent)) { ((misc_flags & FAIL_INCONSISTENT) && !consistent)) {
log_error("Volume group \"%s\" not found", vg_name); 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; return NULL;
} }
if (!vg_check_status(vg, status_flags)) { if (!vg_check_status(vg, status_flags)) {
unlock_release_vg(cmd, vg, vg_name); unlock_and_release_vg(cmd, vg, vg_name);
return NULL; return NULL;
} }

View File

@ -303,7 +303,7 @@ static int _init_mirror_log(struct cmd_context *cmd,
return 0; return 0;
} }
lv_set_invisible(log_lv); lv_set_hidden(log_lv);
if (was_active && !activate_lv(cmd, log_lv)) if (was_active && !activate_lv(cmd, log_lv))
return_0; return_0;
@ -1340,7 +1340,7 @@ int attach_mirror_log(struct lv_segment *seg, struct logical_volume *log_lv)
{ {
seg->log_lv = log_lv; seg->log_lv = log_lv;
log_lv->status |= MIRROR_LOG; 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); 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, !(log_lv = _set_up_mirror_log(cmd, ah, lv, log_count, region_size,
alloc, mirror_in_sync()))) { alloc, mirror_in_sync()))) {
stack; stack;
goto out_remove_imgs; goto out_remove_images;
} }
/* The log initialization involves vg metadata commit. /* 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)) { region_size)) {
log_error("Aborting. Failed to add mirror segment. " log_error("Aborting. Failed to add mirror segment. "
"Remove new LV and retry."); "Remove new LV and retry.");
goto out_remove_imgs; goto out_remove_images;
} }
if (log_count && !attach_mirror_log(first_seg(lv), log_lv)) 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 else
backup(log_lv->vg); backup(log_lv->vg);
} }
out_remove_imgs: out_remove_images:
alloc_destroy(ah); alloc_destroy(ah);
return 0; return 0;
} }

View File

@ -68,7 +68,7 @@ void init_snapshot_seg(struct lv_segment *seg, struct logical_volume *origin,
seg->origin = origin; seg->origin = origin;
seg->cow = cow; seg->cow = cow;
lv_set_invisible(cow); lv_set_hidden(cow);
cow->snapshot = seg; cow->snapshot = seg;

View File

@ -29,18 +29,17 @@
* 3. Field type. This must be either 'STR' or 'NUM'. * 3. Field type. This must be either 'STR' or 'NUM'.
* 4. Report heading. This is the field heading that is displayed by the * 4. Report heading. This is the field heading that is displayed by the
* reporting commands. * reporting commands.
* 5. Data value pointer. This argument is is always a member of the * 5. Data value pointer. This argument is always a member of the
* containing struct. In some cases, the member points to the data value * containing struct. It may point directly to the data value (for example,
* of the field (for example, lv_uuid - see _uuid_disp()). In other cases * lv_uuid - see _uuid_disp()) or may be used to derive the data value (for
* it is pointer that may be used to derive the data value (for example, * example, seg_count - see _lvsegcount_disp()). In the FIELD macro
* seg_count - see _lvsegcount_disp()). In the FIELD macro definition, * definition, it is used in an offset calculation to derive the offset to
* this is used in an offset calculation to derive the offset to the * the data value from the containing struct base address. Note that in some
* 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 * 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, * data value pointer points to the start of the struct itself (for example,
* 'lvid' field of struct 'lv'). * 'lvid' field of struct 'lv').
* 6. Minimum display width. This is the minimum width used to display * 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 * 7. Display function identifier. Used to derive the full name of the
* function that displays this field. Derivation is done by appending '_' * function that displays this field. Derivation is done by appending '_'
* then prepending this argument to '_disp'. For example, if this argument * then prepending this argument to '_disp'. For example, if this argument

View File

@ -371,56 +371,61 @@ static int _area_missing(struct lv_segment *lvseg, int s)
if (seg_type(lvseg, s) == AREA_LV) { if (seg_type(lvseg, s) == AREA_LV) {
if (seg_lv(lvseg, s)->status & PARTIAL_LV) if (seg_lv(lvseg, s)->status & PARTIAL_LV)
return 1; return 1;
} else if (seg_type(lvseg, s) == AREA_PV) { } else if ((seg_type(lvseg, s) == AREA_PV) &&
if (seg_pv(lvseg, s)->status & MISSING_PV) (seg_pv(lvseg, s)->status & MISSING_PV))
return 1; return 1;
}
return 0; return 0;
} }
/* FIXME we want to handle mirror stacks here... */ /* 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; struct lv_segment *lvseg;
int ret = 0; int ret = 0;
int s; int s;
dm_list_iterate_items(lvseg, &lv->segments) { dm_list_iterate_items(lvseg, &lv->segments) {
if (!seg_is_mirrored(lvseg)) if (!seg_is_mirrored(lvseg))
return -1; return -1;
for(s = 0; s < lvseg->area_count; ++s) { for (s = 0; s < lvseg->area_count; s++)
if (_area_missing(lvseg, s)) if (_area_missing(lvseg, s))
++ ret; ret++;
}
} }
return ret; return ret;
} }
static struct dm_list *_failed_pv_list(struct volume_group *vg) 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; struct pv_list *pvl, *new_pvl;
if (!(r = dm_pool_alloc(vg->vgmem, sizeof(*r)))) { if (!(failed_pvs = dm_pool_alloc(vg->vgmem, sizeof(*failed_pvs)))) {
log_error("Allocation of list failed"); log_error("Allocation of list of failed_pvs failed.");
return_0; return_NULL;
} }
dm_list_init(r); dm_list_init(failed_pvs);
dm_list_iterate_items(pvl, &vg->pvs) { dm_list_iterate_items(pvl, &vg->pvs) {
if (!(pvl->pv->status & MISSING_PV)) if (!(pvl->pv->status & MISSING_PV))
continue; continue;
if (!(new_pvl = dm_pool_alloc(vg->vgmem, sizeof(*new_pvl)))) { if (!(new_pvl = dm_pool_alloc(vg->vgmem, sizeof(*new_pvl)))) {
log_error("Unable to allocate physical volume list."); log_error("Allocation of failed_pvs list entry failed.");
return_0; return_NULL;
} }
new_pvl->pv = pvl->pv; 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) static struct logical_volume *_original_lv(struct logical_volume *lv)
{ {
struct logical_volume *next_lv = lv, *tmp_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; return next_lv;
} }
static int lvconvert_mirrors(struct cmd_context * cmd, struct logical_volume * lv, static int _lvconvert_mirrors(struct cmd_context *cmd, struct logical_volume *lv,
struct lvconvert_params *lp) struct lvconvert_params *lp)
{ {
struct lv_segment *seg; struct lv_segment *seg;
uint32_t existing_mirrors; 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."); log_error("The mirror is consistent, nothing to repair.");
return 0; return 0;
} }
if ((failed_mirrors = _count_failed_mirrors(lv)) < 0) if ((failed_mirrors = _failed_mirrors_count(lv)) < 0)
return_0; return_0;
lp->mirrors -= failed_mirrors; lp->mirrors -= failed_mirrors;
log_error("Mirror status: %d/%d legs failed.", 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)) { } else if (arg_count(cmd, mirrors_ARG) || (lv->status & MIRRORED)) {
if (!archive(lv->vg)) if (!archive(lv->vg))
return ECMD_FAILED; return ECMD_FAILED;
if (!lvconvert_mirrors(cmd, lv, lp)) if (!_lvconvert_mirrors(cmd, lv, lp))
return ECMD_FAILED; return ECMD_FAILED;
} }

View File

@ -998,6 +998,6 @@ int lvcreate(struct cmd_context *cmd, int argc, char **argv)
if (!_lvcreate(cmd, vg, &lp)) if (!_lvcreate(cmd, vg, &lp))
r = ECMD_FAILED; r = ECMD_FAILED;
unlock_release_vg(cmd, vg, lp.vg_name); unlock_and_release_vg(cmd, vg, lp.vg_name);
return r; return r;
} }

View File

@ -121,6 +121,6 @@ int lvrename(struct cmd_context *cmd, int argc, char **argv)
r = ECMD_PROCESSED; r = ECMD_PROCESSED;
error: error:
unlock_release_vg(cmd, vg, vg_name); unlock_and_release_vg(cmd, vg, vg_name);
return r; return r;
} }

View File

@ -681,7 +681,7 @@ int lvresize(struct cmd_context *cmd, int argc, char **argv)
if (!(r = _lvresize(cmd, vg, &lp))) if (!(r = _lvresize(cmd, vg, &lp)))
stack; stack;
unlock_release_vg(cmd, vg, lp.vg_name); unlock_and_release_vg(cmd, vg, lp.vg_name);
return r; return r;
} }

View File

@ -157,17 +157,17 @@ static int _wait_for_single_mirror(struct cmd_context *cmd, const char *name,
parms->lv_type))) { parms->lv_type))) {
log_error("ABORTING: Can't find mirror LV in %s for %s", log_error("ABORTING: Can't find mirror LV in %s for %s",
vg->name, name); vg->name, name);
unlock_release_vg(cmd, vg, vg->name); unlock_and_release_vg(cmd, vg, vg->name);
return 0; return 0;
} }
if (!_check_mirror_status(cmd, vg, lv_mirr, name, parms, if (!_check_mirror_status(cmd, vg, lv_mirr, name, parms,
&finished)) { &finished)) {
unlock_release_vg(cmd, vg, vg->name); unlock_and_release_vg(cmd, vg, vg->name);
return 0; return 0;
} }
unlock_release_vg(cmd, vg, vg->name); unlock_and_release_vg(cmd, vg, vg->name);
} }
return 1; return 1;

View File

@ -201,7 +201,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct physical_volume *pv,
log_print("Physical volume \"%s\" changed", pv_name); log_print("Physical volume \"%s\" changed", pv_name);
r = 1; r = 1;
out: out:
unlock_release_vg(cmd, vg, vg_name); unlock_and_release_vg(cmd, vg, vg_name);
return r; return r;
} }

View File

@ -459,7 +459,7 @@ static int _set_up_pvmove(struct cmd_context *cmd, const char *pv_name,
/* LVs are all in status LOCKED */ /* LVs are all in status LOCKED */
r = ECMD_PROCESSED; r = ECMD_PROCESSED;
out: out:
unlock_release_vg(cmd, vg, pv_vg_name(pv)); unlock_and_release_vg(cmd, vg, pv_vg_name(pv));
return r; return r;
} }

View File

@ -319,7 +319,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
} }
if (!vg_check_status(vg, CLUSTERED)) { if (!vg_check_status(vg, CLUSTERED)) {
unlock_release_vg(cmd, vg, vgname); unlock_and_release_vg(cmd, vg, vgname);
if (ret_max < ECMD_FAILED) if (ret_max < ECMD_FAILED)
ret_max = ECMD_FAILED; ret_max = ECMD_FAILED;
continue; 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, ret = process_each_lv_in_vg(cmd, vg, &lvnames, tags_arg,
handle, process_single); handle, process_single);
unlock_release_vg(cmd, vg, vgname); unlock_and_release_vg(cmd, vg, vgname);
if (ret > ret_max) if (ret > ret_max)
ret_max = ret; ret_max = ret;
if (sigint_caught()) 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)) { if (!vg_check_status(vg, CLUSTERED)) {
unlock_release_vg(cmd, vg, vg_name); unlock_and_release_vg(cmd, vg, vg_name);
return ECMD_FAILED; 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 */ /* Only process if a tag matches or it's on arg_vgnames */
if (!str_list_match_item(arg_vgnames, vg_name) && if (!str_list_match_item(arg_vgnames, vg_name) &&
!str_list_match_list(tags, &vg->tags)) { !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; return ret_max;
} }
} }
@ -487,7 +487,7 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name,
ret_max = ret; ret_max = ret;
} }
unlock_release_vg(cmd, vg, vg_name); unlock_and_release_vg(cmd, vg, vg_name);
return ret_max; return ret_max;
} }
@ -771,12 +771,12 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
continue; continue;
} }
if (!consistent) { if (!consistent) {
unlock_release_vg(cmd, vg, sll->str); unlock_and_release_vg(cmd, vg, sll->str);
continue; continue;
} }
if (!vg_check_status(vg, CLUSTERED)) { if (!vg_check_status(vg, CLUSTERED)) {
unlock_release_vg(cmd, vg, sll->str); unlock_and_release_vg(cmd, vg, sll->str);
continue; continue;
} }
@ -784,7 +784,7 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
handle, handle,
process_single); process_single);
unlock_release_vg(cmd, vg, sll->str); unlock_and_release_vg(cmd, vg, sll->str);
if (ret > ret_max) if (ret > ret_max)
ret_max = ret; ret_max = ret;

View File

@ -532,7 +532,7 @@ static int vgchange_single(struct cmd_context *cmd, const char *vg_name,
} }
if (!consistent) { if (!consistent) {
unlock_release_vg(cmd, vg, vg_name); unlock_and_release_vg(cmd, vg, vg_name);
dev_close_all(); dev_close_all();
log_error("Volume group \"%s\" inconsistent", vg_name); log_error("Volume group \"%s\" inconsistent", vg_name);
if (!(vg = recover_vg(cmd, vg_name, LCK_VG_WRITE))) if (!(vg = recover_vg(cmd, vg_name, LCK_VG_WRITE)))

View File

@ -38,7 +38,7 @@ static int vgconvert_single(struct cmd_context *cmd, const char *vg_name,
} }
if (!consistent) { if (!consistent) {
unlock_release_vg(cmd, vg, vg_name); unlock_and_release_vg(cmd, vg, vg_name);
dev_close_all(); dev_close_all();
log_error("Volume group \"%s\" inconsistent", vg_name); log_error("Volume group \"%s\" inconsistent", vg_name);
if (!(vg = recover_vg(cmd, vg_name, LCK_VG_WRITE))) if (!(vg = recover_vg(cmd, vg_name, LCK_VG_WRITE)))

View File

@ -76,7 +76,7 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)
r = ECMD_PROCESSED; r = ECMD_PROCESSED;
error: error:
unlock_release_vg(cmd, vg, vg_name); unlock_and_release_vg(cmd, vg, vg_name);
unlock_vg(cmd, VG_ORPHANS); unlock_vg(cmd, VG_ORPHANS);
return r; return r;
} }

View File

@ -38,7 +38,7 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,
LCK_VG_WRITE, LCK_VG_WRITE,
CLUSTERED | EXPORTED_VG | LVM_WRITE, CLUSTERED | EXPORTED_VG | LVM_WRITE,
CORRECT_INCONSISTENT | FAIL_INCONSISTENT))) { 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; 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); vg_from->name, vg_to->name);
r = ECMD_PROCESSED; r = ECMD_PROCESSED;
bad: bad:
unlock_release_vg(cmd, vg_from, vg_name_from); unlock_and_release_vg(cmd, vg_from, vg_name_from);
unlock_release_vg(cmd, vg_to, vg_name_to); unlock_and_release_vg(cmd, vg_to, vg_name_to);
return r; return r;
} }

View File

@ -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); log_print("Removed \"%s\" from volume group \"%s\"", name, vg->name);
r = ECMD_PROCESSED; r = ECMD_PROCESSED;
bad: bad:
unlock_release_vg(cmd, orphan_vg, VG_ORPHANS); unlock_and_release_vg(cmd, orphan_vg, VG_ORPHANS);
return r; return r;
} }
@ -574,7 +574,7 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
} }
out: out:
unlock_release_vg(cmd, vg, vg_name); unlock_and_release_vg(cmd, vg, vg_name);
return ret; return ret;

View File

@ -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)) { 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; 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); vg_check_status(vg, EXPORTED_VG);
if (lvs_in_vg_activated_by_uuid_only(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", log_error("Volume group \"%s\" still has active LVs",
vg_name_old); vg_name_old);
/* FIXME Remove this restriction */ /* 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); log_verbose("Checking for new volume group \"%s\"", vg_name_new);
if (!lock_vol(cmd, vg_name_new, LCK_VG_WRITE)) { 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); log_error("Can't get lock for %s", vg_name_new);
return 0; return 0;
} }
@ -151,8 +151,8 @@ static int vg_rename_path(struct cmd_context *cmd, const char *old_vg_path,
backup(vg); backup(vg);
backup_remove(cmd, vg_name_old); backup_remove(cmd, vg_name_old);
unlock_release_vg(cmd, vg_new, vg_name_new); unlock_and_release_vg(cmd, vg_new, vg_name_new);
unlock_release_vg(cmd, vg, vg_name_old); unlock_and_release_vg(cmd, vg, vg_name_old);
log_print("Volume group \"%s\" successfully renamed to \"%s\"", log_print("Volume group \"%s\" successfully renamed to \"%s\"",
vg_name_old, vg_name_new); 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; return 1;
error: error:
unlock_release_vg(cmd, vg_new, vg_name_new); unlock_and_release_vg(cmd, vg_new, vg_name_new);
unlock_release_vg(cmd, vg, vg_name_old); unlock_and_release_vg(cmd, vg, vg_name_old);
return 0; return 0;
} }

View File

@ -25,7 +25,7 @@ static int vgscan_single(struct cmd_context *cmd, const char *vg_name,
} }
if (!consistent) { if (!consistent) {
unlock_release_vg(cmd, vg, vg_name); unlock_and_release_vg(cmd, vg, vg_name);
dev_close_all(); dev_close_all();
log_error("Volume group \"%s\" inconsistent", vg_name); log_error("Volume group \"%s\" inconsistent", vg_name);
/* Don't allow partial switch to this program */ /* Don't allow partial switch to this program */

View File

@ -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); log_verbose("Checking for new volume group \"%s\"", vg_name_to);
if (!lock_vol(cmd, vg_name_to, LCK_VG_WRITE)) { if (!lock_vol(cmd, vg_name_to, LCK_VG_WRITE)) {
log_error("Can't get lock for %s", vg_name_to); 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; return ECMD_FAILED;
} }
@ -466,7 +466,7 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
r = ECMD_PROCESSED; r = ECMD_PROCESSED;
bad: bad:
unlock_release_vg(cmd, vg_from, vg_name_from); unlock_and_release_vg(cmd, vg_from, vg_name_from);
unlock_release_vg(cmd, vg_to, vg_name_to); unlock_and_release_vg(cmd, vg_to, vg_name_to);
return r; return r;
} }