diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-05-23 13:26:10 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-05-23 15:24:59 -0400 |
commit | 54ac471c83aff6b1e068eb8029c797dc68a76e89 (patch) | |
tree | 3311a74fc6f5cdbedbe4e1da9bbbbaf6671050a2 /fs/nfs/client.c | |
parent | 4697bd5e9419348ef9fa9b55cefe4355ad9d3d01 (diff) | |
download | op-kernel-dev-54ac471c83aff6b1e068eb8029c797dc68a76e89.zip op-kernel-dev-54ac471c83aff6b1e068eb8029c797dc68a76e89.tar.gz |
NFS: Add memory barriers to the nfs_client->cl_cons_state initialisation
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>
Diffstat (limited to 'fs/nfs/client.c')
-rw-r--r-- | fs/nfs/client.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index d356642..a50bdfb 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -459,6 +459,8 @@ static bool nfs4_cb_match_client(const struct sockaddr *addr, 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) @@ -539,6 +541,8 @@ nfs_found_client(const struct nfs_client_initdata *cl_init, return ERR_PTR(error); } + smp_rmb(); + BUG_ON(clp->cl_cons_state != NFS_CS_READY); dprintk("<-- %s found nfs_client %p for %s\n", @@ -597,6 +601,7 @@ nfs_get_client(const struct nfs_client_initdata *cl_init, */ 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); } |