]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
os/bluestore: fix a bug causing unexpected Onode's unpinned state. 39230/head
authorIgor Fedotov <ifedotov@suse.com>
Sat, 23 Jan 2021 17:33:13 +0000 (20:33 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Tue, 2 Feb 2021 11:23:47 +0000 (14:23 +0300)
commit99a48f43af30fbf457d5d0f9f10a7c40d1231c39
tree86394a8011208a0407ef7ed8b3f59f286fba10d7
parentaf61d0e16cce88099b831319dba646b5e1852170
os/bluestore: fix a bug causing unexpected Onode's unpinned state.

There could be a race for Onodes put() and get() methods:

put()(pinned, nref=3)
  int n = --nref; (nref = 2)
  if (n == 2) {
    ..
    std::lock_guard l(ocs->lock);
    ...
    pinned = pinned && nref > 2; (= false)
    ...                                     get()
    if (r) {                                ++nref; (=3)
      n = --nref; (nref = 2)                return;
    }
    ...
    return

As a result nref = 2, pinned = false which is wrong

Signed-off-by: Igor Fedotov <ifedotov@suse.com>
(cherry picked from commit ea0fc57ef57eddc1fb9610850ae766c9fd582bae)
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h