]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add support for normalisation of ranged SLO requests.
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Wed, 18 Nov 2015 19:15:09 +0000 (20:15 +0100)
committerRadoslaw Zarzynski <rzarzynski@mirantis.com>
Tue, 8 Dec 2015 16:58:09 +0000 (17:58 +0100)
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
src/rgw/rgw_op.cc

index 7e119aa487c9760d6ed3d9f834ea70a2a9daf292..906b1663807a204766678b9f8befcf3bc8b28df6 100644 (file)
@@ -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<off_t>(total_len));
+  }
+
+  if (end < 0 || end >= static_cast<off_t>(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;
 }