diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-03 15:04:40 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-04 11:24:00 -0700 |
commit | 6d49dab8ae06c6d35a4d0967364a9ecbe8fdea2c (patch) | |
tree | 7f28ea59e2c52d912faf696d38e9577ffb1c29c3 /fs | |
parent | ce857229e0c3adc211944a13a5579ef84fd7b4af (diff) | |
download | linux-stable-6d49dab8ae06c6d35a4d0967364a9ecbe8fdea2c.tar.gz linux-stable-6d49dab8ae06c6d35a4d0967364a9ecbe8fdea2c.tar.bz2 linux-stable-6d49dab8ae06c6d35a4d0967364a9ecbe8fdea2c.zip |
ipc: move rcu_read_unlock() out of sem_unlock() and into callers
The IPC locking is a mess, and sem_unlock() unlocks not only the
semaphore spinlock, it also drops the rcu read lock. Unlike sem_lock(),
which just gets the spin-lock, and expects the caller to get the rcu
read lock.
This all makes things very hard to follow, and it's very confusing when
you take the rcu read lock in one function, and then release it in
another. And it has caused actual bugs: the sem_obtain_lock() function
ended up dropping the RCU read lock twice in one error path, because it
first did the sem_unlock(), and then did a rcu_read_unlock() to match
the rcu_read_lock() it had done.
This is just a totally mindless "remove rcu_read_unlock() from
sem_unlock() and add it immediately after each caller" (except for the
aforementioned bug where we did too many rcu_read_unlock(), and in
find_alloc_undo() where we just got the rcu_read_lock() to correct for
the fact that sem_unlock would immediately drop it again).
We can (and should) clean things up further, but this fixes the bug with
the minimal amount of subtlety.
Reviewed-by: Davidlohr Bueso <davidlohr.bueso@hp.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
0 files changed, 0 insertions, 0 deletions