From c7c9ef700afd7d40320ca1822286c5e4d3e1fddb Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Fri, 14 Oct 2016 11:16:14 -0400 Subject: [PATCH] rgw: RGWSimpleRadosReadCR tolerates empty reads Fixes: http://tracker.ceph.com/issues/17568 Signed-off-by: Casey Bodley (cherry picked from commit c58ac1b0cc33505692f6244abc34ecea05e6d072) --- src/rgw/rgw_cr_rados.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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; } -- 2.47.3