mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: Dave Jones <davej@codemonkey.org.uk>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: 2.5.60 NFS FSX
Date: Thu, 13 Feb 2003 17:04:09 +0100	[thread overview]
Message-ID: <15947.49657.69111.510604@charged.uio.no> (raw)
In-Reply-To: <20030213155112.GA2070@codemonkey.org.uk>

>>>>> " " == Dave Jones <davej@codemonkey.org.uk> writes:

     > Last thing I spotted on a serial terminal was..

     > RPC: garbage, exit EIO

Right: that's what you would expect for corruption.

Was this by the way an SMP setup? If so, could you try the following
patch (based on a previous patch by Olaf Kirch) and that I sent to Linus
earlier today. It fixes an issue that could on occasion lead to some
pretty nasty corruption issues.

I don't think SMP can explain all the corruption issues though, as
I've also been seeing wierdness on my laptop.

Cheers,
  Trond

diff -u --recursive --new-file linux-2.5.60-00-fix_pipes/net/sunrpc/xprt.c linux-2.5.60-01-fix_xid/net/sunrpc/xprt.c
--- linux-2.5.60-00-fix_pipes/net/sunrpc/xprt.c	2003-01-12 22:39:48.000000000 +0100
+++ linux-2.5.60-01-fix_xid/net/sunrpc/xprt.c	2003-02-13 14:17:10.000000000 +0100
@@ -1273,25 +1273,41 @@
 }
 
 /*
+ * Allocate a 'unique' XID
+ */
+static u32
+xprt_alloc_xid(void)
+{
+	static spinlock_t xid_lock = SPIN_LOCK_UNLOCKED;
+	static int need_init = 1;
+	static u32 xid;
+	u32 ret;
+
+	spin_lock(&xid_lock);
+	if (unlikely(need_init)) {
+		xid = get_seconds() << 12;
+		need_init = 0;
+	}
+	ret = xid++;
+	spin_unlock(&xid_lock);
+	return ret;
+}
+
+/*
  * Initialize RPC request
  */
 static void
 xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt)
 {
 	struct rpc_rqst	*req = task->tk_rqstp;
-	static u32	xid = 0;
-
-	if (!xid)
-		xid = get_seconds() << 12;
 
-	dprintk("RPC: %4d reserved req %p xid %08x\n", task->tk_pid, req, xid);
 	req->rq_timeout = xprt->timeout;
 	req->rq_task	= task;
 	req->rq_xprt    = xprt;
-	req->rq_xid     = xid++;
-	if (!xid)
-		xid++;
+	req->rq_xid     = xprt_alloc_xid();
 	INIT_LIST_HEAD(&req->rq_list);
+	dprintk("RPC: %4d reserved req %p xid %08x\n", task->tk_pid,
+			req, req->rq_xid);
 }
 
 /*

  reply	other threads:[~2003-02-13 15:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-13 15:27 Dave Jones
2003-02-13 15:45 ` Trond Myklebust
2003-02-13 15:51   ` Dave Jones
2003-02-13 16:04     ` Trond Myklebust [this message]
2003-02-13 16:05       ` Dave Jones
2003-02-13 18:54 ` Joel Becker
2003-02-13 19:08   ` Trond Myklebust
2003-02-13 19:27     ` Dave Jones
     [not found]     ` <20030213204906.GA24109@codemonkey.org.uk>
2003-02-13 21:12       ` Trond Myklebust
2003-02-13 21:30         ` Dave Jones
2003-02-13 22:05         ` Dave Jones
2003-02-13 22:15         ` Dave Jones

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=15947.49657.69111.510604@charged.uio.no \
    --to=trond.myklebust@fys.uio.no \
    --cc=davej@codemonkey.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®