From: Casey Bodley Date: Fri, 14 Oct 2016 15:16:14 +0000 (-0400) Subject: rgw: RGWSimpleRadosReadCR tolerates empty reads X-Git-Tag: v10.2.6~162^2^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c7c9ef700afd7d40320ca1822286c5e4d3e1fddb;p=ceph.git rgw: RGWSimpleRadosReadCR tolerates empty reads Fixes: http://tracker.ceph.com/issues/17568 Signed-off-by: Casey Bodley (cherry picked from commit c58ac1b0cc33505692f6244abc34ecea05e6d072) --- diff --git a/src/rgw/rgw_cr_rados.h b/src/rgw/rgw_cr_rados.h index 24a284d63d52..349dda3de70f 100644 --- a/src/rgw/rgw_cr_rados.h +++ b/src/rgw/rgw_cr_rados.h @@ -199,7 +199,7 @@ public: ~RGWSimpleRadosReadCR() { request_cleanup(); } - + void request_cleanup() { if (req) { req->finish(); @@ -239,9 +239,17 @@ int RGWSimpleRadosReadCR::request_complete() if (ret < 0) { return ret; } - bufferlist::iterator iter = bl.begin(); try { - ::decode(*result, iter); + bufferlist::iterator iter = bl.begin(); + if (iter.end()) { + // allow successful reads with empty buffers. ReadSyncStatus coroutines + // depend on this to be able to read without locking, because the + // cls lock from InitSyncStatus will create an empty object if it didnt + // exist + *result = T(); + } else { + ::decode(*result, iter); + } } catch (buffer::error& err) { return -EIO; }