On 02/12/26 7:01 am, Dust Li wrote:
> On 2026-12-01 16:31:55, Andrew Stellman wrote:
>> On Tue, Dec 01, 2026 at 02:45:27PM +0530, Mahanta Jambigi wrote:
>>> Would dropping role == SMC_CLNT be the *better fix*?
>> >> I tried it. On mainline (fe6ff8d5d675) in arm64 QEMU with KASAN, >> lockdep and SoftRoCE, I opened 260 SMC-R connections from one client to >> one server, held them, and then closed them. >> >> Without any patch, both runs closed cleanly. With role == SMC_CLNT >> dropped, the client hung in close() in both runs. The stacks show a >> link-group termination worker waiting in smc_cdc_wait_pend_tx_wr() >> while close() waits for the same socket lock in smc_release(). With 64 >> connections, both builds closed cleanly. >> >> I haven't found why the CDC completion never comes, and I haven't run a >> peer that reuses its QPN. Dust, as I said before, the 508 count came >>from a test-only change inside the writer, not from real connections. >> >> Given that, would you rather keep the cap in smc_llc_fill_ext_v2() as >> sent, or should I keep looking into the hang with the client bound?
> > IIUC, that looks like a potential issue that can never be triggered in > the current Linux code? > > If so, I don't think it's necessary to add the bound here.
Agreed on both counts. The overflow needs more than 507 connections in one link group, and a conforming peer holds the group at 255: the sysctl(net.smc.smcr_max_conns_per_lgr) caps the server's group, and the server moves to a new group, with a new QPN, before the client's limit is reached. The client group is only bounded indirectly, by following that QPN. My client-side suggestion is withdrawn as well - dropping role == SMC_CLNT makes close() hang in Andrew's 260-connection run, so it is not the fix. What remains is the question that run opened: the client's conns_num and the server's count can diverge, and if a client group reaches 255 while the server still reuses it, the region above 255 is reachable even with a conforming peer. That is a separate investigation, not this patch. So please drop the bound, Andrew. If the 260-connection hang turns out to be a real limit or teardown bug, it deserves its own thread, and enforcing the limit for the client role can be revisited there. Agreed on your point about invalid CLC messages being the better target; smc_clc_wait_msg() bounds the copy and the proposal/accept validators require an exact length from capped counts, so the remaining places to look at are the truncated path, the SMC-D v2 extension and the client side reading ACCEPT/CONFIRM.