sunrpc: set cl_max_connect when cloning an rpc_clnt
authorScott Mayhew <smayhew@redhat.com>
Wed, 1 Jun 2022 17:34:49 +0000 (13:34 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Jun 2022 12:21:59 +0000 (14:21 +0200)
commit5967a6900873b3cac015b09aac2008917e87937a
tree4710826ba92bdfa7ee966c34556cb8991b518af3
parentec23a86e060cbe30b62eb2955adc97c92d80cc4c
sunrpc: set cl_max_connect when cloning an rpc_clnt

[ Upstream commit 304791255a2dc1c9be7e7c8a6cbdb31b6847b0e5 ]

If the initial attempt at trunking detection using the krb5i auth flavor
fails with -EACCES, -NFS4ERR_CLID_INUSE, or -NFS4ERR_WRONGSEC, then the
NFS client tries again using auth_sys, cloning the rpc_clnt in the
process.  If this second attempt at trunking detection succeeds, then
the resulting nfs_client->cl_rpcclient winds up having cl_max_connect=0
and subsequent attempts to add additional transport connections to the
rpc_clnt will fail with a message similar to the following being logged:

[502044.312640] SUNRPC: reached max allowed number (0) did not add
transport to server: 192.168.122.3

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Fixes: dc48e0abee24 ("SUNRPC enforce creation of no more than max_connect xprts")
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sunrpc/clnt.c