Commit 5ee9a07b authored by Chuck Lever's avatar Chuck Lever Committed by Greg Kroah-Hartman
Browse files

SUNRPC: Prevent hang on NFS mount with xprtsec=[m]tls



commit 0bd2f6b8 upstream.

Engineers at Hammerspace noticed that sometimes mounting with
"xprtsec=tls" hangs for a minute or so, and then times out, even
when the NFS server is reachable and responsive.

kTLS shuts off data_ready callbacks if strp->msg_ready is set to
mitigate data_ready callbacks when a full TLS record is not yet
ready to be read from the socket.

Normally msg_ready is clear when the first TLS record arrives on
a socket. However, I observed that sometimes tls_setsockopt() sets
strp->msg_ready, and that prevents forward progress because
tls_data_ready() becomes a no-op.

Moreover, Jakub says: "If there's a full record queued at the time
when [tlshd] passes the socket back to the kernel, it's up to the
reader to read the already queued data out." So SunRPC cannot
expect a data_ready call when ingress data is already waiting.

Add an explicit poll after SunRPC's upper transport is set up to
pick up any data that arrived after the TLS handshake but before
transport set-up is complete.

Reported-by: default avatarSteve Sears <sjs@hammerspace.com>
Suggested-by: default avatarJakub Kacinski <kuba@kernel.org>
Fixes: 75eb6af7 ("SUNRPC: Add a TCP-with-TLS RPC transport class")
Tested-by: default avatarMike Snitzer <snitzer@kernel.org>
Reviewed-by: default avatarMike Snitzer <snitzer@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarAnna Schumaker <anna.schumaker@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5060e1a5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment