aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorPeng Tao <tao.peng@primarydata.com>2014-08-22 05:37:40 -0400
committerTom Haynes <loghyr@primarydata.com>2015-02-03 14:06:39 -0500
commitabb9a0079c7f06360b83a5dd27ce74b8dc6d01b6 (patch)
treea7baa0b827828dab306e9a8f2e723ee2f11859a6 /fs/nfs
parent72cff4494ea981202c8db6fd18940c8506f14db4 (diff)
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>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/pnfs.c8
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,
1288 struct nfs_client *clp = server->nfs_client; 1288 struct nfs_client *clp = server->nfs_client;
1289 struct pnfs_layout_hdr *lo; 1289 struct pnfs_layout_hdr *lo;
1290 struct pnfs_layout_segment *lseg = NULL; 1290 struct pnfs_layout_segment *lseg = NULL;
1291 bool first;
1292 1291
1293 if (!pnfs_enabled_sb(NFS_SERVER(ino))) 1292 if (!pnfs_enabled_sb(NFS_SERVER(ino)))
1294 goto out; 1293 goto out;
@@ -1321,16 +1320,15 @@ pnfs_update_layout(struct inode *ino,
1321 if (pnfs_layoutgets_blocked(lo, 0)) 1320 if (pnfs_layoutgets_blocked(lo, 0))
1322 goto out_unlock; 1321 goto out_unlock;
1323 atomic_inc(&lo->plh_outstanding); 1322 atomic_inc(&lo->plh_outstanding);
1324
1325 first = list_empty(&lo->plh_layouts) ? true : false;
1326 spin_unlock(&ino->i_lock); 1323 spin_unlock(&ino->i_lock);
1327 1324
1328 if (first) { 1325 if (list_empty(&lo->plh_layouts)) {
1329 /* The lo must be on the clp list if there is any 1326 /* The lo must be on the clp list if there is any
1330 * chance of a CB_LAYOUTRECALL(FILE) coming in. 1327 * chance of a CB_LAYOUTRECALL(FILE) coming in.
1331 */ 1328 */
1332 spin_lock(&clp->cl_lock); 1329 spin_lock(&clp->cl_lock);
1333 list_add_tail(&lo->plh_layouts, &server->layouts); 1330 if (list_empty(&lo->plh_layouts))
1331 list_add_tail(&lo->plh_layouts, &server->layouts);
1334 spin_unlock(&clp->cl_lock); 1332 spin_unlock(&clp->cl_lock);
1335 } 1333 }
1336 1334