提交 9f0f8e12 编写于 作者: T Trond Myklebust

NFSv4: Pin the superblock while we're returning the delegation

This patch ensures that the superblock doesn't go ahead and disappear
underneath us while the state manager thread is returning delegations.
Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
上级 ade04647
...@@ -474,14 +474,20 @@ int nfs_client_return_marked_delegations(struct nfs_client *clp) ...@@ -474,14 +474,20 @@ int nfs_client_return_marked_delegations(struct nfs_client *clp)
super_list) { super_list) {
if (!nfs_delegation_need_return(delegation)) if (!nfs_delegation_need_return(delegation))
continue; continue;
inode = nfs_delegation_grab_inode(delegation); if (!nfs_sb_active(server->super))
if (inode == NULL)
continue; continue;
inode = nfs_delegation_grab_inode(delegation);
if (inode == NULL) {
rcu_read_unlock();
nfs_sb_deactive(server->super);
goto restart;
}
delegation = nfs_start_delegation_return_locked(NFS_I(inode)); delegation = nfs_start_delegation_return_locked(NFS_I(inode));
rcu_read_unlock(); rcu_read_unlock();
err = nfs_end_delegation_return(inode, delegation, 0); err = nfs_end_delegation_return(inode, delegation, 0);
iput(inode); iput(inode);
nfs_sb_deactive(server->super);
if (!err) if (!err)
goto restart; goto restart;
set_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state); set_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state);
...@@ -815,9 +821,14 @@ void nfs_delegation_reap_unclaimed(struct nfs_client *clp) ...@@ -815,9 +821,14 @@ void nfs_delegation_reap_unclaimed(struct nfs_client *clp)
if (test_bit(NFS_DELEGATION_NEED_RECLAIM, if (test_bit(NFS_DELEGATION_NEED_RECLAIM,
&delegation->flags) == 0) &delegation->flags) == 0)
continue; continue;
inode = nfs_delegation_grab_inode(delegation); if (!nfs_sb_active(server->super))
if (inode == NULL)
continue; continue;
inode = nfs_delegation_grab_inode(delegation);
if (inode == NULL) {
rcu_read_unlock();
nfs_sb_deactive(server->super);
goto restart;
}
delegation = nfs_start_delegation_return_locked(NFS_I(inode)); delegation = nfs_start_delegation_return_locked(NFS_I(inode));
rcu_read_unlock(); rcu_read_unlock();
if (delegation != NULL) { if (delegation != NULL) {
...@@ -827,6 +838,7 @@ void nfs_delegation_reap_unclaimed(struct nfs_client *clp) ...@@ -827,6 +838,7 @@ void nfs_delegation_reap_unclaimed(struct nfs_client *clp)
nfs_free_delegation(delegation); nfs_free_delegation(delegation);
} }
iput(inode); iput(inode);
nfs_sb_deactive(server->super);
goto restart; goto restart;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册