]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "kstore: fix dest onode process logic of clone"
authorSage Weil <sage@redhat.com>
Wed, 27 Jan 2016 19:22:33 +0000 (14:22 -0500)
committerSage Weil <sage@redhat.com>
Wed, 27 Jan 2016 19:22:33 +0000 (14:22 -0500)
This reverts commit 7ce6d068a1fd666940068df702f29bdd5ee8faf0.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/kstore/KStore.cc

index 17f0ab778431906280efaa1987c1a86007e30332..8905cf121a7dfcc05af19a331421a05e7b3b3742 100644 (file)
@@ -3509,23 +3509,20 @@ int KStore::_clone(TransContext *txc,
     r = -ENOENT;
     goto out;
   }
-  newo = c->get_onode(new_oid, false);
-  if (newo) {
-    // already exist, truncate any old data
-    r = _do_truncate(txc, newo, 0);
-    if (r < 0)
-      goto out;
-  } else {
-    // does not exist, create it
-    newo = c->get_onode(new_oid, true);
-    _assign_nid(txc, newo);
-  }
+  newo = c->get_onode(new_oid, true);
+  assert(newo);
+  newo->exists = true;
+  _assign_nid(txc, newo);
 
   r = _do_read(oldo, 0, oldo->onode.size, bl, 0);
   if (r < 0)
     goto out;
 
+  // truncate any old data
+  r = _do_truncate(txc, newo, 0);
+  if (r < 0)
+    goto out;
+
   r = _do_write(txc, newo, 0, oldo->onode.size, bl, 0);
 
   newo->onode.attrs = oldo->onode.attrs;