Skip to contentSkip to conversation

nfs4 over rdma transport oops

DISCUSSION Talpey, Thomas 2 participants 3 messages Feb 27, 2008 – Feb 28, 2008 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Shirish, can you try the following patch and see if it allows you to avoid increasing the inline read/write sizes?

The problem is that in the case where RPC large-metadata operations overflow the buffer, the reallocated req->rl_buffer pointer is overloaded to hold the pointer to the old rpcrdma_req, since we had to reallocate it. So the container_of() calculation in xprt_rdma_free() backs up to garbage not an r_xprt. Then, the switch(ia_memreg_strategy) in the deregistration code looks at garbage and decides to ib_dereg_mr. Oops.

The better fix is a little more involved (remove the overloading), but this one should nail the issue. Let us know! If it works, we can submit it to Trond for inclusion asap.

Tom.

------

Author: Tom Talpey <[email protected]>
Date:   Wed Feb 27 15:04:26 2008 -0500

Prevent an RPC oops when freeing a dynamically allocated RDMA buffer, used in certain special-case large metadata operations.

net/sunrpc/xprtrdma/transport.c +5 -1
Index: linux-2.6.25-rc3/net/sunrpc/xprtrdma/transport.c
===================================================================
@@ -610,7 +610,11 @@
 		return;
 
 	req = container_of(buffer, struct rpcrdma_req, rl_xdr_buf[0]);
-	r_xprt = container_of(req->rl_buffer, struct rpcrdma_xprt, rx_buf);
+	if (req->rl_iov.length == 0) {	/* see allocate above */
+		r_xprt = container_of(((struct rpcrdma_req *) req->rl_buffer)->rl_buffer, 
+				      struct rpcrdma_xprt, rx_buf);
+	} else
+		r_xprt = container_of(req->rl_buffer, struct rpcrdma_xprt, rx_buf);
 	rep = req->rl_reply;
 
 	dprintk("RPC:       %s: called on 0x%p%s\n",

A message that is not in the archive (sent off-list or not yet received): EXNANE01nwpGR881Np7000000e3-kboziUmgGqYSZCGxjG3uujkOHZLvdrmu@public.gmane.org

#2 lore raw
Quoted 36 lines · Thomas

Shirish, can you try the following patch and see if it allows you to avoid increasing the inline read/write sizes?

The problem is that in the case where RPC large-metadata operations overflow the buffer, the reallocated req->rl_buffer pointer is overloaded to hold the pointer to the old rpcrdma_req, since we had to reallocate it. So the container_of() calculation in xprt_rdma_free() backs up to garbage not an r_xprt. Then, the switch(ia_memreg_strategy) in the deregistration code looks at garbage and decides to ib_dereg_mr. Oops.

The better fix is a little more involved (remove the overloading), but this one should nail the issue. Let us know! If it works, we can submit it to Trond for inclusion asap.

Tom.

------

Author: Tom Talpey <[email protected]>
Date:   Wed Feb 27 15:04:26 2008 -0500

Prevent an RPC oops when freeing a dynamically allocated RDMA buffer, used in certain special-case large metadata operations.

Index: linux-2.6.25-rc3/net/sunrpc/xprtrdma/transport.c
===================================================================

net/sunrpc/xprtrdma/transport.c +0 -0
@@ -610,7 +610,11 @@
               return;
 

net/sunrpc/xprtrdma/transport.c line 620

Quoted 10 lines
net/sunrpc/xprtrdma/transport.c +5 -1
       req = container_of(buffer, struct rpcrdma_req, rl_xdr_buf[0]);
-       r_xprt = container_of(req->rl_buffer, struct rpcrdma_xprt, rx_buf);
+       if (req->rl_iov.length == 0) {  /* see allocate above */
+               r_xprt = container_of(((struct rpcrdma_req *) req->rl_buffer)->rl_buffer,
+                                     struct rpcrdma_xprt, rx_buf);
+       } else
+               r_xprt = container_of(req->rl_buffer, struct rpcrdma_xprt, rx_buf);
       rep = req->rl_reply;
 
       dprintk("RPC:       %s: called on 0x%p%s\n",

Tom,

The code fix works. I did not apply the workaround you had mentioned earlier and did not encounter oops for the same operation (cat) on the file on the mounted filesystem.

A message that is not in the archive (sent off-list or not yet received): 4a4634330802272049xe20ef80y21c2c59f55932c70-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw
Quoted 3 lines · Shirish Pargaonkar

The code fix works. I did not apply the workaround you had mentioned earlier and did not encounter oops for the same operation (cat) on the file on the mounted filesystem.

Great! I'll send it along to Trond then.

If you have a chance after running for a while on an RDMA mount point, I'd be interested in the output of Chuck's "mountstats" python script, which can extract some of the rdma operation statistics from the rpc/rdma code. The "hardway" statistic is the one I'm especially interested in, in your NFSv4 case. You can get it at:

	http://oss.oracle.com/~cel/linux-2.6/2.6.24/mountstats

There is also another script there which shows some very interesting timing and other performance data, which I recommend:

	http://oss.oracle.com/~cel/linux-2.6/2.6.24/nfs-iostat

Thanks,

Tom.