1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 20:25:52 +03:00

lvmlockd: update VG lock version earlier

Have commands send lvmlockd the update message
in vg_write instead of vg_commit, so that it's
not done while LVs are suspended.  If the vg_write
is not committed, and the seqno sent to lvmlockd
is not used, then lvmlockd can detect this when
the next update uses the same seqno.
This commit is contained in:
David Teigland 2015-12-15 16:14:49 -06:00
parent 796461a912
commit 124b490fe6
2 changed files with 18 additions and 3 deletions

View File

@ -1579,8 +1579,23 @@ static int res_update(struct lockspace *ls, struct resource *r,
if (act->flags & LD_AF_NEXT_VERSION)
lk->version = r->version + 1;
else
else {
if (r->version >= act->version) {
/*
* This update is done from vg_write. If the metadata with
* this seqno is not committed by vg_commit, then next
* vg_write can use the same seqno, causing us to see no
* increase in seqno here as expected.
* FIXME: In this case, do something like setting the lvb
* version to 0 to instead of the same seqno which will
* force an invalidation on other hosts. The next change
* will return to using the seqno again.
*/
log_error("S %s R %s res_update cl %u old version %u new version %u too small",
ls->name, r->name, act->client_id, r->version, act->version);
}
lk->version = act->version;
}
log_debug("S %s R %s res_update cl %u lk version to %u", ls->name, r->name, act->client_id, lk->version);

View File

@ -3138,6 +3138,8 @@ int vg_write(struct volume_group *vg)
if (!(vg->fid->fmt->features & FMT_PRECOMMIT) && !lvmetad_vg_update(vg))
return_0;
lockd_vg_update(vg);
return 1;
}
@ -3194,8 +3196,6 @@ int vg_commit(struct volume_group *vg)
cache_updated = _vg_commit_mdas(vg);
lockd_vg_update(vg);
if (cache_updated) {
/* Instruct remote nodes to upgrade cached metadata. */
if (!remote_commit_cached_metadata(vg))