]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
os/bluestore: simplify and fix SharedBlob::put() 22351/head
authorSage Weil <sage@redhat.com>
Mon, 21 May 2018 15:06:37 +0000 (10:06 -0500)
committerPrashant D <pdhange@redhat.com>
Thu, 31 May 2018 09:53:21 +0000 (05:53 -0400)
commit83b33c13960ab306cc33290bc7b2e3704a207db9
treed0414862d3bf6cc98732afa30ea2b08cd6e379d9
parent51c205873c41efbd0438680441fdff2be375a442
os/bluestore: simplify and fix SharedBlob::put()

There is a narrow race possible:

A: lookup foo
A: put on foo
A:   foo --nref == 0
B: lookup foo
B: put foo
B:   foo --nref == 0
B: try_remove() succeeds, removes
A: try_remove() tries to remove foo again, probably crashes

We could fix this by flagging the object in some way to indicate it was
removed (maybe clearing parent?), but then we need to be careful about
dereferencing foo to get parent from put().

Fix this by moving to a simpler model: make lookup fail if nref == 0.
This eliminates the races around put() entirely because once nref reaches
0 it never goes up again.

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