diff options
Diffstat (limited to 'fs/nfs/localio.c')
-rw-r--r-- | fs/nfs/localio.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/fs/nfs/localio.c b/fs/nfs/localio.c index 4ec952f9f47d..595903c21523 100644 --- a/fs/nfs/localio.c +++ b/fs/nfs/localio.c @@ -280,14 +280,9 @@ nfs_local_open_fh(struct nfs_client *clp, const struct cred *cred, return NULL; rcu_read_lock(); /* try to swap in the pointer */ - spin_lock(&clp->cl_uuid.lock); - nf = rcu_dereference_protected(*pnf, 1); - if (!nf) { - nf = new; - new = NULL; - rcu_assign_pointer(*pnf, nf); - } - spin_unlock(&clp->cl_uuid.lock); + nf = unrcu_pointer(cmpxchg(pnf, NULL, RCU_INITIALIZER(new))); + if (!nf) + swap(nf, new); } nf = nfs_local_file_get(nf); rcu_read_unlock(); |