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>
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;
}
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;
}
: 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);