From: Håkon Bugge Date: Mon, 18 Jun 2018 11:39:14 +0000 (+0200) Subject: net/rds: Fix bug in failover_group parsing X-Git-Tag: v4.1.12-124.31.3~706 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e2a30b0043a7c2348723cffbc39321abd0d3adbd;p=users%2Fjedix%2Flinux-maple.git net/rds: Fix bug in failover_group parsing When supplying a module parameter value for the fail-over group as: ib0,ib1;ib2,ib3;ib4,ib5;ib6,ib7;ib8,ib9 rdmaip / rds_rdma is unable to parse it correctly. Based on debug prints, it does: lab38 kernel: RDS/IB: ib0 is designated group 1 lab38 kernel: RDS/IB: ib1 is designated group 1 lab38 kernel: RDS/IB: ib2 is designated group 2 (no more prints). This implies, that for Xn-8 systems, fail-over will not be distributed correctly. We see: lab38 kernel: RDS/IP: IP 192.2.23.100 migrated from ib0 to ib1:P01 lab38 kernel: RDS/IP: IP 192.2.23.102 migrated from ib2 to ib1:P03 lab38 kernel: RDS/IP: IP 192.2.23.104 migrated from ib4 to ib3:P05 lab38 kernel: RDS/IP: IP 192.2.23.106 migrated from ib6 to ib3:P07 lab38 kernel: RDS/IP: IP 192.2.23.108 migrated from ib8 to ib3:P09 That is, all fail-overs except for ib0 are migrated to ib3. This commit fixes this. The following values for the module parameter have been tested (in user space): ib0 ib0,ib1 ib0,ib1,ib2 ib0,ib1,ib2,ib3 ib0;ib1 ib0,ib1;ib2,ib3 ib0,ib1,ib2;ib3,ib4,ib5 ib0,ib1,ib2,ib3;ib4,ib5,ib6,ib7 ib0;ib1;ib2 ib0,ib1;ib2,ib3;ib4,ib5 ib0,ib1,ib2;ib3,ib4,ib5;ib6,ib7,ib8 ib0,ib1,ib2,ib3;ib4,ib5,ib6,ib7;ib8,ib9,ib10,ib11 ib0;ib1;ib2;ib3 ib0,ib1;ib2,ib3;ib4,ib5;ib6,ib7 ib0,ib1,ib2;ib3,ib4,ib5;ib6,ib7,ib8;ib9,ib10,ib11 ib0,ib1,ib2,ib3;ib4,ib5,ib6,ib7;ib8,ib9,ib10,ib11;ib12,ib13,ib14,ib15 Orabug: 28198749 Signed-off-by: Håkon Bugge Reviewed-by: Avinash Repaka Reviewed-by: Shannon Nelson Reviewed-by: Zhu Yanjun (inspired by uek-5-next commit bf8cd0080482fa23ee859cc6118c964693cb3a72) Signed-off-by: Brian Maly --- diff --git a/net/rds/ib.c b/net/rds/ib.c index 19496cf5c08f..afe267e0dbfa 100644 --- a/net/rds/ib.c +++ b/net/rds/ib.c @@ -2333,7 +2333,8 @@ void rds_ib_ip_failover_groups_init(void) } } tok = nxt_tok; - nxt_tok = strchr(str, ','); + if (nxt_tok) + nxt_tok = strchr(nxt_tok, ','); if (nxt_tok) { *nxt_tok = '\0'; nxt_tok++; @@ -2341,7 +2342,8 @@ void rds_ib_ip_failover_groups_init(void) } grp = nxt_grp; - nxt_grp = strchr(str, ';'); + if (nxt_grp) + nxt_grp = strchr(nxt_grp, ';'); if (nxt_grp) { *nxt_grp = '\0'; nxt_grp++;