From bf70bcb6c54e4d6404533bc91781a5ef77d62033 Mon Sep 17 00:00:00 2001 From: Somnath Roy Date: Fri, 8 Jul 2016 22:41:46 -0400 Subject: [PATCH] Bluestore: Fixed a Bluestore crash A bluestore race condition is been fixed by protecting txc structures within _txc_state_poc with collection lock. Mark's comments: This fixes segfaults during random write tests with bluestore. This passes "ceph_test_objectstore --gtest_filter=*/2". This may introduce a small performance regresion, though there is enough noise in the results to make it inconclusive. Closes #10220 Signed-off-by: Somnath Roy --- src/os/bluestore/BlueStore.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index cc91d89af6f..cd2a9a12adc 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -4589,11 +4589,19 @@ void BlueStore::_txc_state_proc(TransContext *txc) txc->log_state_latency(logger, l_bluestore_state_io_done_lat); txc->state = TransContext::STATE_KV_QUEUED; // FIXME: use a per-txc dirty blob list? + + if (txc->first_collection) { + (txc->first_collection)->lock.get_read(); + } for (auto& o : txc->onodes) { - for (auto& p : o->blob_map.blob_map) { - p.bc.finish_write(txc->seq); + for (auto& p : o->blob_map.blob_map) { + p.bc.finish_write(txc->seq); } } + if (txc->first_collection) { + (txc->first_collection)->lock.put_read(); + } + if (!g_conf->bluestore_sync_transaction) { if (g_conf->bluestore_sync_submit_transaction) { _txc_finalize_kv(txc, txc->t); @@ -5160,7 +5168,6 @@ int BlueStore::queue_transactions( } _txc_write_nodes(txc, txc->t); - // journal wal items if (txc->wal_txn) { // move releases to after wal -- 2.47.3