]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephtool: make command wait for osdmap explicit
authorSage Weil <sage@inktank.com>
Mon, 13 Aug 2012 16:56:59 +0000 (09:56 -0700)
committerSage Weil <sage@inktank.com>
Mon, 13 Aug 2012 16:58:22 +0000 (09:58 -0700)
If we are waiting for an osdmap for a command, track that explicitly so
that we know when to retry send_command().

Signed-off-by: Sage Weil <sage@inktank.com>
src/tools/common.cc

index e29a674e75ea45ec5e3baeb19aa60076879c455e..1c1a3bc397c78432b4a6ca1adff272b854dc4d88 100644 (file)
@@ -64,6 +64,7 @@ bool pending_tell_pgid;
 uint64_t pending_tid = 0;
 EntityName pending_target;
 pg_t pending_target_pgid;
+bool cmd_waiting_for_osdmap = false;
 vector<string> pending_cmd;
 bufferlist pending_bl;
 bool reply;
@@ -125,6 +126,7 @@ static void send_command(CephToolCtx *ctx)
     if (!osdmap) {
       ctx->mc.sub_want("osdmap", 0, CEPH_SUBSCRIBE_ONETIME);
       ctx->mc.renew_subs();
+      cmd_waiting_for_osdmap = true;
       return;
     }
   }
@@ -197,8 +199,10 @@ static void handle_osd_map(CephToolCtx *ctx, MOSDMap *m)
   delete osdmap;
   osdmap = new OSDMap;
   osdmap->decode(m->maps[e]);
-  if (pending_cmd.size())
+  if (cmd_waiting_for_osdmap) {
+    cmd_waiting_for_osdmap = false;
     send_command(ctx);
+  }
   ctx->lock.Unlock();
   m->put();
 }