summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2025-05-28 16:35:54 +0800
committerSteve Sakoman <steve@sakoman.com>2025-06-05 09:18:43 -0700
commit2eac829f48975f64d2025c2546df73d7972bef7c (patch)
treed129771f34bad0c31441de695fe4a94e0fc5d36e
parent06b16eb7eef8e5227d408cdc1075cee7ddfa3bf6 (diff)
downloadpoky-2eac829f48975f64d2025c2546df73d7972bef7c.tar.gz
nfs-utils: don't use signals to shut down nfs server.
Since Linux v2.4 it has been possible to stop all NFS server by running rpc.nfsd 0 i.e. by requesting that zero threads be running. This is preferred as it doesn't risk killing some other process which happens to be called "nfsd". Since Linux v6.6 - and other stable kernels to which Commit: 390390240145 ("nfsd: don't allow nfsd threads to be signalled.") has been backported - sending a signal no longer works to stop nfs server threads. This patch changes the nfsserver script to use "rpc.nfsd 0" to stop server threads. (From OE-Core rev: b530827b938bcae33da08b65bab96d2549056f2e) Signed-off-by: NeilBrown <neil@brown.name> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 7b09ad289a36) Signed-off-by: Haixiao Yan <haixiao.yan.cn@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver28
1 files changed, 4 insertions, 24 deletions
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
index cb6c1b4d08..99ec280b35 100644
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
@@ -89,34 +89,14 @@ start_nfsd(){
89 start-stop-daemon --start --exec "$NFS_NFSD" -- "$@" 89 start-stop-daemon --start --exec "$NFS_NFSD" -- "$@"
90 echo done 90 echo done
91} 91}
92delay_nfsd(){
93 for delay in 0 1 2 3 4 5 6 7 8 9
94 do
95 if pidof nfsd >/dev/null
96 then
97 echo -n .
98 sleep 1
99 else
100 return 0
101 fi
102 done
103 return 1
104}
105stop_nfsd(){ 92stop_nfsd(){
106 # WARNING: this kills any process with the executable
107 # name 'nfsd'.
108 echo -n 'stopping nfsd: ' 93 echo -n 'stopping nfsd: '
109 start-stop-daemon --stop --quiet --signal 1 --name nfsd 94 $NFS_NFSD 0
110 if delay_nfsd || { 95 if pidof nfsd
111 echo failed
112 echo ' using signal 9: '
113 start-stop-daemon --stop --quiet --signal 9 --name nfsd
114 delay_nfsd
115 }
116 then 96 then
117 echo done
118 else
119 echo failed 97 echo failed
98 else
99 echo done
120 fi 100 fi
121} 101}
122 102