]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/objecter: add check against existence of acting_primary
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 23 Aug 2016 07:27:34 +0000 (15:27 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 23 Aug 2016 07:27:34 +0000 (15:27 +0800)
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 <xie.xingguo@zte.com.cn>
src/osdc/Objecter.cc

index be0e17e9d32fab2cb68aaf12221f95f4df18d8ec..f6834e2f8d26d279884a863b6a454516711c61a0 100644 (file)
@@ -4728,7 +4728,14 @@ int Objecter::_calc_command_target(CommandOp *c, shunique_lock& sul)
       return RECALC_OP_TARGET_POOL_DNE;
     }
     vector<int> 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;