Skip to content

Commit

Permalink
vfs: fix propagation of atomic_open create error on negative dentry
Browse files Browse the repository at this point in the history
If ->atomic_open() returns -ENOENT, we take care to return the create
error (e.g., EACCES), if any.  Do the same when ->atomic_open() returns 1
and provides a negative dentry.

This fixes a regression where an unprivileged open O_CREAT fails with
ENOENT instead of EACCES, introduced with the new atomic_open code.  It
is tested by the open/08.t test in the pjd posix test suite, and was
observed on top of fuse (backed by ceph-fuse).

Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
  • Loading branch information
Sage Weil authored and Miklos Szeredi committed Aug 16, 2012
1 parent af109bc commit 62b2ce9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -2489,6 +2489,10 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry,
dput(dentry);
dentry = file->f_path.dentry;
}
if (create_error && dentry->d_inode == NULL) {
error = create_error;
goto out;
}
goto looked_up;
}

Expand Down

0 comments on commit 62b2ce9

Please sign in to comment.