linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	NFS devel <nfs-devel@linux.kernel.org>
Subject: Spinlocking patch for in xprt.c
Date: Fri, 12 Jan 2001 13:45:07 +0100 (CET)	[thread overview]
Message-ID: <14942.64595.157544.350302@charged.uio.no> (raw)


The following patch (taken from the zero copy networking) upgrades the
spinlocking of the xprt_(up|down)_transmit() 'semaphores' in order to
work safely with the networking bottom halves. Several of the latter
(cf. xprt.c:tcp_write_space() & friends) do want to test the value of
'xprt->snd_task'.

Cheers,
  Trond

diff -u --recursive --new-file linux-2.4.1-fh_align/net/sunrpc/xprt.c linux-2.4.1-xprt/net/sunrpc/xprt.c
--- linux-2.4.1-fh_align/net/sunrpc/xprt.c	Wed Nov 29 07:34:01 2000
+++ linux-2.4.1-xprt/net/sunrpc/xprt.c	Fri Jan 12 11:58:42 2001
@@ -1116,7 +1116,7 @@
 	struct rpc_xprt *xprt = task->tk_rqstp->rq_xprt;
 	struct rpc_rqst	*req = task->tk_rqstp;
 
-	spin_lock(&xprt_lock);
+	spin_lock_bh(&xprt_sock_lock);
 	if (xprt->snd_task && xprt->snd_task != task) {
 		dprintk("RPC: %4d TCP write queue full (task %d)\n",
 			task->tk_pid, xprt->snd_task->tk_pid);
@@ -1130,7 +1130,7 @@
 #endif
 		req->rq_bytes_sent = 0;
 	}
-	spin_unlock(&xprt_lock);
+	spin_unlock_bh(&xprt_sock_lock);
 	return xprt->snd_task == task;
 }
 
@@ -1143,10 +1143,10 @@
 	struct rpc_xprt *xprt = task->tk_rqstp->rq_xprt;
 
 	if (xprt->snd_task && xprt->snd_task == task) {
-		spin_lock(&xprt_lock);
+		spin_lock_bh(&xprt_sock_lock);
 		xprt->snd_task = NULL;
 		rpc_wake_up_next(&xprt->sending);
-		spin_unlock(&xprt_lock);
+		spin_unlock_bh(&xprt_sock_lock);
 	}
 }
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

             reply	other threads:[~2001-01-12 12:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-12 12:45 Trond Myklebust [this message]
2001-01-13 23:10 ` Spinlocking patch for in xprt.c David S. Miller
2001-01-14 18:45   ` Trond Myklebust

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=14942.64595.157544.350302@charged.uio.no \
    --to=trond.myklebust@fys.uio.no \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nfs-devel@linux.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).