diff --git a/daemons/lvmlockd/lvmlockd-client.h b/daemons/lvmlockd/lvmlockd-client.h index 3a6406564..187c07f03 100644 --- a/daemons/lvmlockd/lvmlockd-client.h +++ b/daemons/lvmlockd/lvmlockd-client.h @@ -16,6 +16,8 @@ #define LVMLOCKD_SOCKET DEFAULT_RUN_DIR "/lvmlockd.socket" #define LVMLOCKD_ADOPT_FILE DEFAULT_RUN_DIR "/lvmlockd.adopt" +#define LVMLOCKD_USE_SANLOCK_LVB 0 + /* Wrappers to open/close connection */ static inline __attribute__((always_inline)) diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c index 327311b2f..6f0500689 100644 --- a/daemons/lvmlockd/lvmlockd-core.c +++ b/daemons/lvmlockd/lvmlockd-core.c @@ -1320,7 +1320,9 @@ static int res_lock(struct lockspace *ls, struct resource *r, struct action *act * once someone uses the lock and writes a new lvb value. * Do nothing. */ + /* log_debug("S %s R %s res_lock version_zero_valid still zero", ls->name, r->name); + */ } else if (r->version_zero_valid && vb.r_version) { /* diff --git a/daemons/lvmlockd/lvmlockd-sanlock.c b/daemons/lvmlockd/lvmlockd-sanlock.c index b7bc7804e..b1f60ee05 100644 --- a/daemons/lvmlockd/lvmlockd-sanlock.c +++ b/daemons/lvmlockd/lvmlockd-sanlock.c @@ -1610,12 +1610,17 @@ static int lm_add_resource_sanlock(struct lockspace *ls, struct resource *r) /* LD_RT_LV offset is set in each lm_lock call from lv_args. */ + /* + * Disable sanlock lvb since lock versions are not currently used for + * anything, and it's nice to avoid the extra i/o used for lvb's. + */ +#if LVMLOCKD_USE_SANLOCK_LVB if (r->type == LD_RT_GL || r->type == LD_RT_VG) { rds->vb = zalloc(sizeof(struct val_blk)); if (!rds->vb) return -ENOMEM; } - +#endif return 0; } @@ -1624,9 +1629,9 @@ int lm_rem_resource_sanlock(struct lockspace *ls, struct resource *r) struct rd_sanlock *rds = (struct rd_sanlock *)r->lm_data; /* FIXME: assert r->mode == UN or unlock if it's not? */ - +#ifdef LVMLOCKD_USE_SANLOCK_LVB free(rds->vb); - +#endif memset(rds, 0, sizeof(struct rd_sanlock)); r->lm_init = 0; return 0; diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c index 7a10e0a31..2443c9794 100644 --- a/lib/locking/lvmlockd.c +++ b/lib/locking/lvmlockd.c @@ -2301,12 +2301,22 @@ int lockd_vg_update(struct volume_group *vg) int result; int ret; - if (!vg_is_shared(vg)) - return 1; if (!_use_lvmlockd) return 0; if (!_lvmlockd_connected) return 0; + if (!vg_is_shared(vg)) + return 1; + +#if !LVMLOCKD_USE_SANLOCK_LVB + /* + * lvb (for lock version) is disabled for sanlock since + * lock versions are not used any more, and it's more + * costly for sanlock to implement (extra i/o.) + */ + if (!strcmp(vg->lock_type, "sanlock")) + return 1; +#endif reply = _lockd_send("vg_update", "pid = " FMTd64, (int64_t) getpid(),