Commit 852028af861ed6c7ab7e73053dd664eb28e55200
Committed by
Linus Torvalds
1 parent
2b3097a294
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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 <peter@hurleysoftware.com> Acked-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 4 additions and 10 deletions Side-by-side Diff
ipc/msg.c
... | ... | @@ -862,16 +862,8 @@ |
862 | 862 | walk_msg->m_type != 1) { |
863 | 863 | msgtyp = walk_msg->m_type - 1; |
864 | 864 | } else if (msgflg & MSG_COPY) { |
865 | - if (copy_number == msg_counter) { | |
866 | - /* | |
867 | - * Found requested message. | |
868 | - * Copy it. | |
869 | - */ | |
870 | - msg = copy_msg(msg, copy); | |
871 | - if (IS_ERR(msg)) | |
872 | - goto out_unlock; | |
865 | + if (copy_number == msg_counter) | |
873 | 866 | break; |
874 | - } | |
875 | 867 | msg = ERR_PTR(-EAGAIN); |
876 | 868 | } else |
877 | 869 | break; |
878 | 870 | |
... | ... | @@ -892,8 +884,10 @@ |
892 | 884 | * If we are copying, then do not unlink message and do |
893 | 885 | * not update queue parameters. |
894 | 886 | */ |
895 | - if (msgflg & MSG_COPY) | |
887 | + if (msgflg & MSG_COPY) { | |
888 | + msg = copy_msg(msg, copy); | |
896 | 889 | goto out_unlock; |
890 | + } | |
897 | 891 | list_del(&msg->m_list); |
898 | 892 | msq->q_qnum--; |
899 | 893 | msq->q_rtime = get_seconds(); |