From af92b9a4d9f7a2193027a055227ed61baf33f995 Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Mon, 10 Jun 2013 15:03:37 -0700 Subject: [PATCH] Objecter: fail osd_command if OSD is down Signed-off-by: Dan Mick Reviewed-by: Sage Weil --- src/osdc/Objecter.cc | 9 ++++++--- src/osdc/Objecter.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 7a4d1dbbd4836..59c859b64b117 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -2346,10 +2346,11 @@ int Objecter::_submit_command(CommandOp *c, tid_t *ptid) command_ops[tid] = c; num_homeless_ops++; int r = recalc_command_target(c); - if (r == RECALC_OP_TARGET_OSD_DNE) { - // XXX take back tid incr? + if (r == RECALC_OP_TARGET_OSD_DNE) + return -ENOENT; + if (r == RECALC_OP_TARGET_OSD_DOWN) return -ENXIO; - } + if (c->session) _send_command(c); else @@ -2366,6 +2367,8 @@ int Objecter::recalc_command_target(CommandOp *c) if (c->target_osd >= 0) { if (!osdmap->exists(c->target_osd)) return RECALC_OP_TARGET_OSD_DNE; + if (osdmap->is_down(c->target_osd)) + return RECALC_OP_TARGET_OSD_DOWN; s = get_session(c->target_osd); } else { if (!osdmap->have_pg_pool(c->target_pg.pool())) diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 183d8d1900f70..acedef3ed4d56 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -1094,6 +1094,7 @@ public: RECALC_OP_TARGET_NEED_RESEND, RECALC_OP_TARGET_POOL_DNE, RECALC_OP_TARGET_OSD_DNE, + RECALC_OP_TARGET_OSD_DOWN, }; int recalc_op_target(Op *op); bool recalc_linger_op_target(LingerOp *op); -- 2.39.5