]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix listing of multipart upload parts
authorYehuda Sadeh <yehuda@inktank.com>
Thu, 23 Jan 2014 21:48:28 +0000 (13:48 -0800)
committerYehuda Sadeh <yehuda@inktank.com>
Tue, 28 Jan 2014 21:43:26 +0000 (13:43 -0800)
Fixes: #7169
There are two issues here. One is that we may return more entries than
we should (as specified by max_parts). Second issue is that the
NextPartNumberMarker is set incorrectly. Both of these issues mainly
affect uploads with > 1000 parts, although can be triggered with less
than that.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_rest_s3.cc

index e8a10c1335d781ce3bece4c3481eea0da4c02d0a..c6eacce29f6ac30c9dab591d621b6b7d17a72fdf 100644 (file)
@@ -1534,14 +1534,14 @@ void RGWListMultipart_ObjStore_S3::send_response()
     s->formatter->dump_string("UploadId", upload_id);
     s->formatter->dump_string("StorageClass", "STANDARD");
     s->formatter->dump_int("PartNumberMarker", marker);
-    s->formatter->dump_int("NextPartNumberMarker", cur_max + 1);
+    s->formatter->dump_int("NextPartNumberMarker", cur_max);
     s->formatter->dump_int("MaxParts", max_parts);
     s->formatter->dump_string("IsTruncated", (test_iter == parts.end() ? "false" : "true"));
 
     ACLOwner& owner = policy.get_owner();
     dump_owner(s, owner.get_id(), owner.get_display_name());
 
-    for (; iter != parts.end(); ++iter) {
+    for (i = 0; iter != parts.end() && i < max_parts; ++iter, ++i) {
       RGWUploadPartInfo& info = iter->second;
 
       time_t sec = info.modified.sec();