]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
os/bluestore: fix races on SharedBlob::coll in ~SharedBlob. 22972/head
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 10 Jul 2018 23:14:54 +0000 (01:14 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Wed, 11 Jul 2018 00:01:45 +0000 (02:01 +0200)
commitd1b16749c7d32eead6e326c492ef9edf0d03a2b8
treec9d5319ac46ef5282855275498528f03e278de98
parent5864722eae1a37aeb5fe21ca2545e7471789ed64
os/bluestore: fix races on SharedBlob::coll in ~SharedBlob.

Example scenario:
  ```
  A: BlueStore::Collection::split_cache(src, dest)
  A: std::lock(src->cache->lock, dest->cache->lock)

  B: SharedBlob::~SharedBlob
  B: waits coll->cache->lock // coll == src

  A: sb->coll := dest
  A: unlocks both src and dest's cache mutexes

  C: // any locked operation on dest's cache
  C: acquires dest->cache->lock
  C: begins the op

  B: // with the src's cache mutex acquired
  B: BufferSpace::_clear(coll->cache) // coll == dest
  B: // oops, B operates on cache already locked by C
  ```

Fixes: http://tracker.ceph.com/issues/24859
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/os/bluestore/BlueStore.cc