From: Yanjun Zhu <yanjun.zhu@oracle.com>
To: Santosh Shilimkar <santosh.shilimkar@oracle.com>,
Gerd Rausch <gerd.rausch@oracle.com>,
netdev@vger.kernel.org
Cc: David Miller <davem@davemloft.net>
Subject: Re: [net-next PATCH v2] net/rds: Accept peer connection reject messages due to incompatible version
Date: Thu, 7 Mar 2019 11:28:36 +0800 [thread overview]
Message-ID: <db911aee-7907-d8d1-e6b4-9f06a7e78f12@oracle.com> (raw)
In-Reply-To: <cb6d55b4-36bd-519d-2852-3924aec00ce8@oracle.com>
On 2019/3/7 10:09, Yanjun Zhu wrote:
>
> On 2019/3/7 9:55, Santosh Shilimkar wrote:
>>
>>
>> On 3/6/2019 5:49 PM, Gerd Rausch wrote:
>>> Prior to
>>> commit d021fabf525ff ("rds: rdma: add consumer reject")
>>>
>>> function "rds_rdma_cm_event_handler_cmn" would always honor a rejected
>>> connection attempt by issuing a "rds_conn_drop".
>>>
>>> The commit mentioned above added a "break", eliminating
>>> the "fallthrough" case and made the "rds_conn_drop" rather conditional:
>>>
>>> Now it only happens if a "consumer defined" reject (i.e. "rdma_reject")
>>> carries an integer-value of "1" inside "private_data":
>>>
>>>> if (!conn)
>>>> + break;
>>>> + err = (int *)rdma_consumer_reject_data(cm_id,
>>>> event, &len);
>>>> + if (!err || (err && ((*err) ==
>>>> RDS_RDMA_REJ_INCOMPAT))) {
>>>> + pr_warn("RDS/RDMA: conn <%pI6c, %pI6c>
>>>> rejected, dropping connection\n",
>>>> + &conn->c_laddr, &conn->c_faddr);
>>>> + conn->c_proposed_version =
>>>> RDS_PROTOCOL_COMPAT_VERSION;
>>>> + rds_conn_drop(conn);
>>>> + }
>>>> rdsdebug("Connection rejected: %s\n",
>>>> rdma_reject_msg(cm_id, event->status));
>>>> + break;
>>>> /* FALLTHROUGH */
>>>
>>> A number of issues are worth mentioning here:
>>> #1) Previous versions of the RDS code simply rejected a connection
>>> by calling "rdma_reject(cm_id, NULL, 0);"
>>> So the value of the payload in "private_data" will not be "1",
>>> but "0".
>>>
>>> #2) Now the code has become dependent on host byte order and sizing.
>>> If one peer is big-endian, the other is little-endian,
>>> or there's a difference in sizeof(int) (e.g. ILP64 vs LP64),
>>> the *err check does not work as intended.
>>>
>>> #3) There is no check for "len" to see if the data behind *err is
>>> even valid.
>>> Luckily, it appears that the "rdma_reject(cm_id, NULL, 0)"
>>> will always
>>> carry 148 bytes of zeroized payload.
>>> But that should probably not be relied upon here.
>>>
>>> #4) With the added "break;",
>>> we might as well drop the misleading "/* FALLTHROUGH */"
>>> comment.
>>>
>>> This commit does _not_ address issue #2, as the sender would have to
>>> agree on a byte order as well.
>>>
>>> Here is the sequence of messages in this observed error-scenario:
>>> Host-A is pre-QoS changes (excluding the commit mentioned above)
>>> Host-B is post-QoS changes (including the commit mentioned above)
>>>
>>> #1 Host-B
>>> issues a connection request via function
>>> "rds_conn_path_transition"
>>> connection state transitions to "RDS_CONN_CONNECTING"
>>>
>>> #2 Host-A
>>> rejects the incompatible connection request (from #1)
>>> It does so by calling "rdma_reject(cm_id, NULL, 0);"
>>>
>>> #3 Host-B
>>> receives an "RDMA_CM_EVENT_REJECTED" event (from #2)
>>> But since the code is changed in the way described above,
>>> it won't drop the connection here, simply because "*err == 0".
>>>
>>> #4 Host-A
>>> issues a connection request
>>>
>>> #5 Host-B
>>> receives an "RDMA_CM_EVENT_CONNECT_REQUEST" event
>>> and ends up calling "rds_ib_cm_handle_connect".
>>> But since the state is already in "RDS_CONN_CONNECTING"
>>> (as of #1) it will end up issuing a "rdma_reject" without
>>> dropping the connection:
>>> if (rds_conn_state(conn) == RDS_CONN_CONNECTING) {
>>> /* Wait and see - our connect may still be succeeding */
>>> rds_ib_stats_inc(s_ib_connect_raced);
>>> }
>>> goto out;
>>>
>>> #6 Host-A
>>> receives an "RDMA_CM_EVENT_REJECTED" event (from #5),
>>> drops the connection and tries again (goto #4) until it gives up.
>>>
>>> Fixes: d021fabf525ff ("rds: rdma: add consumer reject")
>>> Signed-off-by: Gerd Rausch <gerd.rausch@oracle.com>
>>> ---
>>> net/rds/rdma_transport.c | 3 +--
>>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> Changes in submitted patch v2:
>>> * Dropped the "Orabug:" line from the commit-log message (as requested)
>>> * Added a "Fixes:" line to the commit-log-message
>>>
>> Thanks Gerd for posting an update. The fix looks correct as already
>> mentioned in earlier post.
>> FWIW,
>> Acked-by: Santosh Shilimkar<santosh.shilimkar@oracle.com>
>>
>> Hi Yanjun,
>> Please provide your tested-by since you mentioned offlist that
>
> OK. Now I am working with Gerd to reproduce this bug.
>
> I think this problem can be reproduced since Gerd is confident with it.
Sorry. The HCA device in my test env is
CA 'mlx4_0'
CA type: MT26428
Number of ports: 2
Firmware version: 2.11.2010
Hardware version: b0
Node GUID: 0x0002c903000a7a30
System image GUID: 0x0002c903000a7a33
Port 1:
State: Active
Physical state: LinkUp
Rate: 40
Base lid: 50
LMC: 0
SM lid: 26
Capability mask: 0x02590868
Port GUID: 0x0002c903000a7a31
Link layer: InfiniBand
Port 2:
State: Active
Physical state: LinkUp
Rate: 40
Base lid: 51
LMC: 0
SM lid: 26
Capability mask: 0x02590868
Port GUID: 0x0002c903000a7a32
Link layer: InfiniBand
And from Gerd
"
The setup I use that ran into the issue right way is comprised of:
2 CX4 HCAs wired up back to back in RoCE mode (LINK_TYPE=ETH)
"
Perhaps the HW causes this problem. Since I can not reproduce this bug
and make tests with this patch,
and I did review this patch, I change to this:
Reviewed-by: Zhu Yanjun <yanjun.zhu@oracle.com>
Thanks, Gerd.
Zhu Yanjun
>
> So I send my tested-by in advance.
>
> Reviewed-and-tested-by: Zhu Yanjun <yanjun.zhu@oracle.com>
>
> Thanks,
>
> Zhu Yanjun
>
>> so far you are unable to reproduce the issue on net-next. Thanks.
>>
>> Regards,
>> Santosh
next prev parent reply other threads:[~2019-03-07 3:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-05 0:04 [net-next][PATCH 0/5] rds: add tos support Santosh Shilimkar
2019-02-05 0:04 ` [net-next][PATCH 1/5] rds: make v3.1 as compat version Santosh Shilimkar
2019-02-05 0:04 ` [net-next][PATCH 2/5] rds: rdma: add consumer reject Santosh Shilimkar
2019-02-05 0:04 ` [net-next][PATCH 3/5] rds: add type of service(tos) infrastructure Santosh Shilimkar
[not found] ` <20190307220106.9099-1-gerd.rausch@oracle.com>
2019-03-08 1:16 ` [net-next PATCH] net/rds: Return proper "tos" value to user-space Yanjun Zhu
2019-03-08 1:37 ` santosh.shilimkar
2019-03-08 22:37 ` Gerd Rausch
2019-03-08 22:54 ` Santosh Shilimkar
2019-03-08 23:57 ` Zhu Yanjun
2019-02-05 0:04 ` [net-next][PATCH 4/5] rds: add transport specific tos_map hook Santosh Shilimkar
2019-02-05 0:04 ` [net-next][PATCH 5/5] rds: rdma: update rdma transport for tos Santosh Shilimkar
2019-03-05 16:33 ` Gerd Rausch
2019-03-05 16:41 ` Santosh Shilimkar
2019-03-05 16:48 ` Gerd Rausch
2019-03-05 17:02 ` Santosh Shilimkar
2019-03-06 5:28 ` Yanjun Zhu
[not found] ` <20190306070409.26840-1-gerd.rausch@oracle.com>
2019-03-06 8:41 ` [PATCH] net/rds: Accept peer connection reject messages due to incompatible version Yanjun Zhu
[not found] ` <20190307014920.24257-1-gerd.rausch@oracle.com>
2019-03-07 1:55 ` [net-next PATCH v2] " Santosh Shilimkar
2019-03-07 2:09 ` Yanjun Zhu
2019-03-07 3:28 ` Yanjun Zhu [this message]
2019-03-06 17:55 ` [PATCH] " Santosh Shilimkar
2019-02-07 1:01 ` [net-next][PATCH 0/5] rds: add tos support David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=db911aee-7907-d8d1-e6b4-9f06a7e78f12@oracle.com \
--to=yanjun.zhu@oracle.com \
--cc=davem@davemloft.net \
--cc=gerd.rausch@oracle.com \
--cc=netdev@vger.kernel.org \
--cc=santosh.shilimkar@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).