From 74b5614bd25ae8151fca4d8ac4f1705be8009d64 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Mon, 21 May 2012 17:30:17 +0200 Subject: [PATCH] --- yaml --- r: 310066 b: refs/heads/master c: 91daee988db38b0207eec719a3160b163c077007 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/open.c | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index bca724977f39..85eb7638b3ac 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 78f71eff3c274f3907f4aa1bbe3267281ba1c603 +refs/heads/master: 91daee988db38b0207eec719a3160b163c077007 diff --git a/trunk/fs/open.c b/trunk/fs/open.c index 511c548b0997..9fd34b76b959 100644 --- a/trunk/fs/open.c +++ b/trunk/fs/open.c @@ -828,9 +828,25 @@ struct file *nameidata_to_filp(struct nameidata *nd) /* Has the filesystem initialised the file for us? */ if (filp->f_path.dentry == NULL) { + struct file *res; + path_get(&nd->path); - filp = __dentry_open(nd->path.dentry, nd->path.mnt, filp, - NULL, cred); + res = do_dentry_open(nd->path.dentry, nd->path.mnt, + filp, NULL, cred); + if (!IS_ERR(res)) { + int error; + + BUG_ON(res != filp); + + error = open_check_o_direct(filp); + if (error) { + fput(filp); + filp = ERR_PTR(error); + } + } else { + put_filp(filp); + filp = res; + } } return filp; }