From: Yehuda Sadeh Date: Wed, 24 Oct 2012 18:26:53 +0000 (-0700) Subject: rgw: break out of read loop if we got zero bytes X-Git-Tag: v0.54~18 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=488b019adfbcd174bdc8adf0ac1b8dd9353f9304;p=ceph.git rgw: break out of read loop if we got zero bytes If the part that we're reading is corrupted and we end up reading zero bytes, we need to exit, otherwise we'd just loop forever. Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index bf4de3f2ea8..f227aa3208c 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -578,6 +578,13 @@ void RGWGetObj::execute() goto done; } len = ret; + + if (!len) { + dout(0) << "WARNING: failed to read object, returned zero length" << dendl; + ret = -EIO; + goto done; + } + ofs += len; ret = 0;