alistair23-linux/net/sunrpc
NeilBrown 743c69e7c0 sunrpc: translate -EAGAIN to -ENOBUFS when socket is writable.
The networking layer does not reliably report the distinction between
a non-block write failing because:
 1/ the queue is too full already and
 2/ a memory allocation attempt failed.

The distinction is important because in the first case it is
appropriate to retry as soon as the socket reports that it is
writable, and in the second case a small delay is required as the
socket will most likely report as writable but kmalloc could still
fail.

sk_stream_wait_memory() exhibits this distinction nicely, setting
'vm_wait' if a small wait is needed.  However in the non-blocking case
it always returns -EAGAIN no matter the cause of the failure.  This
-EAGAIN call get all the way to sunrpc.

The sunrpc layer expects EAGAIN to indicate the first cause, and
ENOBUFS to indicate the second.  Various documentation suggests that
this is not unreasonable, but does not guarantee the desired error
codes.

The result of getting -EAGAIN when -ENOBUFS is expected is that the
send is tried again in a tight loop and soft lockups are reported.

so: add tests after calls to xs_sendpages() to translate -EAGAIN into
-ENOBUFS if the socket is writable.  This cannot happen inside
xs_sendpages() as the test for "is socket writable" is different
between TCP and UDP.

With this change, the tight loop retrying xs_sendpages() becomes a
loop which only retries every 250ms, and so will not trigger a
soft-lockup warning.

It is possible that the write did fail because the queue was too full
and by the time xs_sendpages() completed, the queue was writable
again.  In this case an extra 250ms delay is inserted that isn't
really needed.  This circumstance suggests a degree of congestion so a
delay is not necessarily a bad thing, and it can only cause a single
250ms delay, not a series of them.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
2015-07-27 11:16:56 -04:00
..
auth_gss sunrpc: use sg_init_one() in krb5_rc4_setup_enc/seq_key() 2015-06-18 08:58:38 -04:00
xprtrdma NFS: NFSoRDMA Client Changes 2015-06-16 11:37:50 -04:00
addr.c
auth.c sunrpc: eliminate RPC_DEBUG 2014-11-24 17:31:46 -05:00
auth_generic.c sunrpc: eliminate RPC_DEBUG 2014-11-24 17:31:46 -05:00
auth_null.c sunrpc: eliminate RPC_DEBUG 2014-11-24 17:31:46 -05:00
auth_unix.c sunrpc: eliminate RPC_DEBUG 2014-11-24 17:31:46 -05:00
backchannel_rqst.c SUNRPC: xprt_complete_bc_request must also decrement the free slot count 2015-07-22 17:10:50 -04:00
cache.c lib/string_helpers.c: change semantics of string_escape_mem 2015-04-15 16:35:24 -07:00
clnt.c SUNRPC: Don't reencode message if transmission failed with ENOBUFS 2015-07-03 09:42:12 -04:00
debugfs.c SUNRPC: Address kbuild warning in net/sunrpc/debugfs.c 2015-06-11 14:01:06 -04:00
Kconfig kernel: conditionally support non-root users, groups and capabilities 2015-04-15 16:35:22 -07:00
Makefile SUNRPC: Clean up bc_send() 2015-06-02 13:30:35 -04:00
netns.h
rpc_pipe.c VFS: net/: d_inode() annotations 2015-04-15 15:06:56 -04:00
rpcb_clnt.c SUNRPC: NULL utsname dereference on NFS umount during namespace cleanup 2015-02-03 16:40:17 -05:00
sched.c SUNRPC: fix build-warning due to format missmatch 2015-03-13 09:05:20 -04:00
socklib.c
stats.c sunrpc: add rpc_count_iostats_idx 2015-02-03 11:06:38 -08:00
sunrpc.h
sunrpc_syms.c sunrpc: make debugfs file creation failure non-fatal 2015-04-23 14:42:27 -04:00
svc.c SUNRPC: Fix a backchannel race 2015-06-05 11:15:43 -04:00
svc_xprt.c sunrpc/lockd: fix references to the BKL 2015-01-23 10:29:12 -05:00
svcauth.c
svcauth_unix.c
svcsock.c get rid of the size argument of sock_sendmsg() 2015-04-11 15:27:37 -04:00
sysctl.c sunrpc: eliminate RPC_DEBUG 2014-11-24 17:31:46 -05:00
timer.c
xdr.c rpc: fix xdr_truncate_encode to handle buffer ending on page boundary 2015-01-07 14:03:58 -05:00
xprt.c SUNRPC: Ensure we release the TCP socket once it has been closed 2015-06-19 19:20:12 -04:00
xprtsock.c sunrpc: translate -EAGAIN to -ENOBUFS when socket is writable. 2015-07-27 11:16:56 -04:00