summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-05-25 18:10:04 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-08-14 12:28:33 -0400
commitec54bc7684c970d1d35d75e5932f8a76db4e0583 (patch)
tree37cdeb17328af263553d1d06bd7b01d3f19de299
parent22f435a40b5c287724d40c7b070486c14bc53d8d (diff)
six locks: Fix an unitialized var
In the conversion to atomic_t, six_lock_slowpath() ended up calling six_lock_wakeup() in the failure path with a state variable that was never initialized - whoops. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--fs/bcachefs/six.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/bcachefs/six.c b/fs/bcachefs/six.c
index 3c7ec20da9f8..e7a802629fb3 100644
--- a/fs/bcachefs/six.c
+++ b/fs/bcachefs/six.c
@@ -451,7 +451,6 @@ static int six_lock_slowpath(struct six_lock *lock, enum six_lock_type type,
six_lock_should_sleep_fn should_sleep_fn, void *p,
unsigned long ip)
{
- u32 old;
int ret = 0;
if (type == SIX_LOCK_write) {
@@ -527,7 +526,7 @@ static int six_lock_slowpath(struct six_lock *lock, enum six_lock_type type,
out:
if (ret && type == SIX_LOCK_write) {
six_clear_bitmask(lock, SIX_LOCK_HELD_write);
- six_lock_wakeup(lock, old, SIX_LOCK_read);
+ six_lock_wakeup(lock, atomic_read(&lock->state), SIX_LOCK_read);
}
return ret;