|
@@ -4781,6 +4781,16 @@ out_inval:
|
|
|
return -NFS4ERR_INVAL;
|
|
|
}
|
|
|
|
|
|
+static bool
|
|
|
+nfs41_same_server_scope(struct server_scope *a, struct server_scope *b)
|
|
|
+{
|
|
|
+ if (a->server_scope_sz == b->server_scope_sz &&
|
|
|
+ memcmp(a->server_scope, b->server_scope, a->server_scope_sz) == 0)
|
|
|
+ return true;
|
|
|
+
|
|
|
+ return false;
|
|
|
+}
|
|
|
+
|
|
|
/*
|
|
|
* nfs4_proc_exchange_id()
|
|
|
*
|
|
@@ -4823,9 +4833,31 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)
|
|
|
init_utsname()->domainname,
|
|
|
clp->cl_rpcclient->cl_auth->au_flavor);
|
|
|
|
|
|
+ res.server_scope = kzalloc(sizeof(struct server_scope), GFP_KERNEL);
|
|
|
+ if (unlikely(!res.server_scope))
|
|
|
+ return -ENOMEM;
|
|
|
+
|
|
|
status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
|
|
|
if (!status)
|
|
|
status = nfs4_check_cl_exchange_flags(clp->cl_exchange_flags);
|
|
|
+
|
|
|
+ if (!status) {
|
|
|
+ if (clp->server_scope &&
|
|
|
+ !nfs41_same_server_scope(clp->server_scope,
|
|
|
+ res.server_scope)) {
|
|
|
+ dprintk("%s: server_scope mismatch detected\n",
|
|
|
+ __func__);
|
|
|
+ set_bit(NFS4CLNT_SERVER_SCOPE_MISMATCH, &clp->cl_state);
|
|
|
+ kfree(clp->server_scope);
|
|
|
+ clp->server_scope = NULL;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!clp->server_scope)
|
|
|
+ clp->server_scope = res.server_scope;
|
|
|
+ else
|
|
|
+ kfree(res.server_scope);
|
|
|
+ }
|
|
|
+
|
|
|
dprintk("<-- %s status= %d\n", __func__, status);
|
|
|
return status;
|
|
|
}
|