1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-04 09:18:36 +03:00

clvmd: singlenode signals only when lock changes

There is no benefit in waking-up all the waiters
when there is no actual change in lock state.
This avoid some unnecessarily ping-pong effects like:

 Resource V_LVMTEST15724vg retrying lock in mode:WRITE...
 Resource V_LVMTEST15724vg already locked lockid=40, mode:WRITE
 Resource V_LVMTEST15724vg retrying lock in mode:WRITE...
 Resource V_LVMTEST15724vg already locked lockid=40, mode:WRITE
This commit is contained in:
Zdenek Kabelac 2015-04-08 23:12:29 +02:00
parent f32973c78e
commit 4459413225
2 changed files with 3 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.119 - Version 2.02.119 -
================================== ==================================
More efficient clvmd singlenode locking emulation.
Don't skip invalidation of cached orphans if vg write lck is held (2.02.118). Don't skip invalidation of cached orphans if vg write lck is held (2.02.118).
Log relevant PV tags when using cling allocation. Log relevant PV tags when using cling allocation.
Add str_list_add_list() to combine two lists. Add str_list_add_list() to combine two lists.

View File

@ -208,8 +208,6 @@ static int _lock_resource(const char *resource, int mode, int flags, int *lockid
pthread_mutex_lock(&_lock_mutex); pthread_mutex_lock(&_lock_mutex);
retry: retry:
pthread_cond_broadcast(&_lock_cond); /* to wakeup waiters */
if (!(head = dm_hash_lookup(_locks, resource))) { if (!(head = dm_hash_lookup(_locks, resource))) {
if (flags & LCKF_CONVERT) { if (flags & LCKF_CONVERT) {
/* In real DLM, lock is identified only by lockid, resource is not used */ /* In real DLM, lock is identified only by lockid, resource is not used */
@ -269,12 +267,14 @@ retry:
dm_list_add(head, &lck->list); dm_list_add(head, &lck->list);
} }
out: out:
pthread_cond_broadcast(&_lock_cond); /* to wakeup waiters */
pthread_mutex_unlock(&_lock_mutex); pthread_mutex_unlock(&_lock_mutex);
DEBUGLOG("Locked resource %s, lockid=%d, mode=%s\n", DEBUGLOG("Locked resource %s, lockid=%d, mode=%s\n",
resource, lck->lockid, _get_mode(lck->mode)); resource, lck->lockid, _get_mode(lck->mode));
return 0; return 0;
bad: bad:
pthread_cond_broadcast(&_lock_cond); /* to wakeup waiters */
pthread_mutex_unlock(&_lock_mutex); pthread_mutex_unlock(&_lock_mutex);
DEBUGLOG("Failed to lock resource %s\n", resource); DEBUGLOG("Failed to lock resource %s\n", resource);