NFSv4: Fixes for nfs4_inode_return_delegation()

commit 6e176d4716 upstream.

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 <dwysocha@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: Thorsten Leemhuis <regressions@leemhuis.info>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Trond Myklebust 2021-10-10 10:58:12 +02:00 коммит произвёл Greg Kroah-Hartman
Родитель 21b0301f22
Коммит 27bf7a5d11
1 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -755,11 +755,13 @@ int nfs4_inode_return_delegation(struct inode *inode)
struct nfs_delegation *delegation; struct nfs_delegation *delegation;
delegation = nfs_start_delegation_return(nfsi); delegation = nfs_start_delegation_return(nfsi);
/* Synchronous recall of any application leases */ if (delegation != NULL) {
break_lease(inode, O_WRONLY | O_RDWR); /* Synchronous recall of any application leases */
nfs_wb_all(inode); break_lease(inode, O_WRONLY | O_RDWR);
if (delegation != NULL) if (S_ISREG(inode->i_mode))
nfs_wb_all(inode);
return nfs_end_delegation_return(inode, delegation, 1); return nfs_end_delegation_return(inode, delegation, 1);
}
return 0; return 0;
} }