]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: calculate hash after writing data 2565/head
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 19 Sep 2014 03:53:10 +0000 (20:53 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 23 Sep 2014 20:55:49 +0000 (13:55 -0700)
Since data is written asynchronously, we should do the hash calculation
while it's pending.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
(cherry picked from commit 5bb94ede19a50543a02a8019ed6c9680b3852d4e)

src/rgw/rgw_rados.cc

index ffa8a723ef32c39e0421f87f90a0b56df01ce771..44ff649202fb0e9feaa1d1a02567a82c3bb6ba3d 100644 (file)
@@ -1084,11 +1084,11 @@ int RGWPutObjProcessor_Atomic::handle_data(bufferlist& bl, off_t ofs, MD5 *hash,
   bool exclusive = (!write_ofs && immutable_head()); /* immutable head object, need to verify nothing exists there
                                                         we could be racing with another upload, to the same
                                                         object and cleanup can be messy */
-  if (hash) {
-    hash->Update((const byte *)bl.c_str(), bl.length());
-  }
   int ret = write_data(bl, write_ofs, phandle, exclusive);
   if (ret >= 0) { /* we might return, need to clear bl as it was already sent */
+    if (hash) {
+      hash->Update((const byte *)bl.c_str(), bl.length());
+    }
     bl.clear();
   }
   return ret;