1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-26 03:22:12 +03:00

lvmlockd: skip repair lock upgrade for non shared vgs

Only attempt lvmlockd lock upgrade for shared VGs.
This commit is contained in:
David Teigland 2018-06-12 09:25:51 -05:00
parent 98eb9e5754
commit d3dcca639c

View File

@ -5185,7 +5185,8 @@ int vg_check_status(const struct volume_group *vg, uint64_t status)
* VG is left unlocked on failure
*/
static struct volume_group *_recover_vg(struct cmd_context *cmd,
const char *vg_name, const char *vgid, uint32_t lockd_state)
const char *vg_name, const char *vgid,
int is_shared, uint32_t lockd_state)
{
int consistent = 1;
struct volume_group *vg;
@ -5199,7 +5200,7 @@ static struct volume_group *_recover_vg(struct cmd_context *cmd,
/*
* Convert vg lock in lvmlockd from sh to ex.
*/
if (!(lockd_state & LDST_FAIL) && !(lockd_state & LDST_EX)) {
if (is_shared && !(lockd_state & LDST_FAIL) && !(lockd_state & LDST_EX)) {
log_debug("Upgrade lvmlockd lock to repair vg %s.", vg_name);
if (!lockd_vg(cmd, vg_name, "ex", 0, &state)) {
log_warn("Skip repair for shared VG without exclusive lock.");
@ -5450,6 +5451,7 @@ static struct volume_group *_vg_lock_and_read(struct cmd_context *cmd, const cha
int consistent_in;
uint32_t failure = 0;
uint32_t warn_flags = 0;
int is_shared = 0;
int already_locked;
if ((read_flags & READ_ALLOW_INCONSISTENT) || (lock_flags != LCK_VG_WRITE))
@ -5498,8 +5500,9 @@ static struct volume_group *_vg_lock_and_read(struct cmd_context *cmd, const cha
/* consistent == 0 when VG is not found, but failed == FAILED_NOTFOUND */
if (!consistent && !failure) {
is_shared = vg_is_shared(vg);
release_vg(vg);
if (!(vg = _recover_vg(cmd, vg_name, vgid, lockd_state))) {
if (!(vg = _recover_vg(cmd, vg_name, vgid, is_shared, lockd_state))) {
if (is_orphan_vg(vg_name))
log_error("Recovery of standalone physical volumes failed.");
else