diff options
author | davide <davide@FreeBSD.org> | 2013-09-22 14:09:07 +0000 |
---|---|---|
committer | davide <davide@FreeBSD.org> | 2013-09-22 14:09:07 +0000 |
commit | 30f0365ae9f2024c5ae68ffcb5370d12d1facc13 (patch) | |
tree | 3ccb159f2a34373ecfd9941d76d59a4e3c4b443d /sys/kern/kern_sx.c | |
parent | 12fb397079ae31a26be56507235df63d4f0ef5a3 (diff) | |
download | FreeBSD-src-30f0365ae9f2024c5ae68ffcb5370d12d1facc13.zip FreeBSD-src-30f0365ae9f2024c5ae68ffcb5370d12d1facc13.tar.gz |
Consistently use the same value to indicate exclusively-held and
shared-held locks for all the primitives in lc_lock/lc_unlock routines.
This fixes the problems introduced in r255747, which indeed introduced an
inversion in the logic.
Reported by: many
Tested by: bdrewery, pho, lme, Adam McDougall, O. Hartmann
Approved by: re (glebius)
Diffstat (limited to 'sys/kern/kern_sx.c')
-rw-r--r-- | sys/kern/kern_sx.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c index fd9a51f..a1fc36a 100644 --- a/sys/kern/kern_sx.c +++ b/sys/kern/kern_sx.c @@ -162,9 +162,9 @@ lock_sx(struct lock_object *lock, uintptr_t how) sx = (struct sx *)lock; if (how) - sx_xlock(sx); - else sx_slock(sx); + else + sx_xlock(sx); } uintptr_t @@ -176,10 +176,10 @@ unlock_sx(struct lock_object *lock) sx_assert(sx, SA_LOCKED | SA_NOTRECURSED); if (sx_xlocked(sx)) { sx_xunlock(sx); - return (1); + return (0); } else { sx_sunlock(sx); - return (0); + return (1); } } |