Re: [PATCH v4] lockd: serialize server host->h_rpcclnt across rebind, async submit, and shutdown

From: Chuck Lever

Date: Thu Dec 03 2026 - 15:04:39 EST


On Thu, 03 Dec 2026 11:33:23 +0800, Ziheng Wei wrote:
> lockd_down() -> lockd_down_net() calls nlm_shutdown_hosts_net(net) while
> the lockd kthread is still running. nlm_shutdown_hosts_net() shuts down
> and clears host->h_rpcclnt without holding host->h_mutex, racing with
> server-side callers in the lockd kthread:
> - nlmsvc_grant_blocked() calls nlm_rebind_host() without h_mutex,
> passing a freed or cleared h_rpcclnt to rpc_force_rebind().
> - __nlm_async_call() drops h_mutex inside nlm_bind_host() before reading
> clnt->cl_procinfo and calling rpc_run_task(), so a concurrent shutdown
> can free clnt under it.
> Also, after the walk, a server host in that net can still bind a new
> h_rpcclnt that no later step shuts down.
>
> [...]

Applied to nfsd-testing, thanks!

[1/1] lockd: serialize server host->h_rpcclnt across rebind, async submit, and shutdown
commit: 6b5d3d40493cc1af87c35a9ef6860988320481fa

--
Chuck Lever