don't modify od->filp at all
make put_filp() conditional on flag set by finish_open()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
diff --git a/fs/open.c b/fs/open.c
index 89589bd..c87f982 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -786,15 +786,14 @@
int *opened)
{
struct file *res;
+ BUG_ON(*opened & FILE_OPENED); /* once it's opened, it's opened */
mntget(od->mnt);
dget(dentry);
res = do_dentry_open(dentry, od->mnt, od->filp, open, current_cred());
- if (!IS_ERR(res)) {
+ if (!IS_ERR(res))
*opened |= FILE_OPENED;
- od->filp = NULL;
- }
return res;
}