lockd: purge resources held on behalf of nlm clients when shutting down
authorJeff Layton <jlayton@kernel.org>
Fri, 3 Mar 2023 12:15:57 +0000 (07:15 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Wed, 26 Apr 2023 13:04:59 +0000 (09:04 -0400)
It's easily possible for the server to have an outstanding lock when we
go to shut down. When that happens, we often get a warning like this in
the kernel log:

    lockd: couldn't shutdown host module for net f0000000!

This is because the shutdown procedures skip removing any hosts that
still have outstanding resources (locks). Eventually, things seem to get
cleaned up anyway, but the log message is unsettling, and server
shutdown doesn't seem to be working the way it was intended.

Ensure that we tear down any resources held on behalf of a client when
tearing one down for server shutdown.

Reported-by: Yongcheng Yang <yoyang@redhat.com>
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2063818
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/lockd/host.c

index cdc8e12cdac44e87642e24866a6ae71ceaf3ef7a..127a728fcbc81ee24040fafb79260dfaea918e80 100644 (file)
@@ -629,6 +629,7 @@ nlm_shutdown_hosts_net(struct net *net)
                        rpc_shutdown_client(host->h_rpcclnt);
                        host->h_rpcclnt = NULL;
                }
+               nlmsvc_free_host_resources(host);
        }
 
        /* Then, perform a garbage collection pass */