[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fb71bcc5-77ad-698c-b025-36e1910f868f@linux.alibaba.com>
Date: Thu, 10 Feb 2022 16:56:00 +0800
From: Wen Gu <guwen@...ux.alibaba.com>
To: Tony Lu <tonylu@...ux.alibaba.com>
Cc: kgraul@...ux.ibm.com, davem@...emloft.net, kuba@...nel.org,
linux-s390@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] net/smc: Avoid overwriting the copies of clcsock
callback functions
On 2022/2/10 10:50 am, Tony Lu wrote:
> I am wondering that there is a potential racing. If ->use_fallback is
> setted to true, but the rest of replacing process is on the way, others
> who tested and passed ->use_fallback, they would get old value before
> replacing.
>
Thanks for your comments.
I understand your concern. But when I went through all the places that
check for smc->use_fallback, I haven't found the exact potential racing
point. Please point out if I missed something. Thank you.
In my humble opinion, most of the operations after smc->use_fallback check
have no direct relationship with what did in smc_switch_to_fallback() (the
replacement of clcsock callback functions), except for which in smc_sendmsg(),
smc_recvmsg() and smc_sendpage():
smc_sendmsg():
if (smc->use_fallback) {
rc = smc->clcsock->ops->sendmsg(smc->clcsock, msg, len);
}
smc_recvmsg():
if (smc->use_fallback) {
rc = smc->clcsock->ops->recvmsg(smc->clcsock, msg, len, flags);
}
smc_sendpage():
if (smc->use_fallback) {
rc = kernel_sendpage(smc->clcsock, page, offset,
size, flags);
}
If smc->use_fallback is set to true, but callback functions (sk_data_ready ...)
of clcsock haven't been replaced yet at this moment, there may be a racing as
you described.
But it won't happen, because fallback must already be done before sending and receiving.
What do you think about it?
Thanks,
Wen Gu
Powered by blists - more mailing lists