aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2011-09-28 13:08:27 -0400
committerSage Weil <sage@newdream.net>2011-09-28 13:13:31 -0400
commit782e182e91e97f529a1edb30fdece9f1bef90ecc (patch)
tree1a7834111ce59e6cc9136e36e9ad846b0250d5d2 /net/ceph
parent935b639a049053d0ccbcf7422f2f9cd221642f58 (diff)
libceph: fix pg_temp mapping calculation
We need to apply the modulo pg_num calculation before looking up a pgid in the pg_temp mapping rbtree. This fixes pg_temp mappings, and fixes (some) misdirected requests that result in messages like [WRN] client4104 10.0.1.219:0/275025290 misdirected client4104.1:129 0.1 to osd0 not [1,0] in e11/11 on the server and stall make the client block without getting a reply (at least until the pg_temp mapping goes way, but that can take a long long time). Reorder calc_pg_raw() a bit to make more sense. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'net/ceph')
-rw-r--r--net/ceph/osdmap.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index e97c3588c3ec..eceb8d56703c 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -1046,10 +1046,25 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
1046 struct ceph_pg_mapping *pg; 1046 struct ceph_pg_mapping *pg;
1047 struct ceph_pg_pool_info *pool; 1047 struct ceph_pg_pool_info *pool;
1048 int ruleno; 1048 int ruleno;
1049 unsigned poolid, ps, pps; 1049 unsigned poolid, ps, pps, t;
1050 int preferred; 1050 int preferred;
1051 1051
1052 poolid = le32_to_cpu(pgid.pool);
1053 ps = le16_to_cpu(pgid.ps);
1054 preferred = (s16)le16_to_cpu(pgid.preferred);
1055
1056 pool = __lookup_pg_pool(&osdmap->pg_pools, poolid);
1057 if (!pool)
1058 return NULL;
1059
1052 /* pg_temp? */ 1060 /* pg_temp? */
1061 if (preferred >= 0)
1062 t = ceph_stable_mod(ps, le32_to_cpu(pool->v.lpg_num),
1063 pool->lpgp_num_mask);
1064 else
1065 t = ceph_stable_mod(ps, le32_to_cpu(pool->v.pg_num),
1066 pool->pgp_num_mask);
1067 pgid.ps = cpu_to_le16(t);
1053 pg = __lookup_pg_mapping(&osdmap->pg_temp, pgid); 1068 pg = __lookup_pg_mapping(&osdmap->pg_temp, pgid);
1054 if (pg) { 1069 if (pg) {
1055 *num = pg->len; 1070 *num = pg->len;
@@ -1057,18 +1072,6 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
1057 } 1072 }
1058 1073
1059 /* crush */ 1074 /* crush */
1060 poolid = le32_to_cpu(pgid.pool);
1061 ps = le16_to_cpu(pgid.ps);
1062 preferred = (s16)le16_to_cpu(pgid.preferred);
1063
1064 /* don't forcefeed bad device ids to crush */
1065 if (preferred >= osdmap->max_osd ||
1066 preferred >= osdmap->crush->max_devices)
1067 preferred = -1;
1068
1069 pool = __lookup_pg_pool(&osdmap->pg_pools, poolid);
1070 if (!pool)
1071 return NULL;
1072 ruleno = crush_find_rule(osdmap->crush, pool->v.crush_ruleset, 1075 ruleno = crush_find_rule(osdmap->crush, pool->v.crush_ruleset,
1073 pool->v.type, pool->v.size); 1076 pool->v.type, pool->v.size);
1074 if (ruleno < 0) { 1077 if (ruleno < 0) {
@@ -1078,6 +1081,11 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
1078 return NULL; 1081 return NULL;
1079 } 1082 }
1080 1083
1084 /* don't forcefeed bad device ids to crush */
1085 if (preferred >= osdmap->max_osd ||
1086 preferred >= osdmap->crush->max_devices)
1087 preferred = -1;
1088
1081 if (preferred >= 0) 1089 if (preferred >= 0)
1082 pps = ceph_stable_mod(ps, 1090 pps = ceph_stable_mod(ps,
1083 le32_to_cpu(pool->v.lpgp_num), 1091 le32_to_cpu(pool->v.lpgp_num),