]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/Objecter: Snapshot creation/removal now waits for proper epoch to return.
authorGreg Farnum <gregf@hq.newdream.net>
Tue, 16 Jun 2009 22:22:16 +0000 (15:22 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Tue, 16 Jun 2009 22:22:16 +0000 (15:22 -0700)
src/messages/MPoolSnapReply.h
src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h
src/osdc/Objecter.cc
src/osdc/Objecter.h

index 63885173f86c8b6a3285d97a95b6e691fcb9dd57..bba43a2b50a1022d9f074ad70f19d8dee494be7f 100644 (file)
@@ -21,7 +21,7 @@ public:
   ceph_fsid_t fsid;
   tid_t tid;
   int replyCode;
-  int epoch;
+  epoch_t epoch;
 
 
   MPoolSnapReply() : Message(MSG_POOLSNAPREPLY) {}
index 7bf2557847d3857f708e320be67cb800bd715686..b86518d5e30b2c85e7343eb0a5d76a814ede3199 100644 (file)
@@ -1317,7 +1317,7 @@ bool OSDMonitor::prepare_pool_snap ( MPoolSnap *m)
   return true;
 }
 
-void OSDMonitor::_pool_snap(MPoolSnap *m, int replyCode, int epoch)
+void OSDMonitor::_pool_snap(MPoolSnap *m, int replyCode, epoch_t epoch)
 {
   MPoolSnapReply *reply = new MPoolSnapReply(m->fsid, m->tid, replyCode, epoch);
   mon->messenger->send_message(reply, m->get_orig_source_inst());
index 10c91cb85652d0931bfabaca0c6e3368cb8c25e4..d67127350536d801b1ed26021c2294c74ca56aeb 100644 (file)
@@ -86,7 +86,7 @@ private:
 
   bool preprocess_pool_snap ( class MPoolSnap *m);
   bool prepare_pool_snap (MPoolSnap *m);
-  void _pool_snap(MPoolSnap *m, int replyCode, int epoch);
+  void _pool_snap(MPoolSnap *m, int replyCode, epoch_t epoch);
 
   struct C_Booted : public Context {
     OSDMonitor *cmon;
index 1c7562b9cf2d39d60f10265504a76dc437356cc9..09179dc8f41cbc776c45cc03ed4ad5167dd5dd12 100644 (file)
@@ -184,7 +184,12 @@ void Objecter::handle_osd_map(MOSDMap *m)
       kick_requests(changed_pgs);
   }
   
-  finish_contexts(waiting_for_map);
+  map<epoch_t,list<Context*> >::iterator p = waiting_for_map.begin();
+  while (p != waiting_for_map.end() &&
+        p->first <= osdmap->get_epoch()) {
+    finish_contexts(p->second);
+    waiting_for_map.erase(p++);
+  }
 
   delete m;
 }
@@ -576,8 +581,12 @@ void Objecter::handle_pool_snap_reply(MPoolSnapReply *m) {
     SnapOp *op = op_snap[tid];
     dout(10) << "have request " << tid << " at " << op << " Create: " << op->create << dendl;
     *(op->replyCode) = m->replyCode;
-    op->onfinish->finish(0);
-    delete op->onfinish;
+    if (osdmap->get_epoch() < m->epoch) 
+      wait_for_new_map(op->onfinish, m->epoch);
+    else {
+      op->onfinish->finish(0);
+      delete op->onfinish;
+    }
     op_snap.erase(tid);
     delete op;
   } else {
index 7e68aa69c33469afa63839678374290a3e2e0b6a..2d279d0e8244cb2df0e890d39f85bda4afde4cb0 100644 (file)
@@ -277,7 +277,7 @@ class Objecter {
   map<tid_t,StatfsOp*>      op_statfs;
   map<tid_t,SnapOp*>        op_snap;
 
-  list<Context*> waiting_for_map;
+  map<epoch_t,list<Context*> > waiting_for_map;
 
   /**
    * track pending ops by pg
@@ -350,8 +350,8 @@ private:
   int get_client_incarnation() const { return client_inc; }
   void set_client_incarnation(int inc) { client_inc = inc; }
 
-  void wait_for_new_map(Context *c) {
-    waiting_for_map.push_back(c);
+  void wait_for_new_map(Context *c, epoch_t epoch) {
+    waiting_for_map[epoch].push_back(c);
   }
 
   // mid-level helpers