* [PATCH]Fix bug in msgsnd
@ 2001-09-13 20:07 Mingming cao
2001-09-14 4:03 ` BALBIR SINGH
0 siblings, 1 reply; 2+ messages in thread
From: Mingming cao @ 2001-09-13 20:07 UTC (permalink / raw)
To: torvalds, alan; +Cc: linux-kernel, manfreds
Hello linus & Alan,
This patch fixes a bug in msgsnd. If a message is sent via
pipelined_send(), the q_lrpid field of the associated message queue
(last pid receive) is not updated correctly. The existing code
(apparently by mistake) updates the lspid field instead. The second
problem is that, for the pipelinesend case, q_lstime(last msgsnd time)
is set AFTER q_lrtime(last msgrcv time), yielding a negative time delta.
This patch is against kernel 2.4.9 and has been tested. Please
apply.
Please CC your feedback to me also, thanks.
--
Mingming Cao
IBM Linux Technology Center
diff -urN -X dontdiff linux/ipc/msg.c linux-tk/ipc/msg.c
--- linux/ipc/msg.c Tue Sep 11 16:21:42 2001
+++ linux-tk/ipc/msg.c Tue Sep 11 16:21:31 2001
@@ -613,7 +613,7 @@
wake_up_process(msr->r_tsk);
} else {
msr->r_msg = msg;
- msq->q_lspid = msr->r_tsk->pid;
+ msq->q_lrpid = msr->r_tsk->pid;
msq->q_rtime = CURRENT_TIME;
wake_up_process(msr->r_tsk);
return 1;
@@ -683,6 +683,9 @@
goto retry;
}
+ msq->q_lspid = current->pid;
+ msq->q_stime = CURRENT_TIME;
+
if(!pipelined_send(msq,msg)) {
/* noone is waiting for this message, enqueue it */
list_add_tail(&msg->m_list,&msq->q_messages);
@@ -694,8 +697,6 @@
err = 0;
msg = NULL;
- msq->q_lspid = current->pid;
- msq->q_stime = CURRENT_TIME;
out_unlock_free:
msg_unlock(msqid);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH]Fix bug in msgsnd
2001-09-13 20:07 [PATCH]Fix bug in msgsnd Mingming cao
@ 2001-09-14 4:03 ` BALBIR SINGH
0 siblings, 0 replies; 2+ messages in thread
From: BALBIR SINGH @ 2001-09-14 4:03 UTC (permalink / raw)
To: Mingming cao, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2247 bytes --]
It would be nice, if you could send the test cases you used to test these
fixes or
their outputs before and after the fix, showing the problem and then the
problem
going away.
Thanks,
Balbir Singh.
Mingming cao wrote:
> Hello linus & Alan,
>
> This patch fixes a bug in msgsnd. If a message is sent via
> pipelined_send(), the q_lrpid field of the associated message queue
> (last pid receive) is not updated correctly. The existing code
> (apparently by mistake) updates the lspid field instead. The second
> problem is that, for the pipelinesend case, q_lstime(last msgsnd time)
> is set AFTER q_lrtime(last msgrcv time), yielding a negative time delta.
>
> This patch is against kernel 2.4.9 and has been tested. Please
> apply.
>
> Please CC your feedback to me also, thanks.
>
> --
> Mingming Cao
> IBM Linux Technology Center
>
> diff -urN -X dontdiff linux/ipc/msg.c linux-tk/ipc/msg.c
> --- linux/ipc/msg.c Tue Sep 11 16:21:42 2001
> +++ linux-tk/ipc/msg.c Tue Sep 11 16:21:31 2001
> @@ -613,7 +613,7 @@
> wake_up_process(msr->r_tsk);
> } else {
> msr->r_msg = msg;
> - msq->q_lspid = msr->r_tsk->pid;
> + msq->q_lrpid = msr->r_tsk->pid;
> msq->q_rtime = CURRENT_TIME;
> wake_up_process(msr->r_tsk);
> return 1;
> @@ -683,6 +683,9 @@
> goto retry;
> }
>
> + msq->q_lspid = current->pid;
> + msq->q_stime = CURRENT_TIME;
> +
> if(!pipelined_send(msq,msg)) {
> /* noone is waiting for this message, enqueue it */
> list_add_tail(&msg->m_list,&msq->q_messages);
> @@ -694,8 +697,6 @@
>
> err = 0;
> msg = NULL;
> - msq->q_lspid = current->pid;
> - msq->q_stime = CURRENT_TIME;
>
> out_unlock_free:
> msg_unlock(msqid);
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
[-- Attachment #2: InterScan_Disclaimer.txt --]
[-- Type: text/plain, Size: 855 bytes --]
-------------------------------------------------------------------------------------------------------------------------
Information transmitted by this E-MAIL is proprietary to Wipro and/or its Customers and
is intended for use only by the individual or entity to which it is
addressed, and may contain information that is privileged, confidential or
exempt from disclosure under applicable law. If you are not the intended
recipient or it appears that this mail has been forwarded to you without
proper authority, you are notified that any use or dissemination of this
information in any manner is strictly prohibited. In such cases, please
notify us immediately at mailto:mailadmin@wipro.com and delete this mail
from your records.
----------------------------------------------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-09-14 4:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-09-13 20:07 [PATCH]Fix bug in msgsnd Mingming cao
2001-09-14 4:03 ` BALBIR SINGH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox