bcachefs: six locks: Fix missing barrier on wait->lock_acquired
authorKent Overstreet <kent.overstreet@linux.dev>
Sat, 12 Aug 2023 19:05:06 +0000 (15:05 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:10:10 +0000 (17:10 -0400)
commitc294ea50da4b1a0ee84253f46391aa87a6efe91c
tree681f242bac712ffaf718ffb54012b5b7c23e9d8c
parentc036359197705e5b133b30154771c3ebad5698b0
bcachefs: six locks: Fix missing barrier on wait->lock_acquired

Six locks do lock handoff via the wakeup path: the thread doing the
wakeup also takes the lock on behalf of the waiter, which means the
waiter only has to look at its waitlist entry, and doesn't have to touch
the lock cacheline while another thread is using it.

Linus noticed that this needs a real barrier, which this patch fixes.

Also add a comment for the should_sleep_fn() error path.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: linux-bcachefs@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
fs/bcachefs/six.c