From: xie xingguo Date: Tue, 19 Jan 2016 10:55:25 +0000 (+0800) Subject: BlueStore: fix dest onode process logic of clone X-Git-Tag: v10.0.4~178^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1c70f86316e5ff29ef7168ebfb3513def770b436;p=ceph.git BlueStore: fix dest onode process logic of clone Signed-off-by: xie xingguo --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index c1da65b47cb..7a8fa47bb51 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -5970,18 +5970,22 @@ int BlueStore::_clone(TransContext *txc, r = -ENOENT; goto out; } - newo = c->get_onode(new_oid, true); + + newo = c->get_onode(new_oid, false); + if (newo) { + r = _do_truncate(txc, c, newo, 0); + if (r < 0) + goto out; + } else { + newo = c->get_onode(new_oid, true); + _assign_nid(txc, newo); + } assert(newo); newo->exists = true; - _assign_nid(txc, newo); // data oldo->flush(); - r = _do_truncate(txc, c, newo, 0); - if (r < 0) - goto out; - if (g_conf->bluestore_clone_cow) { EnodeRef e = c->get_enode(newo->oid.hobj.get_hash()); bool marked = false;