]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
os/bluestore: fix SharedBlob unregistration 18805/head
authorSage Weil <sage@redhat.com>
Wed, 8 Nov 2017 04:05:10 +0000 (22:05 -0600)
committerSage Weil <sage@redhat.com>
Thu, 9 Nov 2017 17:57:13 +0000 (11:57 -0600)
commit78a465b90b1c5187cfec9f25eb58b3bf617ca39b
tree552a0ddce91f05e961a1820d8d35e08e6eb8c2d3
parent51059a60d8c9a502ce15bc5c8beb61cf17ee96f2
os/bluestore: fix SharedBlob unregistration

We use the SharedBlobSet remove() in three cases:

- from SharedBlob::put(), we try to remove ourselves from the set, but
  have to deal with a racing lookup, so the removal is conditional on
  nref still being 0.
- from split_cache(), we move the SharedBlob to another collection
- from make_blob_unshared(), we remove the entry when we clear the sbid.

The problem is that the condtiional remove() (for the first case) was being
used for all three cases, and in the second two cases nref is always != 0,
so it doesn't actually happen.  This can lead to a crash during cache
shutdown.

Fix by making two variants: remove() that is unconditional, and
try_remove() that is conditional.

Set the sb->coll pointer after because remove() asserts the parent matches
where we are unregistering.

Fixes: http://tracker.ceph.com/issues/22039
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h