aboutsummaryrefslogtreecommitdiff
path: root/fs/bcachefs/six.c
diff options
context:
space:
mode:
authorGravatar Kent Overstreet <kent.overstreet@linux.dev> 2023-05-25 18:10:04 -0400
committerGravatar Kent Overstreet <kent.overstreet@linux.dev> 2023-10-22 17:10:02 -0400
commitc4687a4a7536c3b2139faa63e66afd1d3da5bf15 (patch)
treef79218272fa1678dbce9404758c706093668da0f /fs/bcachefs/six.c
parentsix locks: Delete redundant comment (diff)
downloadlinux-c4687a4a7536c3b2139faa63e66afd1d3da5bf15.tar.gz
linux-c4687a4a7536c3b2139faa63e66afd1d3da5bf15.tar.bz2
linux-c4687a4a7536c3b2139faa63e66afd1d3da5bf15.zip
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>
Diffstat (limited to 'fs/bcachefs/six.c')
-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 fa508ab2108c..9a5fcd7d3566 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;