]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
FileStore: make _clone() copy spill out marker
authorHaomai Wang <haomaiwang@gmail.com>
Sat, 7 Jun 2014 06:32:23 +0000 (14:32 +0800)
committerSage Weil <sage@inktank.com>
Tue, 24 Jun 2014 19:12:25 +0000 (12:12 -0700)
Previously we were not doing so, and that resulted in unpredictable loss
of xattrs from the client's perspective.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
(cherry picked from commit 239476a92849159d2a8966d90ca055c116bee91e)

src/os/FileStore.cc

index 9d6252ca4ca9c41a7f593abab2e0ff563a866151..2fc762a047d2259097596a7afa40d7d2535b8372 100644 (file)
@@ -2905,11 +2905,23 @@ int FileStore::_clone(coll_t cid, const ghobject_t& oldoid, const ghobject_t& ne
   }
 
   {
+    char buf[2];
     map<string, bufferptr> aset;
     r = _fgetattrs(**o, aset, false);
     if (r < 0)
       goto out3;
 
+    r = chain_fgetxattr(**o, XATTR_SPILL_OUT_NAME, buf, sizeof(buf));
+    if (r >= 0 && !strncmp(buf, XATTR_NO_SPILL_OUT, sizeof(XATTR_NO_SPILL_OUT))) {
+      r = chain_fsetxattr(**n, XATTR_SPILL_OUT_NAME, XATTR_NO_SPILL_OUT,
+                          sizeof(XATTR_NO_SPILL_OUT));
+    } else {
+      r = chain_fsetxattr(**n, XATTR_SPILL_OUT_NAME, XATTR_SPILL_OUT,
+                          sizeof(XATTR_SPILL_OUT));
+    }
+    if (r < 0)
+      goto out3;
+
     r = _fsetattrs(**n, aset);
     if (r < 0)
       goto out3;