]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ReplicatedPG: lock snapdir obc during write 1931/head
authorSamuel Just <sam.just@inktank.com>
Thu, 3 Oct 2013 01:00:04 +0000 (18:00 -0700)
committerSamuel Just <sam.just@inktank.com>
Thu, 22 May 2014 21:01:44 +0000 (14:01 -0700)
Otherwise, we won't block properly in prep_push_backfill_object.

Signed-off-by: Samuel Just <sam.just@inktank.com>
(cherry picked from commit b87bc2311aa4da065477f402a869e2edc1558e2f)

Conflicts:
src/osd/ReplicatedPG.h

src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 47b28a412a183aa2222be6a13505fd3b2df10eb1..443e98d3d80dfcc8e3888948c788d05a28570735 100644 (file)
@@ -3952,10 +3952,19 @@ void ReplicatedPG::apply_repop(RepGather *repop)
   if (repop->ctx->clone_obc)
     repop->ctx->clone_obc->ondisk_write_lock();
 
+  bool unlock_snapset_obc = false;
+  if (repop->ctx->snapset_obc && repop->ctx->snapset_obc->obs.oi.soid !=
+      repop->obc->obs.oi.soid) {
+    repop->ctx->snapset_obc->ondisk_write_lock();
+    unlock_snapset_obc = true;
+  }
+
   Context *oncommit = new C_OSD_OpCommit(this, repop);
   Context *onapplied = new C_OSD_OpApplied(this, repop);
-  Context *onapplied_sync = new C_OSD_OndiskWriteUnlock(repop->obc,
-                                                       repop->ctx->clone_obc);
+  Context *onapplied_sync = new C_OSD_OndiskWriteUnlock(
+    repop->obc,
+    repop->ctx->clone_obc,
+    unlock_snapset_obc ? repop->ctx->snapset_obc : 0);
   int r = osd->store->queue_transactions(osr.get(), repop->tls, onapplied, oncommit, onapplied_sync, repop->ctx->op);
   if (r) {
     derr << "apply_repop  queue_transactions returned " << r << " on " << *repop << dendl;
index 41c8106ea000933fb79b6dcbf469bb9646679dd0..6170977537479fbe399c17f8817276d8a0f28890 100644 (file)
@@ -819,12 +819,18 @@ protected:
     }
   };
   struct C_OSD_OndiskWriteUnlock : public Context {
-    ObjectContext *obc, *obc2;
-    C_OSD_OndiskWriteUnlock(ObjectContext *o, ObjectContext *o2=0) : obc(o), obc2(o2) {}
+    ObjectContext *obc, *obc2, *obc3;
+    C_OSD_OndiskWriteUnlock(
+      ObjectContext *o,
+      ObjectContext *o2=0,
+      ObjectContext *o3=0)
+      : obc(o), obc2(o2), obc3(o3) {}
     void finish(int r) {
       obc->ondisk_write_unlock();
       if (obc2)
        obc2->ondisk_write_unlock();
+      if (obc3)
+       obc3->ondisk_write_unlock();
     }
   };
   struct C_OSD_OndiskWriteUnlockList : public Context {