]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG::do_update_log_missing: take the pg lock in the callback 11997/head
authorSamuel Just <sjust@redhat.com>
Thu, 3 Nov 2016 00:38:49 +0000 (17:38 -0700)
committerAbhishek Varshney <abhishek.varshney@flipkart.com>
Tue, 15 Nov 2016 11:08:19 +0000 (16:38 +0530)
Fixes: http://tracker.ceph.com/issues/17789
Signed-off-by: Samuel Just <sjust@redhat.com>
(cherry picked from commit 3ba2e2e21a187474d556722d1ef30c79628f1c50)

src/osd/ReplicatedPG.cc

index 4b879d94057affe18d9f3b82b64bc0be7fd66eae..dcc9860bc8c7a5da196ed8265a023b3021255033 100644 (file)
@@ -9685,13 +9685,13 @@ void ReplicatedPG::do_update_log_missing(OpRequestRef &op)
   assert(m->get_type() == MSG_OSD_PG_UPDATE_LOG_MISSING);
   ObjectStore::Transaction t;
   append_log_entries_update_missing(m->entries, t);
-  // TODO FIX
 
   Context *complete = new FunctionContext(
-      [=](int) {
-       MOSDPGUpdateLogMissing *msg =
-         static_cast<MOSDPGUpdateLogMissing*>(
-           op->get_req());
+    [=](int) {
+      MOSDPGUpdateLogMissing *msg = static_cast<MOSDPGUpdateLogMissing*>(
+       op->get_req());
+      lock();
+      if (!pg_has_reset_since(msg->get_epoch())) {
        MOSDPGUpdateLogMissingReply *reply =
          new MOSDPGUpdateLogMissingReply(
            spg_t(info.pgid.pgid, primary_shard().shard),
@@ -9700,7 +9700,9 @@ void ReplicatedPG::do_update_log_missing(OpRequestRef &op)
            msg->get_tid());
        reply->set_priority(CEPH_MSG_PRIO_HIGH);
        msg->get_connection()->send_message(reply);
-      });
+      }
+      unlock();
+    });
 
   /* Hack to work around the fact that ReplicatedBackend sends
    * ack+commit if commit happens first */