From: Gerd Rausch <gerd.rausch@oracle.com>
To: Allison Henderson <achender@kernel.org>,
henrymei <ljp1205831794@gmail.com>,
netdev@vger.kernel.org
Cc: linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com,
santosh.shilimkar@oracle.com, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org, Aohan Mei <henrymei@tencent.com>,
TencentOS Corvus AI <corvus@tencent.com>,
stable@vger.kernel.org
Subject: Re: [rds-devel] [External] : Re: [PATCH net] rds: ib: use rds_conn_drop() on protocol version mismatch
Date: Thu, 10 Sep 2026 16:56:47 -0700 [thread overview]
Message-ID: <22d59d86-91a6-4df5-8502-0885b25c4761@oracle.com> (raw)
In-Reply-To: <06792614227360acd42d62693d0af78d0f9e947e.camel@kernel.org>
Hi Allison,
On 2026-09-10 15:58, Allison Henderson wrote:
> On Thu, 2026-09-10 at 10:08 -0700, Gerd Rausch wrote:
>> Before this patch, a version 3.1 connection is expected to be established.
>> After this patch, there's an infinite connection retry attempt every second,
>> that'll never succeed.
>
> I think we might be talking about different branches of code? It
> looks like the downgrade you're describing is in the REJECTED case of
> rds_rdma_cm_event_handler_cmn(). But this patch doesn't touch that.
Of course, it doesn't.
But rds_ib_cm_handle_connect() issues a rdma_reject(IB_CM_REJ_CONSUMER_DEFINED) with payload
err = 1 (aka RDS_RDMA_REJ_INCOMPAT) not only if rds_ib_protocol_compatible()
returns zero, but all sorts of other scenarios also.
And when that rdma_reject(IB_CM_REJ_CONSUMER_DEFINED, 1) is issued,
then received by the peer, it lands in rds_rdma_cm_event_handler_cmn(), where this:
--------%<--------%<--------%<--------%<--------%<--------
conn->c_proposed_version = RDS_PROTOCOL_COMPAT_VERSION;
--------%<--------%<--------%<--------%<--------%<--------
version downgrade is expected to happen.
Subsequently it should be the node that did the downgrade to COMPAT_VERSION
that tries again.
Not the peer. The peer should back off, as it didn't go to COMPAT_VERSION.
Looking at rds_ib_protocol_compatible(), it seems terribly broken,
and AFAICT, none of this stuff works intuitively or even correctly.
But one thing is very clear to me:
We should never let the side that has an incompatible / wrong
"conn->c_version" value continue to attempt to connect.
That side never downgraded the "c_proposed_version" and will
just keep on repeating what didn't work before.
And yet, that is exactly what this patch proposed:
Don't destroy the connection, but keep on trying with
the wrong "conn->c_version" / "conn->c_proposed_version".
> The 3.1 exemption in rds_ib_cm_connect_complete() is a few lines above
> the one being changed, and it isn't touched either. So a 3.1 connection
> should proceed exactly as before.
>
I don't understand.
Why would the connection proceed exactly as before,
when "before" only one side retried with a downgraded 3.1 version,
but "after" both sides retry with a mix of 3.1 and and whatever incompatible
version the other node had?
It'll be a game of "who's fastest".
> The changes here are only reached in the RDMA_CM_EVENT_ESTABLISHED case,
> after the peer has already accepted, and only when the version it accepted
> with is below 3.1. IOW: that is specifically a peer that answered our
> 3.1 proposal with 3.0. Or an accept that carried no (or truncated)
> private data, which leaves c_version at 0 on a fresh conn.
>
What you described as "carried no (or truncated) private data"
is the normal case for IB_CM_RTU_RECEIVED:
The RDS/client issues an rdma_connect() (REQ) with user specified payload.
That arrives at RDS/server inside rds_ib_cm_handle_connect(),
which inspects protocol-version etc.
Then the RDS/server issues an rdma_accept() (REP) again with user specified payload.
That arrives at the RDS/client as RDMA_CM_EVENT_ESTABLISHED *with* payload
and inside RDS' function rds_ib_cm_connect_complete().
And then the RDS/client (actually the CM layer) sends out an RTU, that makes the RDS/server
land inside rds_ib_cm_connect_complete() too, but with "private_data_len==0".
So a "major == 0" doesn't imply something being truncated nor it being
a fresh conn, but simply is the last step you see on an RDS/server
during connection establishment.
It is rather curious that RDS performs a compatibility check inside
rds_ib_cm_connect_complete(), i.e. after a RDMA_CM_EVENT_ESTABLISHED
was received.
IMHO the compatibility ought to be checked prior to issuing an "rdma_accept()",
proposing common denominator version(s) that are appropriate for both sides.
Not after the connection had already been established.
The question if an incompatible connection ought to be destroyed or not
wouldn't come up, if we didn't allow incompatible connections to be created
in the first place.
> There is no fallback for that case before or after the patch. 3.1 is the
> compat floor, so there's nothing lower to fall back to. Before
> the patch, that branch calls rds_conn_destroy() under c_cm_lock and
> deadlocks against rds_conn_shutdown(). Which then stalls every RDS
> connection on the node. After the patch it drops the conn and
> retries with backoff. Neither case establishes a connection, and neither
> was ever going to.
>
The important bit that's missing here is that the side that did the
"c_proposed_version = RDS_PROTOCOL_COMPAT_VERSION" downgrade
is the one that needs to initiate.
Or else, we run the risk of running into endless loops of trying the same
thing again and again and again.
But this whole protocol negotation in RDS is rather broken.
I guess some would call it "organically grown over the years".
Thanks,
Gerd
next prev parent reply other threads:[~2026-09-10 23:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 12:33 [PATCH net] rds: ib: use rds_conn_drop() on protocol version mismatch henrymei
2026-09-09 7:09 ` Allison Henderson
2026-09-09 17:25 ` [rds-devel] [External] : " Gerd Rausch
2026-09-09 22:55 ` Allison Henderson
2026-09-10 17:08 ` Gerd Rausch
2026-09-10 22:58 ` Allison Henderson
2026-09-10 23:56 ` Gerd Rausch [this message]
2026-09-11 8:19 ` Allison Henderson
2026-09-11 17:10 ` Gerd Rausch
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=22d59d86-91a6-4df5-8502-0885b25c4761@oracle.com \
--to=gerd.rausch@oracle.com \
--cc=achender@kernel.org \
--cc=corvus@tencent.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=henrymei@tencent.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=ljp1205831794@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rds-devel@oss.oracle.com \
--cc=santosh.shilimkar@oracle.com \
--cc=stable@vger.kernel.org \
/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