提交 64e1ac4d 编写于 作者: A Al Viro

->atomic_open(): return 0 in all success cases

FMODE_OPENED can be used to distingusish "successful open" from the
"called finish_no_open(), do it yourself" cases.  Since finish_no_open()
has been adjusted, no changes in the instances were actually needed.
The caller has been adjusted.
Acked-by: NLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 3ec2eef1
...@@ -3054,21 +3054,21 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry, ...@@ -3054,21 +3054,21 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry,
open_to_namei_flags(open_flag), mode); open_to_namei_flags(open_flag), mode);
d_lookup_done(dentry); d_lookup_done(dentry);
if (!error) { if (!error) {
/* if (file->f_mode & FMODE_OPENED) {
* We didn't have the inode before the open, so check open /*
* permission here. * We didn't have the inode before the open, so check open
*/ * permission here.
int acc_mode = op->acc_mode; */
if (file->f_mode & FMODE_CREATED) { int acc_mode = op->acc_mode;
WARN_ON(!(open_flag & O_CREAT)); if (file->f_mode & FMODE_CREATED) {
fsnotify_create(dir, dentry); WARN_ON(!(open_flag & O_CREAT));
acc_mode = 0; fsnotify_create(dir, dentry);
} acc_mode = 0;
error = may_open(&file->f_path, acc_mode, open_flag); }
if (WARN_ON(error > 0)) error = may_open(&file->f_path, acc_mode, open_flag);
error = -EINVAL; if (WARN_ON(error > 0))
} else if (error > 0) { error = -EINVAL;
if (WARN_ON(file->f_path.dentry == DENTRY_NOT_SET)) { } else if (WARN_ON(file->f_path.dentry == DENTRY_NOT_SET)) {
error = -EIO; error = -EIO;
} else { } else {
if (file->f_path.dentry) { if (file->f_path.dentry) {
......
...@@ -863,13 +863,13 @@ EXPORT_SYMBOL(finish_open); ...@@ -863,13 +863,13 @@ EXPORT_SYMBOL(finish_open);
* NB: unlike finish_open() this function does consume the dentry reference and * NB: unlike finish_open() this function does consume the dentry reference and
* the caller need not dput() it. * the caller need not dput() it.
* *
* Returns "1" which must be the return value of ->atomic_open() after having * Returns "0" which must be the return value of ->atomic_open() after having
* called this function. * called this function.
*/ */
int finish_no_open(struct file *file, struct dentry *dentry) int finish_no_open(struct file *file, struct dentry *dentry)
{ {
file->f_path.dentry = dentry; file->f_path.dentry = dentry;
return 1; return 0;
} }
EXPORT_SYMBOL(finish_no_open); EXPORT_SYMBOL(finish_no_open);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册