aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hurley <[email protected]>2013-04-30 19:14:48 -0700
committerLinus Torvalds <[email protected]>2013-05-01 08:12:57 -0700
commit852028af861ed6c7ab7e73053dd664eb28e55200 (patch)
tree1b3be153ff8d0f9d25e20417a1edc34659cbf88a
parent2b3097a294b6daaf390010de14ca50bfccbc6fb6 (diff)
ipc: remove msg handling from queue scan
In preparation for refactoring the queue scan into a separate function, relocate msg copying. Signed-off-by: Peter Hurley <[email protected]> Acked-by: Stanislav Kinsbursky <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--ipc/msg.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/ipc/msg.c b/ipc/msg.c
index fede1d06ef30..b46473074662 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -862,16 +862,8 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp,
walk_msg->m_type != 1) {
msgtyp = walk_msg->m_type - 1;
} else if (msgflg & MSG_COPY) {
- if (copy_number == msg_counter) {
- /*
- * Found requested message.
- * Copy it.
- */
- msg = copy_msg(msg, copy);
- if (IS_ERR(msg))
- goto out_unlock;
+ if (copy_number == msg_counter)
break;
- }
msg = ERR_PTR(-EAGAIN);
} else
break;
@@ -892,8 +884,10 @@ long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long msgtyp,
* If we are copying, then do not unlink message and do
* not update queue parameters.
*/
- if (msgflg & MSG_COPY)
+ if (msgflg & MSG_COPY) {
+ msg = copy_msg(msg, copy);
goto out_unlock;
+ }
list_del(&msg->m_list);
msq->q_qnum--;
msq->q_rtime = get_seconds();