From: NeilBrown <neilb@suse.com>
Patch-mainline: never - mvfs work around
References: bsc#1162063
Subject: work around mvfs bug.
If f_op->open fails, mvfs still calls fput() and so f_op->release.
This is a bug.
It should call put_filp, but that isn't exported.
Signed-off-by: NeilBrown <neilb@suse.com>
Acked-by: NeilBrown <neilb@suse.com>
---
fs/nfs/file.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -80,6 +80,11 @@ nfs_file_open(struct inode *inode, struc
int
nfs_file_release(struct inode *inode, struct file *filp)
{
+ if (!nfs_file_open_context(filp)) {
+ dprintk("NFS: buggy mvfs module called fput after failed open\n");
+ return 0;
+ }
+
dprintk("NFS: release(%pD2)\n", filp);
if (filp->f_mode & FMODE_WRITE)