]> 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)
committerGreg Farnum <greg@inktank.com>
Wed, 11 Jun 2014 17:47:40 +0000 (10:47 -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>
src/os/FileStore.cc

index 0eb7063b14524bc84b09a01fa433de0e3ca06b1d..9a59dc5617a4b012ea2476b5c86c462acf05283c 100644 (file)
@@ -2936,11 +2936,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;