提交 abb9a007 编写于 作者: P Peng Tao 提交者: Tom Haynes

nfs41: close a small race window when adding new layout to global list

Signed-off-by: NPeng Tao <tao.peng@primarydata.com>
Signed-off-by: NTom Haynes <Thomas.Haynes@primarydata.com>
上级 72cff449
......@@ -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,15 +1320,14 @@ 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);
if (list_empty(&lo->plh_layouts))
list_add_tail(&lo->plh_layouts, &server->layouts);
spin_unlock(&clp->cl_lock);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册