]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: RGWSimpleRadosReadCR tolerates empty reads 11865/head
authorCasey Bodley <cbodley@redhat.com>
Fri, 14 Oct 2016 15:16:14 +0000 (11:16 -0400)
committerLoic Dachary <ldachary@redhat.com>
Wed, 9 Nov 2016 14:28:37 +0000 (15:28 +0100)
Fixes: http://tracker.ceph.com/issues/17568
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit c58ac1b0cc33505692f6244abc34ecea05e6d072)

src/rgw/rgw_cr_rados.h

index 24a284d63d52765f205d7907bd9da742f00c47fb..349dda3de70f2345b3f0abbdab82f6ca8f5c151c 100644 (file)
@@ -199,7 +199,7 @@ public:
   ~RGWSimpleRadosReadCR() {
     request_cleanup();
   }
-                                                         
+
   void request_cleanup() {
     if (req) {
       req->finish();
@@ -239,9 +239,17 @@ int RGWSimpleRadosReadCR<T>::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;
     }