]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
os/bluestore: fix SharedBlobSet deregister race
authorSage Weil <sage@redhat.com>
Sun, 10 Jun 2018 20:57:31 +0000 (15:57 -0500)
committerSage Weil <sage@redhat.com>
Wed, 20 Jun 2018 19:38:57 +0000 (14:38 -0500)
commit81d32633d96f8995df0ed084d5db3da1dbc47780
tree1c94ba34a581d7955650d1d1088cf065104c47ce
parent64b144fca147a4893b4c0aa60efc11c9d5eb5c3e
os/bluestore: fix SharedBlobSet deregister race

In commit 8c8944b2c45ca9dc5b8fd4db1590e1d24206c0b3 we fixed one narrow race
and introduced a new (probably less narrow) one:

A: put shared blob foo, nref = 0, start removing self from set
B: open_shared_blob -> lookup gets nullptr (nref==null), creates a new shared blob
  B: takes lock, sets sb_map[sbid] = newblob
A: gets lock, erases sb_map[sbid]
B: open_shared_blob -> lookup gets null, creates another new shared blob

Fix by only removing the sb_map entry for the nref=0 sb if it still points
to us.  If it doesn't, that means some new blob has shown up in its place.

Fixes: http://tracker.ceph.com/issues/24319
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 345ea53bd30426d4e6159d0866497d5a8bf6f327)
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h