]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Don't loop forever when reading data from 0 sized segment. 11567/head
authorMarcus Watts <mwatts@redhat.com>
Fri, 14 Oct 2016 01:12:36 +0000 (21:12 -0400)
committerMarcus Watts <mwatts@redhat.com>
Wed, 19 Oct 2016 23:24:46 +0000 (19:24 -0400)
The 0 sized segment can arise depending on how
the client uploads the object in the first place.
The cpu loop then happens during a swift `GET'.

Signed-off-by: Marcus Watts <mwatts@redhat.com>
src/rgw/rgw_op.cc

index a6f22b2f9fc0d0ecbd1d07372607b829df7c8127..fea4a2c46039da52b95f84ccab99b70e62061af5 100644 (file)
@@ -825,6 +825,10 @@ int RGWGetObj::read_user_manifest_part(rgw_bucket& bucket,
     return -EPERM;
   }
 
+  if (ent.size == 0) {
+    return 0;
+  }
+
   perfcounter->inc(l_rgw_get_b, cur_end - cur_ofs);
   while (cur_ofs <= cur_end) {
     bufferlist bl;
@@ -834,6 +838,12 @@ int RGWGetObj::read_user_manifest_part(rgw_bucket& bucket,
 
     off_t len = bl.length();
     cur_ofs += len;
+    if (!len) {
+        ldout(s->cct, 0) << "ERROR: read 0 bytes; ofs=" << cur_ofs
+           << " end=" << cur_end << " from obj=" << ent.key.name
+           << "[" << ent.key.instance << "]" << dendl;
+        return -EIO;
+    }
     op_ret = 0; /* XXX redundant? */
     perfcounter->tinc(l_rgw_get_lat,
                       (ceph_clock_now(s->cct) - start_time));
@@ -1103,6 +1113,11 @@ int RGWGetObj::handle_user_manifest(const char *prefix)
     return r;
   }
 
+  if (!total_len) {
+    bufferlist bl;
+    send_response_data(bl, 0, 0);
+  }
+
   return 0;
 }