diff options
author | Peng Tao <tao.peng@primarydata.com> | 2014-08-22 17:37:40 +0800 |
---|---|---|
committer | Tom Haynes <loghyr@primarydata.com> | 2015-02-03 11:06:39 -0800 |
commit | abb9a0079c7f06360b83a5dd27ce74b8dc6d01b6 (patch) | |
tree | a7baa0b827828dab306e9a8f2e723ee2f11859a6 | |
parent | 72cff4494ea981202c8db6fd18940c8506f14db4 (diff) | |
download | linux-abb9a0079c7f06360b83a5dd27ce74b8dc6d01b6.tar.gz linux-abb9a0079c7f06360b83a5dd27ce74b8dc6d01b6.tar.bz2 linux-abb9a0079c7f06360b83a5dd27ce74b8dc6d01b6.zip |
nfs41: close a small race window when adding new layout to global list
Signed-off-by: Peng Tao <tao.peng@primarydata.com>
Signed-off-by: Tom Haynes <Thomas.Haynes@primarydata.com>
-rw-r--r-- | fs/nfs/pnfs.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 2d25670bbe44..fa00b56f176a 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -1288,7 +1288,6 @@ pnfs_update_layout(struct inode *ino, struct nfs_client *clp = server->nfs_client; struct pnfs_layout_hdr *lo; struct pnfs_layout_segment *lseg = NULL; - bool first; if (!pnfs_enabled_sb(NFS_SERVER(ino))) goto out; @@ -1321,16 +1320,15 @@ pnfs_update_layout(struct inode *ino, if (pnfs_layoutgets_blocked(lo, 0)) goto out_unlock; atomic_inc(&lo->plh_outstanding); - - first = list_empty(&lo->plh_layouts) ? true : false; spin_unlock(&ino->i_lock); - if (first) { + if (list_empty(&lo->plh_layouts)) { /* The lo must be on the clp list if there is any * chance of a CB_LAYOUTRECALL(FILE) coming in. */ spin_lock(&clp->cl_lock); - list_add_tail(&lo->plh_layouts, &server->layouts); + if (list_empty(&lo->plh_layouts)) + list_add_tail(&lo->plh_layouts, &server->layouts); spin_unlock(&clp->cl_lock); } |