Re: [PATCH net v2] net/smc: Reset conn->lgr when link group registration fails

From: Karsten Graul
Date: Tue Jan 04 2022 - 04:58:26 EST


On 04/01/2022 03:59, Wen Gu wrote:
> SMC connections might fail to be registered to a link group due to
> things like unable to find a link to assign to in its creation. As
> a result, connection creation will return a failure and most
> resources related to the connection won't be applied or initialized,
> such as conn->abort_work or conn->lnk.

Patch looks good to me, but one more thing to think about:

Would it be better to invoke __smc_lgr_terminate() instead of smc_lgr_schedule_free_work()
when a link group was created but cannot be used now? This would immediately free up all
allocated resources for this unusable link group instead of starting the default 10-minute
timer until the link group is freed.
__smc_lgr_terminate() takes care of completely removing the link group in the context of
its caller. It is also used from within smc_lgr_cleanup_early() that is used when the very
first connection of a link group is aborted.