From: Pritha Srivastava Date: Wed, 8 May 2024 09:29:04 +0000 (+0530) Subject: rgw/d4n: fix to correctly populate rgw_obj of GetObjectState in X-Git-Tag: v20.3.0~8^2~33 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2c07448732711ee54683ed8debf8322c0cc72ea6;p=ceph.git rgw/d4n: fix to correctly populate rgw_obj of GetObjectState in RGWRados, in case ReadOp::prepare() reads the head object from the cache. Signed-off-by: Pritha Srivastava --- diff --git a/src/rgw/driver/d4n/rgw_sal_d4n.cc b/src/rgw/driver/d4n/rgw_sal_d4n.cc index 55da49e81f4d..9d45888d9908 100644 --- a/src/rgw/driver/d4n/rgw_sal_d4n.cc +++ b/src/rgw/driver/d4n/rgw_sal_d4n.cc @@ -159,6 +159,7 @@ bool D4NFilterObject::get_obj_attrs_from_cache(const DoutPrefixProvider* dpp, op if (found_in_cache) { /* Set metadata locally */ + ldpp_dout(dpp, 10) << "D4NFilterObject::" << __func__ << "(): obj is: " << this->get_obj().key.name << dendl; std::string instance; for (auto& attr : attrs) { if (attr.second.length() > 0) { @@ -343,6 +344,8 @@ int D4NFilterObject::get_obj_attrs(optional_yield y, const DoutPrefixProvider* d } this->load_obj_state(dpp, y); + this->obj = this->get_obj(); + ldpp_dout(dpp, 10) << "D4NFilterObject::" << __func__ << "(): this->obj is: " << this->obj.key.name << dendl; attrs = this->get_attrs(); this->set_obj_state_attrs(dpp, y, attrs); diff --git a/src/rgw/driver/d4n/rgw_sal_d4n.h b/src/rgw/driver/d4n/rgw_sal_d4n.h index 6788e1122d8a..ca1c78497bf8 100644 --- a/src/rgw/driver/d4n/rgw_sal_d4n.h +++ b/src/rgw/driver/d4n/rgw_sal_d4n.h @@ -105,6 +105,7 @@ class D4NFilterObject : public FilterObject { D4NFilterDriver* driver; std::string version; std::string prefix; + rgw_obj obj; public: struct D4NFilterReadOp : FilterReadOp { public: diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index a2016dddf6c8..133b997b7c75 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -7944,6 +7944,10 @@ int RGWRados::Object::Read::iterate(const DoutPrefixProvider *dpp, int64_t ofs, auto aio = rgw::make_throttle(window_size, y); get_obj_data data(store, cb, &*aio, ofs, y); + if (state.obj.empty()) { + state.obj = source->get_obj(); + } + int r = store->iterate_obj(dpp, source->get_ctx(), source->get_bucket_info(), state.obj, ofs, end, chunk_size, _get_obj_iterate_cb, &data, y); if (r < 0) {