diff options
author | dormando <dormando@rydia.net> | 2018-01-23 22:15:35 -0800 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2018-01-23 22:15:35 -0800 |
commit | 2918d09c93b572660e7c47935409e8d93efba094 (patch) | |
tree | 41f13ed72ead1b337f8b0eaa9a19347a40ab2c16 /slabs.c | |
parent | 31d8e62d298f265cfdb716c3f0ca0492f1554d47 (diff) | |
download | memcached-2918d09c93b572660e7c47935409e8d93efba094.tar.gz |
quick fix for slab mover deadlock
this fix may be replaced with a better restructuring; as this was done more
properly in the result handler code below. Not releasing the slab lock while
unlinking can cause a deadlock:
item A unlinks, which locks LRU, then tries to lock SLAB
page mover locks SLAB, locks item B, tries to unlink item B
if done after A locks LRU, it deadlocks while B tries to lock LRU.
doh :/
Diffstat (limited to 'slabs.c')
-rw-r--r-- | slabs.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -862,7 +862,9 @@ static int slab_rebalance_move(void) { // Only safe to hold slabs lock because refcount // can't drop to 0 until we release item lock. STORAGE_delete(storage, it); + pthread_mutex_unlock(&slabs_lock); do_item_unlink(it, hv); + pthread_mutex_lock(&slabs_lock); } status = MOVE_BUSY; } else { |