提交 941b0304 编写于 作者: L Linus Torvalds

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: NDavidlohr Bueso <davidlohr.bueso@hp.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 c728b9c8
...@@ -948,8 +948,8 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid, ...@@ -948,8 +948,8 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid,
memset(&tbuf, 0, sizeof(tbuf)); memset(&tbuf, 0, sizeof(tbuf));
if (cmd == SEM_STAT) {
rcu_read_lock(); rcu_read_lock();
if (cmd == SEM_STAT) {
sma = sem_obtain_object(ns, semid); sma = sem_obtain_object(ns, semid);
if (IS_ERR(sma)) { if (IS_ERR(sma)) {
err = PTR_ERR(sma); err = PTR_ERR(sma);
...@@ -957,7 +957,6 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid, ...@@ -957,7 +957,6 @@ static int semctl_nolock(struct ipc_namespace *ns, int semid,
} }
id = sma->sem_perm.id; id = sma->sem_perm.id;
} else { } else {
rcu_read_lock();
sma = sem_obtain_object_check(ns, semid); sma = sem_obtain_object_check(ns, semid);
if (IS_ERR(sma)) { if (IS_ERR(sma)) {
err = PTR_ERR(sma); err = PTR_ERR(sma);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册