diff mbox series

[01/14] lockd: remove SIGKILL handling.

Message ID 168966228859.11075.13570585046156408745.stgit@noble.brown (mailing list archive)
State New, archived
Headers show
Series Refactor SUNRPC svc thread code, and use llist | expand

Commit Message

NeilBrown July 18, 2023, 6:38 a.m. UTC
lockd allows SIGKILL and responds by dropping all locks and restarting
the grace period.  This functionality has been present since 2.1.32 when
lockd was added to Linux.

This functionality is undocumented and most liked added as a useful
debug aid.  When there is a need to drop locks, the best approach is
using /proc/fs/nfsd/unlock_*.

This patch removes the handling of SIGKILL as part of preparation for
removing all signal handling from sunrpc service threads.

Signed-off-by: NeilBrown <neilb@suse.de>
---
 fs/lockd/svc.c |   24 ------------------------
 1 file changed, 24 deletions(-)

Comments

Jeff Layton July 20, 2023, 8:05 p.m. UTC | #1
On Tue, 2023-07-18 at 16:38 +1000, NeilBrown wrote:
> lockd allows SIGKILL and responds by dropping all locks and restarting
> the grace period.  This functionality has been present since 2.1.32 when
> lockd was added to Linux.
> 
> This functionality is undocumented and most liked added as a useful
> debug aid.  When there is a need to drop locks, the best approach is
> using /proc/fs/nfsd/unlock_*.
> 
> This patch removes the handling of SIGKILL as part of preparation for
> removing all signal handling from sunrpc service threads.
> 
> Signed-off-by: NeilBrown <neilb@suse.de>
> ---
>  fs/lockd/svc.c |   24 ------------------------
>  1 file changed, 24 deletions(-)
> 
> diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
> index 22d3ff3818f5..614faa5f69cd 100644
> --- a/fs/lockd/svc.c
> +++ b/fs/lockd/svc.c
> @@ -45,7 +45,6 @@
>  
>  #define NLMDBG_FACILITY		NLMDBG_SVC
>  #define LOCKD_BUFSIZE		(1024 + NLMSVC_XDRSIZE)
> -#define ALLOWED_SIGS		(sigmask(SIGKILL))
>  
>  static struct svc_program	nlmsvc_program;
>  
> @@ -111,19 +110,6 @@ static void set_grace_period(struct net *net)
>  	schedule_delayed_work(&ln->grace_period_end, grace_period);
>  }
>  
> -static void restart_grace(void)
> -{
> -	if (nlmsvc_ops) {
> -		struct net *net = &init_net;
> -		struct lockd_net *ln = net_generic(net, lockd_net_id);
> -
> -		cancel_delayed_work_sync(&ln->grace_period_end);
> -		locks_end_grace(&ln->lockd_manager);
> -		nlmsvc_invalidate_all();
> -		set_grace_period(net);
> -	}
> -}
> -
>  /*
>   * This is the lockd kernel thread
>   */
> @@ -138,9 +124,6 @@ lockd(void *vrqstp)
>  	/* try_to_freeze() is called from svc_recv() */
>  	set_freezable();
>  
> -	/* Allow SIGKILL to tell lockd to drop all of its locks */
> -	allow_signal(SIGKILL);
> -
>  	dprintk("NFS locking service started (ver " LOCKD_VERSION ").\n");
>  
>  	/*
> @@ -154,12 +137,6 @@ lockd(void *vrqstp)
>  		/* update sv_maxconn if it has changed */
>  		rqstp->rq_server->sv_maxconn = nlm_max_connections;
>  
> -		if (signalled()) {
> -			flush_signals(current);
> -			restart_grace();
> -			continue;
> -		}
> -
>  		timeout = nlmsvc_retry_blocked();
>  
>  		/*
> @@ -174,7 +151,6 @@ lockd(void *vrqstp)
>  
>  		svc_process(rqstp);
>  	}
> -	flush_signals(current);
>  	if (nlmsvc_ops)
>  		nlmsvc_invalidate_all();
>  	nlm_shutdown_hosts();
> 
> 

Nice to finally do this!

Reviewed-by: Jeff Layton <jlayton@kernel.org>
diff mbox series

Patch

diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
index 22d3ff3818f5..614faa5f69cd 100644
--- a/fs/lockd/svc.c
+++ b/fs/lockd/svc.c
@@ -45,7 +45,6 @@ 
 
 #define NLMDBG_FACILITY		NLMDBG_SVC
 #define LOCKD_BUFSIZE		(1024 + NLMSVC_XDRSIZE)
-#define ALLOWED_SIGS		(sigmask(SIGKILL))
 
 static struct svc_program	nlmsvc_program;
 
@@ -111,19 +110,6 @@  static void set_grace_period(struct net *net)
 	schedule_delayed_work(&ln->grace_period_end, grace_period);
 }
 
-static void restart_grace(void)
-{
-	if (nlmsvc_ops) {
-		struct net *net = &init_net;
-		struct lockd_net *ln = net_generic(net, lockd_net_id);
-
-		cancel_delayed_work_sync(&ln->grace_period_end);
-		locks_end_grace(&ln->lockd_manager);
-		nlmsvc_invalidate_all();
-		set_grace_period(net);
-	}
-}
-
 /*
  * This is the lockd kernel thread
  */
@@ -138,9 +124,6 @@  lockd(void *vrqstp)
 	/* try_to_freeze() is called from svc_recv() */
 	set_freezable();
 
-	/* Allow SIGKILL to tell lockd to drop all of its locks */
-	allow_signal(SIGKILL);
-
 	dprintk("NFS locking service started (ver " LOCKD_VERSION ").\n");
 
 	/*
@@ -154,12 +137,6 @@  lockd(void *vrqstp)
 		/* update sv_maxconn if it has changed */
 		rqstp->rq_server->sv_maxconn = nlm_max_connections;
 
-		if (signalled()) {
-			flush_signals(current);
-			restart_grace();
-			continue;
-		}
-
 		timeout = nlmsvc_retry_blocked();
 
 		/*
@@ -174,7 +151,6 @@  lockd(void *vrqstp)
 
 		svc_process(rqstp);
 	}
-	flush_signals(current);
 	if (nlmsvc_ops)
 		nlmsvc_invalidate_all();
 	nlm_shutdown_hosts();