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

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_rados.cc

index 7e87674dbb3c7fe0c631f33c5e8099033cb49f21..1d05509d6c8bfe8565acd20d7111cec8ceb4c13a 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;