From da653fc3594d49bdac5dc00129c8aa5fd227d6c0 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Thu, 7 Jul 2016 18:01:54 -0700 Subject: [PATCH] rgw: adjust manifest head object adjust the manifest head object: - when reading manifest, set the head object to the object we read the manifest from (and its size). Some manifests are broken and point at a different object - when copying multipart object, set the manifest head object to point at the new head object Signed-off-by: Yehuda Sadeh (cherry picked from commit 419264586fc46337322f0d60b0ffcdcce3bb5c5a) --- src/rgw/rgw_rados.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 9056eee7d330e..68d3345546105 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -4244,6 +4244,8 @@ int RGWRados::copy_obj(RGWObjectCtx& obj_ctx, } pmanifest->set_head(dest_obj, first_chunk.length()); + } else { + pmanifest->set_head(dest_obj, 0); } write_op.meta.data = &first_chunk; @@ -5047,6 +5049,8 @@ int RGWRados::get_obj_state_impl(RGWObjectCtx *rctx, rgw_obj& obj, RGWObjState * try { ::decode(s->manifest, miter); s->has_manifest = true; + s->manifest.set_head(obj, s->size); /* patch manifest to reflect the head we just read, some manifests might be + broken due to old bugs */ s->size = s->manifest.get_obj_size(); } catch (buffer::error& err) { ldout(cct, 20) << "ERROR: couldn't decode manifest" << dendl; -- 2.39.5