Commit dc327ed4 authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: nfs_client_return_marked_delegations can't flush data

Since even filemap_flush() needs to lock pages that are dirty, we
cannot risk calling it from the state manager context. Therefore,
we need to move the call to filemap_flush() to
nfs_async_inode_return_delegation().
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent c57d1bc5
...@@ -316,6 +316,10 @@ static int __nfs_inode_return_delegation(struct inode *inode, struct nfs_delegat ...@@ -316,6 +316,10 @@ static int __nfs_inode_return_delegation(struct inode *inode, struct nfs_delegat
* nfs_client_return_marked_delegations - return previously marked delegations * nfs_client_return_marked_delegations - return previously marked delegations
* @clp: nfs_client to process * @clp: nfs_client to process
* *
* Note that this function is designed to be called by the state
* manager thread. For this reason, it cannot flush the dirty data,
* since that could deadlock in case of a state recovery error.
*
* Returns zero on success, or a negative errno value. * Returns zero on success, or a negative errno value.
*/ */
int nfs_client_return_marked_delegations(struct nfs_client *clp) int nfs_client_return_marked_delegations(struct nfs_client *clp)
...@@ -340,11 +344,9 @@ int nfs_client_return_marked_delegations(struct nfs_client *clp) ...@@ -340,11 +344,9 @@ int nfs_client_return_marked_delegations(struct nfs_client *clp)
server); server);
rcu_read_unlock(); rcu_read_unlock();
if (delegation != NULL) { if (delegation != NULL)
filemap_flush(inode->i_mapping);
err = __nfs_inode_return_delegation(inode, err = __nfs_inode_return_delegation(inode,
delegation, 0); delegation, 0);
}
iput(inode); iput(inode);
if (!err) if (!err)
goto restart; goto restart;
...@@ -542,6 +544,8 @@ int nfs_async_inode_return_delegation(struct inode *inode, ...@@ -542,6 +544,8 @@ int nfs_async_inode_return_delegation(struct inode *inode,
struct nfs_client *clp = server->nfs_client; struct nfs_client *clp = server->nfs_client;
struct nfs_delegation *delegation; struct nfs_delegation *delegation;
filemap_flush(inode->i_mapping);
rcu_read_lock(); rcu_read_lock();
delegation = rcu_dereference(NFS_I(inode)->delegation); delegation = rcu_dereference(NFS_I(inode)->delegation);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment