From: Marcus Watts Date: Fri, 14 Oct 2016 01:12:36 +0000 (-0400) Subject: Don't loop forever when reading data from 0 sized segment. X-Git-Tag: v10.2.4~18^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F11626%2Fhead;p=ceph.git Don't loop forever when reading data from 0 sized segment. 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 (cherry picked from commit 46c5f9773246522e66bb2cca49345d0b62a16c42) --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 4f69c7879dc..5382f6abfd7 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -726,6 +726,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; @@ -735,6 +739,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)); @@ -1004,6 +1014,11 @@ int RGWGetObj::handle_user_manifest(const char *prefix) return r; } + if (!total_len) { + bufferlist bl; + send_response_data(bl, 0, 0); + } + return 0; }