]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
os/bluestore: fix SharedBlob unregistration 18983/head
authorSage Weil <sage@redhat.com>
Wed, 8 Nov 2017 04:05:10 +0000 (22:05 -0600)
committerPrashant D <pdhange@redhat.com>
Fri, 17 Nov 2017 10:05:48 +0000 (05:05 -0500)
commit96c981ce6b00520a94385228bcf70a90c5ae8ff9
tree472dbfb5d902ffaf326abcfcc2756a015b092ca5
parent9515da277737ad81d48f5c032f627f3cb919f746
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>
(cherry picked from commit 78a465b90b1c5187cfec9f25eb58b3bf617ca39b)
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h