Hi Mahanta,
A duplicate link group is harmless for correctness and not free in
resources, so I took your preferred route. v2 drops the hash.
Correctness: the ACCEPT carries ini->first_contact_local, and the client
side of smc_conn_create() then takes its "create new link group as well"
path, so both ends stay symmetric and no decline is sent. The
SMC_CLC_DECL_SYNCERR case below it is the mirror, server reuses and client
wanted new. Several groups per peer is already reachable too, since for
SMC_SERV the reuse condition refuses a group at max_conns or with a full
rtoken bitmap. And smcr_lgr_match() already compares the link's peer_gid,
so a peer varying its GID gets a fresh group with or without my patch.
Resources: lgr_cnt is a counter and not a cap, and an idle server side
group is held SMC_LGR_FREE_DELAY_SERV, 600 seconds, before
smc_lgr_free_work reclaims it. A multi-port peer falling back to v1 pays
double for ten minutes of idleness. Small, not nothing, and a behaviour
change nobody asked for.
The Sashiko bot's finding on this thread is also correct, and v2 removes the
function it was about. For the archive: smcr_indicated() is true for
SMC_TYPE_R, which is 0, so it is true for the reserved zero typev2 of a v1
proposal, and smc_get_clc_msg_smcd() then returns prop + 1 unchecked
because its guard only fires for smcd_indicated(typev1). The key mixed in
IP prefix bytes. It is a wrong-field read and not out of bounds, since
max_offset is computed inside struct smc_clc_msg_proposal_area.
v2 makes a link group that is still establishing findable, so a second
connection of the same peer defers to it, and the mutex no longer spans the
CONFIRM wait. It still covers smc_lgr_create(), which is needed: until the
list_add_tail() there the group is not on smc_lgr_list. Deferrals are
bounded by a window of two CLC_WAIT_TIME, which is wider than the longest a
link stays in SMC_LNK_ACTIVATING, so the create-anyway fallback is not
reachable at today's constants. One second of margin.
One thing v2 does not fix, since I claimed otherwise in v1: after the retry
joins, smcr_lgr_reg_rmbs() runs under the mutex and starts with
smc_llc_flow_initiate(), which sleeps while the first peer's ADD_LINK flow
is active. Unchanged by this series.
It grew to four patches. Taking the whole of smc_listen_rdma_finish() out
from under the mutex lets a joining connection of this peer block on
rmbs_lock or llc_conf_mutex with no timeout while holding it, waiting on
the first contact's add-link flow. The Sashiko bot raised that loop on v1
as pre-existing and it is unbounded, so patches 1 and 2 bound it and come
first. Patch 3 fills the peer gid and mac at creation, which patch 4 needs.
Unrelated peer's connect during a silent peer's handshake went 4397.8 ms to
1.5 ms. Your v1 control does not work here and the series notes say why.
v2: <2026…@gmail.com>
Thanks for the review.
Ermenson
Re: [PATCH net-next] net/smc: serialize the server establishment phase per peer, not globally
- From
- erme…@gmail.com (Ermenson Junior)
- Organization
- Usenet Network
- Message-ID
- <2026…@gmail.com>
- Date
- Newsgroups
- linux.kernel.netdev