Skip to content

Commit

Permalink
Merge pull request #11567 from ceph/wip-master-rgw-0lenfix2
Browse files Browse the repository at this point in the history
Don't loop forever when reading data from 0 sized segment.

Reviewed-by: Yehuda Sadeh <yehuda@redhat.com>
  • Loading branch information
yehudasa committed Oct 19, 2016
2 parents cb82731 + 46c5f97 commit 48bb2cd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/rgw/rgw_op.cc
Expand Up @@ -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;
Expand All @@ -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));
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 48bb2cd

Please sign in to comment.