History

SUNRPC: Fix NFSD's request deferral on RDMA transports

Trond Myklebust reports an NFSD crash in svc_rdma_sendto(). Further investigation shows that the crash occurred while NFSD was handling a deferred request. This patch addresses two inter-related issues that prevent request deferral from working correctly for RPC/RDMA requests: 1. Prevent the crash by ensuring that the original svc_rqst::rq_xprt_ctxt value is available when the request is revisited. Otherwise svc_rdma_sendto() does not have a Receive context available with which to construct its reply. 2. Possibly since before commit 71641d99ce03 ("svcrdma: Properly compute .len and .buflen for received RPC Calls"), svc_rdma_recvfrom() did not include the transport header in the returned xdr_buf. There should have been no need for svc_defer() and friends to save and restore that header, as of that commit. This issue is addressed in a backport-friendly way by simply having svc_rdma_recvfrom() set rq_xprt_hlen to zero unconditionally, just as svc_tcp_recvfrom() does. This enables svc_deferred_recv() to correctly reconstruct an RPC message received via RPC/RDMA.

Chuck Lever committed 4 years ago

Commit 773f91b1 parent 99939793 files · +5 −1Browse files

Showing the changes to include (1 of 3 files). Show all

Unified · Split

include/linux/sunrpc/svc.h+1−0
@@ -395,6 +395,7 @@ struct svc_deferred_req { · 394 unmodified lines
395 size_t addrlen;395 size_t addrlen;
396 struct sockaddr_storage daddr; /* where reply must come from */396 struct sockaddr_storage daddr; /* where reply must come from */
397 size_t daddrlen;397 size_t daddrlen;
398 void *xprt_ctxt;
398 struct cache_deferred_req handle;399 struct cache_deferred_req handle;
399 size_t xprt_hlen;400 size_t xprt_hlen;
400 int argslen;401 int argslen;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t