mirror of
https://github.com/ceph/ceph
synced 2025-02-21 01:47:25 +00:00
kstore: fix dest onode process logic of clone
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
This commit is contained in:
parent
8065b8ab34
commit
7ce6d068a1
@ -3515,20 +3515,23 @@ int KStore::_clone(TransContext *txc,
|
||||
r = -ENOENT;
|
||||
goto out;
|
||||
}
|
||||
newo = c->get_onode(new_oid, true);
|
||||
assert(newo);
|
||||
newo->exists = true;
|
||||
_assign_nid(txc, newo);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user