]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix read not exists null version return wrong 27306/head
authorTianshan Qu <tianshan@xsky.com>
Tue, 19 Mar 2019 11:21:57 +0000 (19:21 +0800)
committerPrashant D <pdhange@redhat.com>
Tue, 2 Apr 2019 00:14:04 +0000 (20:14 -0400)
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 <tianshan@xsky.com>
(cherry picked from commit a37467f847d3951e11050fdf4c3d54e081a85f0c)

src/rgw/rgw_rados.cc

index 227fcbbd5e5355113a9093fd8ce6df9fbc959598..7ce943d3a20d0323827013c2bbb9a5c8253eaa4e 100644 (file)
@@ -5886,6 +5886,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;
     }
   }