Ensure that a process that uses the nfs_client->cl_cons_state test
for whether the initialisation process is finished does not read
stale data.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
clp->cl_cons_state == NFS_CS_SESSION_INITING))
return false;
+ smp_rmb();
+
/* Match the version and minorversion */
if (clp->rpc_ops->version != 4 ||
clp->cl_minorversion != minorversion)
return ERR_PTR(error);
}
+ smp_rmb();
+
BUG_ON(clp->cl_cons_state != NFS_CS_READY);
dprintk("<-- %s found nfs_client %p for %s\n",
*/
void nfs_mark_client_ready(struct nfs_client *clp, int state)
{
+ smp_wmb();
clp->cl_cons_state = state;
wake_up_all(&nfs_client_active_wq);
}
/* Skip nfs_clients that failed to initialise */
if (clp->cl_cons_state < 0)
continue;
+ smp_rmb();
if (clp->rpc_ops != &nfs_v4_clientops)
continue;
cl_dentry = clp->cl_idmap->idmap_pipe->dentry;
}
if (clp->cl_cons_state < NFS_CS_READY)
return -EPROTONOSUPPORT;
+ smp_rmb();
return 0;
}