]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: Only pass that decremented nref to 0 deletes object
authorAdam Kupczyk <akupczyk@redhat.com>
Sun, 29 Nov 2020 09:05:01 +0000 (04:05 -0500)
committerIgor Fedotov <ifedotov@suse.com>
Tue, 2 Feb 2021 11:20:43 +0000 (14:20 +0300)
Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
(cherry picked from commit b0e2964ac8a8f3a273046ab8e87a62c1bc4db55c)

src/os/bluestore/BlueStore.cc

index 99f3c900f401241463a85297f9988dbb3b0447cc..4d855529f1f6e1dbf3ca78a5fc8ec0dd041cc550 100644 (file)
@@ -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;
   }
 }