From 630eac10cfbe8f2b8e0a4015b65aea018bdb525e Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Wed, 18 Nov 2015 20:15:09 +0100 Subject: [PATCH] rgw: add support for normalisation of ranged SLO requests. Signed-off-by: Radoslaw Zarzynski --- src/rgw/rgw_op.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 7e119aa487c..906b1663807 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -1052,9 +1052,21 @@ int RGWGetObj::handle_slo_manifest(bufferlist& bl) s->obj_size = slo_info.total_size; ldout(s->cct, 20) << "s->obj_size=" << s->obj_size << dendl; - int r = iterate_slo_parts(s->cct, store, start_ofs, end, slo_parts, get_obj_user_manifest_iterate_cb, (void *)this); - if (r < 0) + if (ofs < 0) { + ofs = total_len - std::min(-ofs, static_cast(total_len)); + } + + if (end < 0 || end >= static_cast(total_len)) { + end = total_len - 1; + } + + total_len = end - ofs + 1; + + int r = iterate_slo_parts(s->cct, store, ofs, end, slo_parts, + get_obj_user_manifest_iterate_cb, (void *)this); + if (r < 0) { return r; + } return 0; } -- 2.47.3