From 1c70f86316e5ff29ef7168ebfb3513def770b436 Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Tue, 19 Jan 2016 18:55:25 +0800 Subject: [PATCH] BlueStore: fix dest onode process logic of clone Signed-off-by: xie xingguo --- src/os/bluestore/BlueStore.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index c1da65b47cbf8..7a8fa47bb5117 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; -- 2.39.5