From: Somnath Roy Date: Sat, 9 Jul 2016 02:41:46 +0000 (-0400) Subject: Bluestore: Fixed a Bluestore crash X-Git-Tag: ses5-milestone5~381 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bf70bcb6c54e4d6404533bc91781a5ef77d62033;p=ceph.git 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 --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index cc91d89af6f2..cd2a9a12adca 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