Re: [PATCH 4.4 014/190] lockd: fix lockd shutdown race

From: Ben Hutchings
Date: Tue May 15 2018 - 14:44:35 EST


On Wed, 2018-04-11 at 20:34 +0200, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.ÂÂIf anyone has any objections, please let me know.
>
> ------------------
>
> From: "J. Bruce Fields" <bfields@xxxxxxxxxx>
>
>
> [ Upstream commit efda760fe95ea15291853c8fa9235c32d319cd98 ]
[...]
> --- a/fs/lockd/svc.c
> +++ b/fs/lockd/svc.c
> @@ -129,6 +129,8 @@ lockd(void *vrqstp)
> Â{
> Â int err = 0;
> Â struct svc_rqst *rqstp = vrqstp;
> + struct net *net = &init_net;
> + struct lockd_net *ln = net_generic(net, lockd_net_id);
> Â
> Â /* try_to_freeze() is called from svc_recv() */
> Â set_freezable();
> @@ -173,6 +175,8 @@ lockd(void *vrqstp)
> Â if (nlmsvc_ops)
> Â nlmsvc_invalidate_all();
>Â nlm_shutdown_hosts();
> + cancel_delayed_work_sync(&ln->grace_period_end);
> + locks_end_grace(&ln->lockd_manager);
> Â return 0;
> Â}
> Â
> @@ -267,8 +271,6 @@ static void lockd_down_net(struct svc_se
> Â if (ln->nlmsvc_users) {
> Â if (--ln->nlmsvc_users == 0) {
> Â nlm_shutdown_hosts_net(net);
> - cancel_delayed_work_sync(&ln->grace_period_end);
> - locks_end_grace(&ln->lockd_manager);

Aren't these statements still needed for non-initial namespaces?

Ben.

> Â svc_shutdown_net(serv, net);
> Â dprintk("lockd_down_net: per-net data destroyed; net=%p\n", net);
> Â }
>
>
>
--
Ben Hutchings
Software Developer, Codethink Ltd.