Re: Bugs in NFS client in Linux 2.2.3 - I need your help to debug it.

Trond Myklebust (trond.myklebust@fys.uio.no)
12 Mar 1999 21:16:27 +0100


Trond Myklebust <trond.myklebust@fys.uio.no> writes:

> If so, the following patch may help. I must however admit, I'd be very
> surprised if it really is this bug that is causing your problem, as the
> likelihood of it occurring is low unless 'jiffies' takes some very
> large value...

Or unless you reboot very often, since the fact that 'xid' is
initialized from 'jiffies' will tend to bias it to low values that
repeat themselves after every reboot. The following patch will fix
that bias, and ensure that xids don't repeat themselves very often...

Cheers,
Trond

--- linux-2.2.2/net/sunrpc/xprt.c Wed Jan 20 22:44:53 1999
+++ linux/net/sunrpc/xprt.c Fri Mar 12 19:55:28 1999
@@ -46,6 +46,7 @@
#include <linux/malloc.h>
#include <linux/sched.h>
#include <linux/errno.h>
+#include <linux/random.h>
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/net.h>
@@ -1197,7 +1198,7 @@
static u32 xid = 0;

if (!xid)
- xid = jiffies;
+ get_random_bytes(&xid, sizeof(xid));

dprintk("RPC: %4d reserved req %p xid %08x\n", task->tk_pid, req, xid);
task->tk_status = 0;
@@ -1206,6 +1207,8 @@
req->rq_task = task;
req->rq_xprt = xprt;
req->rq_xid = xid++;
+ if (!xid)
+ xid++;
}

/*

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/