aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph/osdmap.c
diff options
context:
space:
mode:
authorIlya Dryomov <ilya.dryomov@inktank.com>2014-04-10 10:09:41 -0400
committerSage Weil <sage@inktank.com>2014-04-28 15:54:10 -0400
commit92b2e75158f6b8316b5a567c73dcf5b3d8f6bbce (patch)
treef5e7f7e2e8e706000aa1cd4128f19fbef3609f42 /net/ceph/osdmap.c
parent6da5246dd4b077ab229481ca342802f7fdcdab59 (diff)
libceph: fix non-default values check in apply_primary_affinity()
osd_primary_affinity array is indexed into incorrectly when checking for non-default primary-affinity values. This nullifies the impact of the rest of the apply_primary_affinity() and results in misdirected requests. if (osds[i] != CRUSH_ITEM_NONE && osdmap->osd_primary_affinity[i] != ^^^ CEPH_OSD_DEFAULT_PRIMARY_AFFINITY) { For a pool with size 2, this always ends up checking osd0 and osd1 primary_affinity values, instead of the values that correspond to the osds in question. E.g., given a [2,3] up set and a [max,max,0,max] primary affinity vector, requests are still sent to osd2, because both osd0 and osd1 happen to have max primary_affinity values and therefore we return from apply_primary_affinity() early on the premise that all osds in the given set have max (default) values. Fix it. Fixes: http://tracker.ceph.com/issues/7954 Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'net/ceph/osdmap.c')
-rw-r--r--net/ceph/osdmap.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index e632b5a52f5b..8b8a5a24b223 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -1548,8 +1548,10 @@ static void apply_primary_affinity(struct ceph_osdmap *osdmap, u32 pps,
1548 return; 1548 return;
1549 1549
1550 for (i = 0; i < len; i++) { 1550 for (i = 0; i < len; i++) {
1551 if (osds[i] != CRUSH_ITEM_NONE && 1551 int osd = osds[i];
1552 osdmap->osd_primary_affinity[i] != 1552
1553 if (osd != CRUSH_ITEM_NONE &&
1554 osdmap->osd_primary_affinity[osd] !=
1553 CEPH_OSD_DEFAULT_PRIMARY_AFFINITY) { 1555 CEPH_OSD_DEFAULT_PRIMARY_AFFINITY) {
1554 break; 1556 break;
1555 } 1557 }
@@ -1563,10 +1565,9 @@ static void apply_primary_affinity(struct ceph_osdmap *osdmap, u32 pps,
1563 * osd's pgs get rejected as primary. 1565 * osd's pgs get rejected as primary.
1564 */ 1566 */
1565 for (i = 0; i < len; i++) { 1567 for (i = 0; i < len; i++) {
1566 int osd; 1568 int osd = osds[i];
1567 u32 aff; 1569 u32 aff;
1568 1570
1569 osd = osds[i];
1570 if (osd == CRUSH_ITEM_NONE) 1571 if (osd == CRUSH_ITEM_NONE)
1571 continue; 1572 continue;
1572 1573