]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: RGWObjManifest::obj_iterator::seek always update locations
authorKefu Chai <kchai@redhat.com>
Sat, 24 Aug 2019 15:41:57 +0000 (23:41 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 27 Aug 2019 04:41:57 +0000 (12:41 +0800)
we should update explicit loc and location even if
`ofs >= manifest->obj_size`. there is chance that we are updating an end
iterator whose ofs is equal to obj_size. before being updated, the end
iterator points to an implicit location, while after being updated, the
manifest could be using an explicit location, so we should update the
end iterator as well.

Fixes: https://tracker.ceph.com/issues/41416
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/rgw/rgw_dencoder.cc
src/rgw/rgw_obj_manifest.h

index 4fef224f33ec4433f683654ae828f46c049c1eed..461741ce5d90882eba9065d44af081e3c2c8b32f 100644 (file)
@@ -48,11 +48,11 @@ void RGWObjManifest::obj_iterator::seek(uint64_t o)
     if (explicit_iter != manifest->objs.begin()) {
       --explicit_iter;
     }
-    if (ofs >= manifest->obj_size) {
+    if (ofs < manifest->obj_size) {
+      update_explicit_pos();
+    } else {
       ofs = manifest->obj_size;
-      return;
     }
-    update_explicit_pos();
     update_location();
     return;
   }
@@ -116,7 +116,11 @@ void RGWObjManifest::obj_iterator::seek(uint64_t o)
 void RGWObjManifest::obj_iterator::update_location()
 {
   if (manifest->explicit_objs) {
-    location = explicit_iter->second.loc;
+    if (manifest->empty()) {
+      location = rgw_obj_select{};
+    } else {
+      location = explicit_iter->second.loc;
+    }
     return;
   }
 
index 59abaf36abee6849a90c8284d1f5e77d06c07af9..942ecb63b6e1f945850e7cbe333f171bb6de7446 100644 (file)
@@ -451,9 +451,7 @@ public:
       : obj_iterator(_m, 0)
     {}
     obj_iterator(RGWObjManifest *_m, uint64_t _ofs) : manifest(_m) {
-      if (!manifest->empty()) {
-        seek(_ofs);
-      }
+      seek(_ofs);
     }
     void seek(uint64_t ofs);