Commit c57d1bc5 authored by Trond Myklebust's avatar Trond Myklebust

NFS: nfs_inode_return_delegation() should always flush dirty data

The assumption is that if you are in a situation where you need to
return the delegation, then you should probably stop caching the
data anyway.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 14546c33
...@@ -380,6 +380,10 @@ void nfs_inode_return_delegation_noreclaim(struct inode *inode) ...@@ -380,6 +380,10 @@ void nfs_inode_return_delegation_noreclaim(struct inode *inode)
* nfs_inode_return_delegation - synchronously return a delegation * nfs_inode_return_delegation - synchronously return a delegation
* @inode: inode to process * @inode: inode to process
* *
* This routine will always flush any dirty data to disk on the
* assumption that if we need to return the delegation, then
* we should stop caching.
*
* Returns zero on success, or a negative errno value. * Returns zero on success, or a negative errno value.
*/ */
int nfs_inode_return_delegation(struct inode *inode) int nfs_inode_return_delegation(struct inode *inode)
...@@ -389,10 +393,10 @@ int nfs_inode_return_delegation(struct inode *inode) ...@@ -389,10 +393,10 @@ int nfs_inode_return_delegation(struct inode *inode)
struct nfs_delegation *delegation; struct nfs_delegation *delegation;
int err = 0; int err = 0;
nfs_wb_all(inode);
if (rcu_access_pointer(nfsi->delegation) != NULL) { if (rcu_access_pointer(nfsi->delegation) != NULL) {
delegation = nfs_detach_delegation(nfsi, server); delegation = nfs_detach_delegation(nfsi, server);
if (delegation != NULL) { if (delegation != NULL) {
nfs_wb_all(inode);
err = __nfs_inode_return_delegation(inode, delegation, 1); err = __nfs_inode_return_delegation(inode, delegation, 1);
} }
} }
......
...@@ -66,6 +66,7 @@ static inline int nfs_have_delegation(struct inode *inode, fmode_t flags) ...@@ -66,6 +66,7 @@ static inline int nfs_have_delegation(struct inode *inode, fmode_t flags)
static inline int nfs_inode_return_delegation(struct inode *inode) static inline int nfs_inode_return_delegation(struct inode *inode)
{ {
nfs_wb_all(inode);
return 0; return 0;
} }
#endif #endif
......
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