diff options
author | Sage Weil <sage@inktank.com> | 2012-08-15 16:30:12 -0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2012-08-16 13:29:09 -0400 |
commit | 62b2ce964bb901f00a480104bd35a2e1f8d2cf58 (patch) | |
tree | f8014f9c014c84fdabcacfbde91b839ad32de385 /fs/namei.c | |
parent | af109bca94a8a223c4632a4ff769b3419fe7ed8c (diff) |
vfs: fix propagation of atomic_open create error on negative dentry
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>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c index 26c28ec4f4af..db76b866a097 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2489,6 +2489,10 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry, | |||
2489 | dput(dentry); | 2489 | dput(dentry); |
2490 | dentry = file->f_path.dentry; | 2490 | dentry = file->f_path.dentry; |
2491 | } | 2491 | } |
2492 | if (create_error && dentry->d_inode == NULL) { | ||
2493 | error = create_error; | ||
2494 | goto out; | ||
2495 | } | ||
2492 | goto looked_up; | 2496 | goto looked_up; |
2493 | } | 2497 | } |
2494 | 2498 | ||