]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: respect shard when setting role on new pgs
authorSage Weil <sage@redhat.com>
Fri, 29 Apr 2016 19:47:16 +0000 (15:47 -0400)
committerBoris Ranto <branto@redhat.com>
Fri, 6 May 2016 11:44:18 +0000 (13:44 +0200)
This matches PG::start_peering_interval().

Signed-off-by: Sage Weil <sage@redhat.com>
src/osd/OSD.cc

index 8b905bf199d494c8f076c11c95d983bd2cd62a33..77acdc9e74ee1512a44eed729008d0f06640917d 100644 (file)
@@ -3444,7 +3444,6 @@ void OSD::handle_pg_peering_evt(
     vector<int> up, acting;
     osdmap->pg_to_up_acting_osds(
       pgid.pgid, &up, &up_primary, &acting, &acting_primary);
-    int role = osdmap->calc_pg_role(whoami, acting, acting.size());
 
     pg_history_t history = orig_history;
     bool valid_history = project_pg_history(
@@ -3477,6 +3476,10 @@ void OSD::handle_pg_peering_evt(
       PG::_create(*rctx.transaction, pgid, pgid.get_split_bits(pp->get_pg_num()));
       PG::_init(*rctx.transaction, pgid, pp);
 
+      int role = osdmap->calc_pg_role(whoami, acting, acting.size());
+      if (!pp->is_replicated() && role != pgid.shard)
+       role = -1;
+
       PG *pg = _create_lock_pg(
        get_map(epoch),
        pgid, false, false,