]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ipc: remove msg handling from queue scan
authorPeter Hurley <peter@hurleysoftware.com>
Wed, 20 Mar 2013 04:08:40 +0000 (15:08 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 21 Mar 2013 05:34:30 +0000 (16:34 +1100)
In preparation for refactoring the queue scan into a separate
function, relocate msg copying.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Acked-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
ipc/msg.c

index 31cd1bf6af271771e67bdf6e29eb306371d3d130..e8d3f15ada165c68e597b06b6d18923052a05513 100644 (file)
--- 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;
-                                       }
                                } else
                                        break;
                                msg_counter++;
@@ -891,8 +883,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();