]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix nested transaction in all_activated_and_committed()
authorSage Weil <sage.weil@dreamhost.com>
Sun, 29 Apr 2012 14:59:44 +0000 (07:59 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Sun, 29 Apr 2012 15:11:25 +0000 (08:11 -0700)
all_activated_and_committed() is called from _activate_committed(), called
from a objectstore completion, and also from the state machine, which is
part of a larger transaction.

Instead, set dirty_info, and build/apply a transaction in the caller
(the completion) as needed.  Fixes part of #2360.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/osd/PG.cc

index b447dd8067520777b2f8437d26aff25b7604d76b..d09a4f7653328531bcc35a33fa54dd7473bc82f1 100644 (file)
@@ -1491,6 +1491,14 @@ void PG::_activate_committed(epoch_t e, entity_inst_t& primary)
     m->pg_list.push_back(make_pair(i, pg_interval_map_t()));
     osd->cluster_messenger->send_message(m, primary);
   }
+
+  if (dirty_info) {
+    ObjectStore::Transaction *t = new ObjectStore::Transaction;
+    write_info(*t);
+    int tr = osd->store->queue_transaction(&osr, t);
+    assert(tr == 0);
+  }
+
   unlock();
   put();
 }
@@ -1509,10 +1517,7 @@ void PG::all_activated_and_committed()
   info.history.last_epoch_started = get_osdmap()->get_epoch();
   share_pg_info();
 
-  ObjectStore::Transaction *t = new ObjectStore::Transaction;
-  write_info(*t);
-  int tr = osd->store->queue_transaction(&osr, t);
-  assert(tr == 0);
+  dirty_info = true;
 }
 
 void PG::queue_snap_trim()