From: xie xingguo Date: Tue, 23 Aug 2016 07:27:34 +0000 (+0800) Subject: osdc/objecter: add check against existence of acting_primary X-Git-Tag: v11.0.1~248^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1379fbd52d9d627fd00fb1b36d463d8e512776bd;p=ceph.git osdc/objecter: add check against existence of acting_primary pg_to_acting_osds() could return invalid acting and acting_primary. So we shall check against the validity of acting_primary before proceeding on. Signed-off-by: xie xingguo --- diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index be0e17e9d32..f6834e2f8d2 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -4728,7 +4728,14 @@ int Objecter::_calc_command_target(CommandOp *c, shunique_lock& sul) return RECALC_OP_TARGET_POOL_DNE; } vector acting; - osdmap->pg_to_acting_osds(c->target_pg, &acting, &c->osd); + int acting_primary; + osdmap->pg_to_acting_osds(c->target_pg, &acting, &acting_primary); + if (acting_primary == -1) { + c->map_check_error = -ENXIO; + c->map_check_error_str = "osd down"; + return RECALC_OP_TARGET_OSD_DOWN; + } + c->osd = acting_primary; } OSDSession *s;