• Olga Kornievskaia's avatar
    NFSv4.1: fix pnfs MDS=DS session trunking · 806a3bc4
    Olga Kornievskaia authored
    Currently, when GETDEVICEINFO returns multiple locations where each
    is a different IP but the server's identity is same as MDS, then
    nfs4_set_ds_client() finds the existing nfs_client structure which
    has the MDS's max_connect value (and if it's 1), then the 1st IP
    on the DS's list will get dropped due to MDS trunking rules. Other
    IPs would be added as they fall under the pnfs trunking rules.
    
    For the list of IPs the 1st goes thru calling nfs4_set_ds_client()
    which will eventually call nfs4_add_trunk() and call into
    rpc_clnt_test_and_add_xprt() which has the check for MDS trunking.
    The other IPs (after the 1st one), would call rpc_clnt_add_xprt()
    which doesn't go thru that check.
    
    nfs4_add_trunk() is called when MDS trunking is happening and it
    needs to enforce the usage of max_connect mount option of the
    1st mount. However, this shouldn't be applied to pnfs flow.
    
    Instead, this patch proposed to treat MDS=DS as DS trunking and
    make sure that MDS's max_connect limit does not apply to the
    1st IP returned in the GETDEVICEINFO list. It does so by
    marking the newly created client with a new flag NFS_CS_PNFS
    which then used to pass max_connect value to use into the
    rpc_clnt_test_and_add_xprt() instead of the existing rpc
    client's max_connect value set by the MDS connection.
    
    For example, mount was done without max_connect value set
    so MDS's rpc client has cl_max_connect=1. Upon calling into
    rpc_clnt_test_and_add_xprt() and using rpc client's value,
    the caller passes in max_connect value which is previously
    been set in the pnfs path (as a part of handling
    GETDEVICEINFO list of IPs) in nfs4_set_ds_client().
    
    However, when NFS_CS_PNFS flag is not set and we know we
    are doing MDS trunking, comparing a new IP of the same
    server, we then set the max_connect value to the
    existing MDS's value and pass that into
    rpc_clnt_test_and_add_xprt().
    
    Fixes: dc48e0ab ("SUNRPC enforce creation of no more than max_connect xprts")
    Signed-off-by: default avatarOlga Kornievskaia <kolga@netapp.com>
    Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
    806a3bc4
clnt.c 79.7 KB