linux/net/sunrpc
Tom Tucker c8237a5fce SVCRDMA: Check num_sge when setting LAST_CTXT bit
The RDMACTXT_F_LAST_CTXT bit was getting set incorrectly
when the last chunk in the read-list spanned multiple pages. This
resulted in a kernel panic when the wrong context was used to
build the RPC iovec page list.

RDMA_READ is used to fetch RPC data from the client for
NFS_WRITE requests. A scatter-gather is used to map the
advertised client side buffer to the server-side iovec and
associated page list.

WR contexts are used to convey which scatter-gather entries are
handled by each WR. When the write data is large, a single RPC may
require multiple RDMA_READ requests so the contexts for a single RPC
are chained together in a linked list. The last context in this list
is marked with a bit RDMACTXT_F_LAST_CTXT so that when this WR completes,
the CQ handler code can enqueue the RPC for processing.

The code in rdma_read_xdr was setting this bit on the last two
contexts on this list when the last read-list chunk spanned multiple
pages. This caused the svc_rdma_recvfrom logic to incorrectly build
the RPC and caused the kernel to crash because the second-to-last
context doesn't contain the iovec page list.

Modified the condition that sets this bit so that it correctly detects
the last context for the RPC.

Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
Tested-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-03-26 11:24:19 -07:00
..
auth_gss [SUNRPC]: net/* NULL noise 2008-03-17 22:48:03 -07:00
xprtrdma SVCRDMA: Check num_sge when setting LAST_CTXT bit 2008-03-26 11:24:19 -07:00
auth_null.c
auth_unix.c
auth.c Merge branch 'task_killable' of git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc 2008-02-01 11:45:47 +11:00
cache.c [SUNRPC]: Use proc_create() to setup ->proc_fops first 2008-02-28 14:00:59 -08:00
clnt.c docbook: sunrpc filenames and notation fixes 2008-02-13 16:21:19 -08:00
Makefile svc: Add an svc transport class 2008-02-01 16:42:07 -05:00
rpc_pipe.c Introduce path_put() 2008-02-14 21:13:33 -08:00
rpcb_clnt.c Merge branch 'task_killable' of git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc 2008-02-01 11:45:47 +11:00
sched.c Merge branch 'task_killable' of git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc 2008-02-01 11:45:47 +11:00
socklib.c
stats.c [SUNRPC]: Use proc_create() to setup ->proc_fops first 2008-02-28 14:00:59 -08:00
sunrpc_syms.c SUNRPC: Move exported symbol definitions after function declaration part 2 2008-02-01 17:01:24 -05:00
svc_xprt.c [NET] endianness noise: INADDR_ANY 2008-03-17 22:44:53 -07:00
svc.c SUNRPC: RPC program information is stored in unsigned integers 2008-02-01 17:01:31 -05:00
svcauth_unix.c SUNRPC: Move exported symbol definitions after function declaration part 2 2008-02-01 17:01:24 -05:00
svcauth.c SUNRPC: Move exported symbol definitions after function declaration part 2 2008-02-01 17:01:24 -05:00
svcsock.c Wrap buffers used for rpc debug printks into RPC_IFDEBUG 2008-02-21 18:42:29 -05:00
sysctl.c svc: Add /proc/sys/sunrpc/transport files 2008-02-01 16:42:13 -05:00
timer.c
xdr.c SUNRPC: Use unsigned string lengths in xdr_decode_string_inplace 2008-02-01 16:42:02 -05:00
xprt.c docbook: sunrpc filenames and notation fixes 2008-02-13 16:21:19 -08:00
xprtsock.c