diff -urNp x-ref/net/sunrpc/xprt.c 2.4.20aa1/net/sunrpc/xprt.c --- x-ref/net/sunrpc/xprt.c 2002-11-29 02:23:23.000000000 +0100 +++ 2.4.20aa1/net/sunrpc/xprt.c 2002-12-02 18:44:33.000000000 +0100 @@ -1245,6 +1245,7 @@ static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt) { struct rpc_rqst *req = task->tk_rqstp; + static spinlock_t xid_lock = SPIN_LOCK_UNLOCKED; static u32 xid = 0; if (!xid) @@ -1255,9 +1256,15 @@ xprt_request_init(struct rpc_task *task, req->rq_timeout = xprt->timeout; req->rq_task = task; req->rq_xprt = xprt; + + /* We need to protect this counter with a spin lock, + * otherwise we may end up with two requests that have + * the same XID. --okir */ + spin_lock(&xid_lock); req->rq_xid = xid++; if (!xid) xid++; + spin_unlock(&xid_lock); INIT_LIST_HEAD(&req->rq_list); }