vfs: do_dentry_open(): don't put filp
authorMiklos Szeredi <mszeredi@suse.cz>
Mon, 21 May 2012 15:30:16 +0000 (17:30 +0200)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 1 Jun 2012 16:12:00 +0000 (12:12 -0400)
Move put_filp() out to __dentry_open(), the only caller now.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/open.c

index 9daa1cea52fcf6e7b4d79e35e6570f9589a91b64..511c548b0997c8d7ff7c3271bec8c17b1674344b 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -747,7 +747,6 @@ cleanup_all:
        f->f_path.dentry = NULL;
        f->f_path.mnt = NULL;
 cleanup_file:
-       put_filp(f);
        dput(dentry);
        mntput(mnt);
        return ERR_PTR(error);
@@ -765,6 +764,8 @@ static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt,
                        fput(res);
                        res = ERR_PTR(error);
                }
+       } else {
+               put_filp(f);
        }
        return res;
 }