mirror of
git://sourceware.org/git/lvm2.git
synced 2025-02-25 21:57:45 +03:00
more vg_read lock fixes
This commit is contained in:
parent
85ac11b69b
commit
a01732ee9b
@ -335,6 +335,11 @@ int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags)
|
||||
{
|
||||
char resource[258] __attribute((aligned(8)));
|
||||
|
||||
if (flags == LCK_NONE) {
|
||||
log_debug("Internal error: %s: LCK_NONE lock requested", vol);
|
||||
return 1;
|
||||
}
|
||||
|
||||
switch (flags & LCK_SCOPE_MASK) {
|
||||
case LCK_VG:
|
||||
/* Lock VG to change on-disk metadata. */
|
||||
|
@ -86,7 +86,7 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname);
|
||||
/*
|
||||
* Common combinations
|
||||
*/
|
||||
#define LCK_NONE 0
|
||||
#define LCK_NONE (LCK_VG | LCK_NULL)
|
||||
|
||||
#define LCK_VG_READ (LCK_VG | LCK_READ | LCK_HOLD)
|
||||
#define LCK_VG_WRITE (LCK_VG | LCK_WRITE | LCK_HOLD)
|
||||
|
@ -31,6 +31,7 @@ static int _pvdisplay_single(struct cmd_context *cmd,
|
||||
if (!(vg = vg_lock_and_read(cmd, vg_name, (char *)&pv->vgid,
|
||||
LCK_VG_READ, CLUSTERED, 0))) {
|
||||
log_error("Skipping volume group %s", vg_name);
|
||||
/* FIXME If CLUSTERED should return ECMD_PROCESSED here */
|
||||
return ECMD_FAILED;
|
||||
}
|
||||
|
||||
|
@ -443,10 +443,9 @@ int process_each_segment_in_pv(struct cmd_context *cmd,
|
||||
if (ret > ret_max)
|
||||
ret_max = ret;
|
||||
if (sigint_caught())
|
||||
return ret_max;
|
||||
break;
|
||||
}
|
||||
|
||||
out:
|
||||
if (vg_name)
|
||||
unlock_vg(cmd, vg_name);
|
||||
|
||||
@ -747,8 +746,15 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
|
||||
if (sigint_caught())
|
||||
return ret_max;
|
||||
}
|
||||
if (!list_empty(&tags) && (vgnames = get_vgs(cmd, 0)) &&
|
||||
!list_empty(vgnames)) {
|
||||
if (vg) {
|
||||
ret = process_each_pv_in_vg(cmd, vg, &tags,
|
||||
handle, process_single);
|
||||
if (ret > ret_max)
|
||||
ret_max = ret;
|
||||
if (sigint_caught())
|
||||
return ret_max;
|
||||
} else if (!list_empty(&tags) && (vgnames = get_vgs(cmd, 0)) &&
|
||||
!list_empty(vgnames)) {
|
||||
list_iterate_items(sll, vgnames) {
|
||||
if (!lock_vol(cmd, sll->str, lock_type)) {
|
||||
log_error("Can't lock %s: skipping", sll->str);
|
||||
|
@ -539,7 +539,7 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)
|
||||
|
||||
/* FIXME: Pass private struct through to all these functions */
|
||||
/* and update in batch here? */
|
||||
ret = process_each_pv(cmd, argc, argv, vg, LCK_VG_WRITE, NULL,
|
||||
ret = process_each_pv(cmd, argc, argv, vg, LCK_NONE, NULL,
|
||||
_vgreduce_single);
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user