diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-03-06 07:57:51 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:56 -0400 |
commit | 4b5b13da527b1ce02ee9a96382684496e8d83696 (patch) | |
tree | e2d88039f1f667f59140387e15e3f5f901efdf60 /fs/bcachefs/six.c | |
parent | 2640faeb1741db94b717d2678f6cd644f90e3061 (diff) | |
download | linux-4b5b13da527b1ce02ee9a96382684496e8d83696.tar.gz linux-4b5b13da527b1ce02ee9a96382684496e8d83696.tar.bz2 linux-4b5b13da527b1ce02ee9a96382684496e8d83696.zip |
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: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/six.c')
-rw-r--r-- | fs/bcachefs/six.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/bcachefs/six.c b/fs/bcachefs/six.c index e1e9df0368b6..b54a2ac480c8 100644 --- a/fs/bcachefs/six.c +++ b/fs/bcachefs/six.c @@ -142,8 +142,17 @@ static int __do_six_trylock_type(struct six_lock *lock, * lock, issue a wakeup because we might have caused a * spurious trylock failure: */ +#if 0 + /* + * This code should be sufficient, but we're seeing unexplained + * lost wakeups: + */ if (old.write_locking) ret = -1 - SIX_LOCK_write; +#else + if (!ret) + ret = -1 - SIX_LOCK_write; +#endif } else if (type == SIX_LOCK_write && lock->readers) { if (try) { 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, * Similar to the lock path, we may have caused a spurious write * lock fail and need to issue a wakeup: */ - if (old.write_locking) - six_lock_wakeup(lock, old, SIX_LOCK_write); - if (ret) six_acquire(&lock->dep_map, 1, type == SIX_LOCK_read, ip); + else + six_lock_wakeup(lock, old, SIX_LOCK_write); return ret; } |