]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: fix read not exists null version return wrong
authorTianshan Qu <tianshan@xsky.com>
Tue, 19 Mar 2019 11:21:57 +0000 (19:21 +0800)
committerTianshan Qu <tianshan@xsky.com>
Tue, 19 Mar 2019 11:21:57 +0000 (19:21 +0800)
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>
src/rgw/rgw_rados.cc

index 1468457a3cb0e604c8437510700db46250a673cd..8b6a35ee4fd0c5b7c9c4d5ec3dffa8029a32f322 100644 (file)
@@ -5900,6 +5900,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;
     }
   }