From 2a3a2098d01abe0dc4ddc45467c0217d6889a279 Mon Sep 17 00:00:00 2001 From: Tianshan Qu Date: Tue, 19 Mar 2019 19:21:57 +0800 Subject: [PATCH] rgw: fix read not exists null version return wrong steps 1.enable bucket versioning 2.PUT obj (got version XXX) 3.GET obj with version_id=null (return success and have no data) Fixes: http://tracker.ceph.com/issues/38811 Signed-off-by: Tianshan Qu (cherry picked from commit a37467f847d3951e11050fdf4c3d54e081a85f0c) --- src/rgw/rgw_rados.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 4fcd15c1544..e9fc434c39e 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -9659,6 +9659,10 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, const RGWBucketInfo& bucket if (need_follow_olh) { return get_olh_target_state(*rctx, bucket_info, obj, s, state); + } else if (obj.key.have_null_instance() && !s->has_manifest) { + // read null version, and the head object only have olh info + s->exists = false; + return -ENOENT; } } -- 2.47.3