bcachefs: six locks: Fix lost wakeup
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 14 Nov 2023 23:52:22 +0000 (18:52 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 15 Nov 2023 04:44:44 +0000 (23:44 -0500)
commit61b85cb0d773115d9a4b20c3e67286844cf73f34
treef7d611b4c3442a847f3461aaa895cafeca113946
parent62d73dfc44d54c97e0df6b947f0bccf6c4b8030e
bcachefs: six locks: Fix lost wakeup

In percpu reader mode, trylock() for read had a lost wakeup: on failure
to get the lock, we may have caused a writer to fail to get the lock,
because we temporarily elevated the reader count.

We need to check for waiters after decrementing the read count - not
before.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/six.c