Skip to content

Commit

Permalink
SUNRPC: NFS_ROOT always uses the same XIDs
Browse files Browse the repository at this point in the history
The XID generator uses get_random_bytes to generate an initial XID.
NFS_ROOT starts up before the random driver, though, so get_random_bytes
doesn't set a random XID for NFS_ROOT.  This causes NFS_ROOT mount points
to reuse XIDs every time the client is booted.  If the client boots often
enough, the server will start serving old replies out of its DRC.

Use net_random() instead.

Test plan:
I/O intensive workloads should perform well and generate no errors.  Traces
taken during client reboots should show that NFS_ROOT mounts use unique
XIDs after every reboot.

Signed-off-by: Chuck Lever <cel@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Chuck Lever authored and Trond Myklebust committed Jun 9, 2006
1 parent b85d880 commit bf3fcf8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/sunrpc/xprt.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/workqueue.h>
#include <linux/random.h>
#include <linux/net.h>

#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/metrics.h>
Expand Down Expand Up @@ -830,7 +830,7 @@ static inline u32 xprt_alloc_xid(struct rpc_xprt *xprt)

static inline void xprt_init_xid(struct rpc_xprt *xprt)
{
get_random_bytes(&xprt->xid, sizeof(xprt->xid));
xprt->xid = net_random();
}

static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt)
Expand Down

0 comments on commit bf3fcf8

Please sign in to comment.