1
0
Fork 0
remarkable-linux/include
Chuck Lever 8c6ae4980e sunrpc: Allocate up to RPCSVC_MAXPAGES per svc_rqst
svcrdma needs 259 pages allocated to receive 1MB NFSv4.0 WRITE requests:

 - 1 page for the transport header and head iovec
 - 256 pages for the data payload
 - 1 page for the trailing GETATTR request (since NFSD XDR decoding
   does not look for a tail iovec, the GETATTR is stuck at the end
   of the rqstp->rq_arg.pages list)
 - 1 page for building the reply xdr_buf

But RPCSVC_MAXPAGES is already 259 (on x86_64). The problem is that
svc_alloc_arg never allocates that many pages. To address this:

1. The final element of rq_pages always points to NULL. To
   accommodate up to 259 pages in rq_pages, add an extra element
   to rq_pages for the array termination sentinel.

2. Adjust the calculation of "pages" to match how RPCSVC_MAXPAGES
   is calculated, so it can go up to 259. Bruce noted that the
   calculation assumes sv_max_mesg is a multiple of PAGE_SIZE,
   which might not always be true. I didn't change this assumption.

3. Change the loop boundaries to allow 259 pages to be allocated.

Additional clean-up: WARN_ON_ONCE adds an extra conditional branch,
which is basically never taken. And there's no need to dump the
stack here because svc_alloc_arg has only one caller.

Keeping that NULL "array termination sentinel"; there doesn't appear to
be any code that depends on it, only code in nfsd_splice_actor() which
needs the 259th element to be initialized to *something*.  So it's
possible we could just keep the array at 259 elements and drop that
final NULL, but we're being conservative for now.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
2017-07-12 15:54:55 -04:00
..
acpi More ACPI updates for v4.12-rc1 2017-05-10 09:35:42 -07:00
asm-generic Kbuild UAPI header export updates for v4.12 2017-05-10 20:45:36 -07:00
clocksource clocksource: arm_arch_timer: add structs to describe MMIO timer 2017-04-19 16:11:48 +01:00
crypto Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2017-05-03 08:50:52 -07:00
drm drm/dp: start a DPCD based DP sink/branch device quirk database 2017-05-29 13:43:26 +03:00
dt-bindings Sort of on the quieter side this time, which is probably due more 2017-05-10 13:38:18 -07:00
keys
kvm KVM: arm/arm64: Fix bug when registering redist iodevs 2017-05-18 11:18:12 +02:00
linux sunrpc: Allocate up to RPCSVC_MAXPAGES per svc_rqst 2017-07-12 15:54:55 -04:00
math-emu
media [media] cec: rename MEDIA_CEC_NOTIFIER to CEC_NOTIFIER 2017-06-04 15:23:35 -03:00
memory
misc
net net: Update TCP congestion control documentation 2017-06-05 10:53:24 -04:00
pcmcia
ras
rdma RDMA/SA: Fix kernel panic in CMA request handler flow 2017-06-01 17:20:14 -04:00
rxrpc
scsi Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2017-05-12 11:44:13 -07:00
soc powerpc updates for 4.12 part 2 2017-05-12 10:04:09 -07:00
sound ASoC: Updates for v4.12 2017-05-02 08:25:25 +02:00
target iscsi-target: Fix initial login PDU asynchronous socket close OOPs 2017-05-31 15:12:31 -07:00
trace Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux 2017-05-12 11:58:45 -07:00
uapi KEYS: DH: add __user annotations to keyctl_kdf_params 2017-06-09 13:29:49 +10:00
video uapi: export all headers under uapi directories 2017-05-11 00:21:54 +09:00
xen xen: Implement EFI reset_system callback 2017-05-02 12:06:50 +02:00