diff options
author | Jeff Layton <jlayton@kernel.org> | 2021-06-02 12:46:07 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2021-06-22 13:53:28 +0200 |
commit | 7a971e2c0767b6fc9a77c4108eceff0509c61cdb (patch) | |
tree | df30eb87a1fcd07e2ddae903ce7617cee17766d1 /fs/ceph/file.c | |
parent | 27171ae6a0fdc75571e5bf3d0961631a1e4fb765 (diff) |
ceph: fix error handling in ceph_atomic_open and ceph_lookup
Commit aa60cfc3f7ee broke the error handling in these functions such
that they don't handle non-ENOENT errors from ceph_mdsc_do_request
properly.
Move the checking of -ENOENT out of ceph_handle_snapdir and into the
callers, and if we get a different error, return it immediately.
Fixes: aa60cfc3f7ee ("ceph: don't use d_add in ceph_handle_snapdir")
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/file.c')
-rw-r--r-- | fs/ceph/file.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 4dc96885acd0..d51af3698032 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -742,14 +742,16 @@ retry: err = ceph_mdsc_do_request(mdsc, (flags & (O_CREAT|O_TRUNC)) ? dir : NULL, req); - dentry = ceph_handle_snapdir(req, dentry, err); - if (IS_ERR(dentry)) { - err = PTR_ERR(dentry); - goto out_req; + if (err == -ENOENT) { + dentry = ceph_handle_snapdir(req, dentry); + if (IS_ERR(dentry)) { + err = PTR_ERR(dentry); + goto out_req; + } + err = 0; } - err = 0; - if ((flags & O_CREAT) && !req->r_reply_info.head->is_dentry) + if (!err && (flags & O_CREAT) && !req->r_reply_info.head->is_dentry) err = ceph_handle_notrace_create(dir, dentry); if (d_in_lookup(dentry)) { |