public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mingming cao <cmm@us.ibm.com>
To: torvalds@transmeta.com, alan@lxorguk.ukuu.org.uk
Cc: linux-kernel@vger.kernel.org, manfreds@colorfullife.com
Subject: [PATCH]Fix bug in msgsnd
Date: Thu, 13 Sep 2001 10:07:25 -1000	[thread overview]
Message-ID: <3BA111FD.499BBF1D@us.ibm.com> (raw)

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);

             reply	other threads:[~2001-09-13 17:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-13 20:07 Mingming cao [this message]
2001-09-14  4:03 ` [PATCH]Fix bug in msgsnd BALBIR SINGH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3BA111FD.499BBF1D@us.ibm.com \
    --to=cmm@us.ibm.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfreds@colorfullife.com \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox