Commit d4317010 authored by Trond Myklebust's avatar Trond Myklebust Committed by Jiri Slaby

NFSv4.1: Fix client id trunking on Linux

commit 1fc0703a upstream.

Currently, our trunking code will check for session trunking, but will
fail to detect client id trunking. This is a problem, because it means
that the client will fail to recognise that the two connections represent
shared state, even if they do not permit a shared session.
By removing the check for the server minor id, and only checking the
major id, we will end up doing the right thing in both cases: we close
down the new nfs_client and fall back to using the existing one.

Fixes: 05f4c350 ("NFS: Discover NFSv4 server trunking when mounting")
Cc: Chuck Lever <chuck.lever@oracle.com>
Tested-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 98621891
...@@ -561,20 +561,14 @@ static bool nfs4_match_clientids(struct nfs_client *a, struct nfs_client *b) ...@@ -561,20 +561,14 @@ static bool nfs4_match_clientids(struct nfs_client *a, struct nfs_client *b)
} }
/* /*
* Returns true if the server owners match * Returns true if the server major ids match
*/ */
static bool static bool
nfs4_match_serverowners(struct nfs_client *a, struct nfs_client *b) nfs4_check_clientid_trunking(struct nfs_client *a, struct nfs_client *b)
{ {
struct nfs41_server_owner *o1 = a->cl_serverowner; struct nfs41_server_owner *o1 = a->cl_serverowner;
struct nfs41_server_owner *o2 = b->cl_serverowner; struct nfs41_server_owner *o2 = b->cl_serverowner;
if (o1->minor_id != o2->minor_id) {
dprintk("NFS: --> %s server owner minor IDs do not match\n",
__func__);
return false;
}
if (o1->major_id_sz != o2->major_id_sz) if (o1->major_id_sz != o2->major_id_sz)
goto out_major_mismatch; goto out_major_mismatch;
if (memcmp(o1->major_id, o2->major_id, o1->major_id_sz) != 0) if (memcmp(o1->major_id, o2->major_id, o1->major_id_sz) != 0)
...@@ -650,7 +644,12 @@ int nfs41_walk_client_list(struct nfs_client *new, ...@@ -650,7 +644,12 @@ int nfs41_walk_client_list(struct nfs_client *new,
if (!nfs4_match_clientids(pos, new)) if (!nfs4_match_clientids(pos, new))
continue; continue;
if (!nfs4_match_serverowners(pos, new)) /*
* Note that session trunking is just a special subcase of
* client id trunking. In either case, we want to fall back
* to using the existing nfs_client.
*/
if (!nfs4_check_clientid_trunking(pos, new))
continue; continue;
atomic_inc(&pos->cl_count); atomic_inc(&pos->cl_count);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment