From: Adam Kupczyk Date: Sun, 29 Nov 2020 09:05:01 +0000 (-0500) Subject: os/bluestore: Only pass that decremented nref to 0 deletes object X-Git-Tag: v15.2.9~8^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ac153bb5e1aa2cb5a75d7bdd0e49fba1e563c5bc;p=ceph.git os/bluestore: Only pass that decremented nref to 0 deletes object Signed-off-by: Adam Kupczyk (cherry picked from commit b0e2964ac8a8f3a273046ab8e87a62c1bc4db55c) --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 99f3c900f401..4d855529f1f6 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -3561,7 +3561,8 @@ void BlueStore::Onode::get() { } } void BlueStore::Onode::put() { - if (--nref == 2) { + int n = --nref; + if (n == 2) { c->get_onode_cache()->unpin(this, [&]() { bool was_pinned = pinned; pinned = pinned && nref > 2; // intentionally use > not >= as we have @@ -3569,12 +3570,12 @@ void BlueStore::Onode::put() { bool r = was_pinned && !pinned; // additional decrement for newly unpinned instance if (r) { - --nref; + n = --nref; } return cached && r; }); } - if (nref == 0) { + if (n == 0) { delete this; } }