diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-04 14:04:29 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-04 20:24:59 -0400 |
commit | 941b0304a74b240c607ff098401fd4ef70c9d1cc (patch) | |
tree | 92cb88d1851360c5e890b7daf737b264cf3181de | |
parent | c728b9c87b59fb943c4cba0552d38152787a4ab6 (diff) |
ipc: simplify rcu_read_lock() in semctl_nolock()
This trivially combines two rcu_read_lock() calls in both sides of a
if-statement into one single one in front of the if-statement.
Split out as an independent cleanup from the previous commit.
Acked-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>
-rw-r--r-- | ipc/sem.c | 3 |
1 files changed, 1 insertions, 2 deletions
@@ -948,8 +948,8 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid, | |||
948 | 948 | ||
949 | memset(&tbuf, 0, sizeof(tbuf)); | 949 | memset(&tbuf, 0, sizeof(tbuf)); |
950 | 950 | ||
951 | rcu_read_lock(); | ||
951 | if (cmd == SEM_STAT) { | 952 | if (cmd == SEM_STAT) { |
952 | rcu_read_lock(); | ||
953 | sma = sem_obtain_object(ns, semid); | 953 | sma = sem_obtain_object(ns, semid); |
954 | if (IS_ERR(sma)) { | 954 | if (IS_ERR(sma)) { |
955 | err = PTR_ERR(sma); | 955 | err = PTR_ERR(sma); |
@@ -957,7 +957,6 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid, | |||
957 | } | 957 | } |
958 | id = sma->sem_perm.id; | 958 | id = sma->sem_perm.id; |
959 | } else { | 959 | } else { |
960 | rcu_read_lock(); | ||
961 | sma = sem_obtain_object_check(ns, semid); | 960 | sma = sem_obtain_object_check(ns, semid); |
962 | if (IS_ERR(sma)) { | 961 | if (IS_ERR(sma)) { |
963 | err = PTR_ERR(sma); | 962 | err = PTR_ERR(sma); |