]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc: implement Objecter::set_epoch_barrier
authorJohn Spray <john.spray@redhat.com>
Tue, 9 Dec 2014 14:02:33 +0000 (14:02 +0000)
committerJohn Spray <john.spray@redhat.com>
Tue, 16 Dec 2014 20:45:58 +0000 (20:45 +0000)
For use in MDS and Client when they want to wait
for a particular OSDMap epoch before using caps
that depend on a prior blacklist or op cancellation.

Signed-off-by: John Spray <john.spray@redhat.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index f5df0bb0749bb2d3dd5ad27caaed6315e207f6c1..cc238fe697c385dc88bf1fd9585c069956eb596e 100644 (file)
@@ -844,7 +844,7 @@ void Objecter::handle_osd_map(MOSDMap *m)
   bool pausewr = osdmap->test_flag(CEPH_OSDMAP_PAUSEWR) || osdmap_full_flag();
 
   // was/is paused?
-  if (was_pauserd || was_pausewr || pauserd || pausewr) {
+  if (was_pauserd || was_pausewr || pauserd || pausewr || osdmap->get_epoch() < epoch_barrier) {
     int r = _maybe_request_map();
     assert(r == 0);
   }
@@ -2048,7 +2048,8 @@ bool Objecter::target_should_be_paused(op_target_t *t)
   bool pausewr = osdmap->test_flag(CEPH_OSDMAP_PAUSEWR) || osdmap_full_flag();
 
   return (t->flags & CEPH_OSD_FLAG_READ && pauserd) ||
-         (t->flags & CEPH_OSD_FLAG_WRITE && pausewr);
+         (t->flags & CEPH_OSD_FLAG_WRITE && pausewr) ||
+         (osdmap->get_epoch() < epoch_barrier);
 }
 
 
@@ -4241,3 +4242,22 @@ Objecter::~Objecter()
   assert(!logger);
 }
 
+/**
+ * Wait until this OSD map epoch is received before
+ * sending any more operations to OSDs.  Use this
+ * when it is known that the client can't trust
+ * anything from before this epoch (e.g. due to
+ * client blacklist at this epoch).
+ */
+void Objecter::set_epoch_barrier(epoch_t epoch)
+{
+  RWLock::WLocker wl(rwlock);
+
+  ldout(cct, 7) << __func__ << ": barrier " << epoch << " (was " << epoch_barrier
+                << ") current epoch " << osdmap->get_epoch() << dendl;
+  if (epoch >= epoch_barrier) {
+    epoch_barrier = epoch;
+    _maybe_request_map();
+  }
+}
+
index 9a0c614c39357473e2260da0113b09bd2b19bb30..520c41834ab94b99796b62b7cd1c0219f47a6c50 100644 (file)
@@ -1709,7 +1709,8 @@ public:
     mon_timeout(mon_timeout),
     osd_timeout(osd_timeout),
     op_throttle_bytes(cct, "objecter_bytes", cct->_conf->objecter_inflight_op_bytes),
-    op_throttle_ops(cct, "objecter_ops", cct->_conf->objecter_inflight_ops)
+    op_throttle_ops(cct, "objecter_ops", cct->_conf->objecter_inflight_ops),
+    epoch_barrier(0)
   { }
   ~Objecter();
 
@@ -2397,6 +2398,11 @@ public:
                         bool force_new);
 
   void blacklist_self(bool set);
+
+private:
+  epoch_t epoch_barrier;
+public:
+  void set_epoch_barrier(epoch_t epoch);
 };
 
 #endif