summaryrefslogtreecommitdiffstats
path: root/src/tools/common.cc
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2012-08-13 18:56:59 +0200
committerSage Weil <sage@inktank.com>2012-08-13 18:58:22 +0200
commitc8af0faf15f4a5afdfe11b52db733c5874038d59 (patch)
tree3393799d34a58df11dd618c2964a1f52364c4ca1 /src/tools/common.cc
parentmsg/Pipe: discard_queue() -> discard_out_queue() (diff)
downloadceph-c8af0faf15f4a5afdfe11b52db733c5874038d59.tar.xz
ceph-c8af0faf15f4a5afdfe11b52db733c5874038d59.zip
cephtool: make command wait for osdmap explicit
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>
Diffstat (limited to 'src/tools/common.cc')
-rw-r--r--src/tools/common.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/tools/common.cc b/src/tools/common.cc
index e29a674e75e..1c1a3bc397c 100644
--- a/src/tools/common.cc
+++ b/src/tools/common.cc
@@ -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();
}