提交 a01e718f 编写于 作者: A Al Viro

fix a regression in atomic_open()

open("/foo/no_such_file", O_RDONLY | O_CREAT) on should fail with
EACCES when /foo is not writable; failing with ENOENT is obviously
wrong.  That got broken by a braino introduced when moving the
creat_error logics from atomic_open() to lookup_open().  Easy to
fix, fortunately.
Spotted-by: N"Yan, Zheng" <ukernel@gmail.com>
Tested-by: N"Yan, Zheng" <ukernel@gmail.com>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 3d56c25e
...@@ -2995,9 +2995,13 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry, ...@@ -2995,9 +2995,13 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry,
} }
if (*opened & FILE_CREATED) if (*opened & FILE_CREATED)
fsnotify_create(dir, dentry); fsnotify_create(dir, dentry);
path->dentry = dentry; if (unlikely(d_is_negative(dentry))) {
path->mnt = nd->path.mnt; error = -ENOENT;
return 1; } else {
path->dentry = dentry;
path->mnt = nd->path.mnt;
return 1;
}
} }
} }
dput(dentry); dput(dentry);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册