Commit 4b5b13da authored by Kent Overstreet's avatar Kent Overstreet

six locks: be more careful about lost wakeups

This is a workaround for a lost wakeup bug we've been seeing - we still
need to discover the actual bug.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 2640faeb
...@@ -142,8 +142,17 @@ static int __do_six_trylock_type(struct six_lock *lock, ...@@ -142,8 +142,17 @@ static int __do_six_trylock_type(struct six_lock *lock,
* lock, issue a wakeup because we might have caused a * lock, issue a wakeup because we might have caused a
* spurious trylock failure: * spurious trylock failure:
*/ */
#if 0
/*
* This code should be sufficient, but we're seeing unexplained
* lost wakeups:
*/
if (old.write_locking) if (old.write_locking)
ret = -1 - SIX_LOCK_write; ret = -1 - SIX_LOCK_write;
#else
if (!ret)
ret = -1 - SIX_LOCK_write;
#endif
} else if (type == SIX_LOCK_write && lock->readers) { } else if (type == SIX_LOCK_write && lock->readers) {
if (try) { if (try) {
atomic64_add(__SIX_VAL(write_locking, 1), atomic64_add(__SIX_VAL(write_locking, 1),
...@@ -319,11 +328,10 @@ static bool __six_relock_type(struct six_lock *lock, enum six_lock_type type, ...@@ -319,11 +328,10 @@ static bool __six_relock_type(struct six_lock *lock, enum six_lock_type type,
* Similar to the lock path, we may have caused a spurious write * Similar to the lock path, we may have caused a spurious write
* lock fail and need to issue a wakeup: * lock fail and need to issue a wakeup:
*/ */
if (old.write_locking)
six_lock_wakeup(lock, old, SIX_LOCK_write);
if (ret) if (ret)
six_acquire(&lock->dep_map, 1, type == SIX_LOCK_read, ip); six_acquire(&lock->dep_map, 1, type == SIX_LOCK_read, ip);
else
six_lock_wakeup(lock, old, SIX_LOCK_write);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment