diff options
| author | NeilBrown <neilb@suse.de> | 2025-05-23 17:41:19 +1000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-05-27 09:01:17 +0100 |
| commit | 7c8ab2cee4dcfb498dcde1619171f3fd27abcee4 (patch) | |
| tree | abb7eb228fcc982c56ae65c5117c9b408a5e7046 /meta | |
| parent | e1e7cde0eec0cca9609c88d02cf434fdc990d109 (diff) | |
| download | poky-7c8ab2cee4dcfb498dcde1619171f3fd27abcee4.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: 7b09ad289a36e388ee4244b574ed32b66b654286)
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>
Diffstat (limited to 'meta')
| -rw-r--r-- | meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver | 28 |
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 | } |
| 92 | delay_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 | } | ||
| 105 | stop_nfsd(){ | 92 | stop_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 | ||
