]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Bluestore: Fixed a Bluestore crash
authorSomnath Roy <somnath.roy@sandisk.com>
Sat, 9 Jul 2016 02:41:46 +0000 (22:41 -0400)
committerMark Nelson <mnelson@redhat.com>
Mon, 18 Jul 2016 02:26:31 +0000 (21:26 -0500)
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 <somnath.roy@sandisk.com>
src/os/bluestore/BlueStore.cc

index cc91d89af6f2ac9ec476038991a965a90bf33ca4..cd2a9a12adcae788bf01018b0a8b83996ac5208b 100644 (file)
@@ -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