svcrpc: sends on closed socket should stop immediately
authorJ. Bruce Fields <bfields@redhat.com>
Mon, 20 Aug 2012 20:04:40 +0000 (16:04 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 12 Sep 2012 02:37:22 +0000 (03:37 +0100)
commit1057f77016b40d967d8527349ebb881311017df7
tree33f4d3b90074ebc6e52f27cd15edf09b3c890273
parentb4d810559cd5e73751adbd9cf05034bb8775a691
svcrpc: sends on closed socket should stop immediately

commit f06f00a24d76e168ecb38d352126fd203937b601 upstream.

svc_tcp_sendto sets XPT_CLOSE if we fail to transmit the entire reply.
However, the XPT_CLOSE won't be acted on immediately.  Meanwhile other
threads could send further replies before the socket is really shut
down.  This can manifest as data corruption: for example, if a truncated
read reply is followed by another rpc reply, that second reply will look
to the client like further read data.

Symptoms were data corruption preceded by svc_tcp_sendto logging
something like

kernel: rpc-srv/tcp: nfsd: sent only 963696 when sending 1048708 bytes - shutting down socket

Reported-by: Malahal Naineni <malahal@us.ibm.com>
Tested-by: Malahal Naineni <malahal@us.ibm.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/sunrpc/svc_xprt.c