From: xie xingguo Date: Tue, 19 Jan 2016 10:43:19 +0000 (+0800) Subject: BlueStore: fix nid overwritten of write/zero X-Git-Tag: v10.0.4~178^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fde0f0297aaf2f2717ec1b5a4c55295452817d0c;p=ceph.git BlueStore: fix nid overwritten of write/zero Signed-off-by: xie xingguo --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 304a02ac936..c1da65b47cb 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -5286,8 +5286,11 @@ int BlueStore::_write(TransContext *txc, << " " << offset << "~" << length << dendl; RWLock::WLocker l(c->lock); - OnodeRef o = c->get_onode(oid, true); - _assign_nid(txc, o); + OnodeRef o = c->get_onode(oid, false); + if (!o) { + o = c->get_onode(oid, true); + _assign_nid(txc, o); + } int r = _do_write(txc, c, o, offset, length, bl, fadvise_flags); txc->write_onode(o); @@ -5323,9 +5326,13 @@ int BlueStore::_zero(TransContext *txc, RWLock::WLocker l(c->lock); EnodeRef enode; - OnodeRef o = c->get_onode(oid, true); - _dump_onode(o); - _assign_nid(txc, o); + OnodeRef o = c->get_onode(oid, false); + if (o) { + _dump_onode(o); + } else { + o = c->get_onode(oid, true); + _assign_nid(txc, o); + } // overlay _do_overlay_trim(txc, o, offset, length);