From: Sage Weil Date: Wed, 27 Jan 2016 19:22:33 +0000 (-0500) Subject: Revert "kstore: fix dest onode process logic of clone" X-Git-Tag: v10.0.4~101^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=dc3faedb85944b1b795de169a668b03ef72b6817;p=ceph.git Revert "kstore: fix dest onode process logic of clone" This reverts commit 7ce6d068a1fd666940068df702f29bdd5ee8faf0. Signed-off-by: Sage Weil --- diff --git a/src/os/kstore/KStore.cc b/src/os/kstore/KStore.cc index 17f0ab778431..8905cf121a7d 100644 --- a/src/os/kstore/KStore.cc +++ b/src/os/kstore/KStore.cc @@ -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;