Skip to content

Commit 6e176d4

Browse files
author
Trond Myklebust
committed
NFSv4: Fixes for nfs4_inode_return_delegation()
We mustn't call nfs_wb_all() on anything other than a regular file. Furthermore, we can exit early when we don't hold a delegation. Reported-by: David Wysochanski <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent f0caea8 commit 6e176d4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

fs/nfs/delegation.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -755,11 +755,13 @@ int nfs4_inode_return_delegation(struct inode *inode)
755755
struct nfs_delegation *delegation;
756756

757757
delegation = nfs_start_delegation_return(nfsi);
758-
/* Synchronous recall of any application leases */
759-
break_lease(inode, O_WRONLY | O_RDWR);
760-
nfs_wb_all(inode);
761-
if (delegation != NULL)
758+
if (delegation != NULL) {
759+
/* Synchronous recall of any application leases */
760+
break_lease(inode, O_WRONLY | O_RDWR);
761+
if (S_ISREG(inode->i_mode))
762+
nfs_wb_all(inode);
762763
return nfs_end_delegation_return(inode, delegation, 1);
764+
}
763765
return 0;
764766
}
765767

0 commit comments

Comments
 (0)