Message ID | 174800219540.608730.11726448273017682287@noble.neil.brown.name |
---|---|
State | Accepted, archived |
Commit | 7b09ad289a36e388ee4244b574ed32b66b654286 |
Headers | show |
Series | nfs-utils: don't use signals to shut down nfs server. | expand |
Hey Neil, On 5/23/25 3:41 AM, NeilBrown wrote: > > 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. > > Signed-off-by: NeilBrown <neil@brown.name> > --- > .../nfs-utils/nfs-utils/nfsserver | 28 +++---------------- > 1 file changed, 4 insertions(+), 24 deletions(-) > > Resending with different From: address because first attempt was bounced > as spam > > openembedded-core@lists.openembedded.org > host lb01.groups.io [45.79.81.153] > SMTP error from remote mail server after end of data: > 500 This message has been flagged as spam. > > > diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver > index cb6c1b4d08d8..99ec280b3594 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(){ > start-stop-daemon --start --exec "$NFS_NFSD" -- "$@" > echo done > } > -delay_nfsd(){ > - for delay in 0 1 2 3 4 5 6 7 8 9 > - do > - if pidof nfsd >/dev/null > - then > - echo -n . > - sleep 1 > - else > - return 0 > - fi > - done > - return 1 > -} > stop_nfsd(){ > - # WARNING: this kills any process with the executable > - # name 'nfsd'. > echo -n 'stopping nfsd: ' > - start-stop-daemon --stop --quiet --signal 1 --name nfsd > - if delay_nfsd || { > - echo failed > - echo ' using signal 9: ' > - start-stop-daemon --stop --quiet --signal 9 --name nfsd > - delay_nfsd > - } > + $NFS_NFSD 0 > + if pidof nfsd > then > - echo done > - else > echo failed > + else > + echo done > fi > } > Is this suppose to apply to the Linux nfs-utils upstream repo? A bit confused... steved.
On Thu, 05 Jun 2025, Steve Dickson wrote: > Hey Neil, > > On 5/23/25 3:41 AM, NeilBrown wrote: > > > > 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. > > > > Signed-off-by: NeilBrown <neil@brown.name> > > --- > > .../nfs-utils/nfs-utils/nfsserver | 28 +++---------------- > > 1 file changed, 4 insertions(+), 24 deletions(-) > > > > Resending with different From: address because first attempt was bounced > > as spam > > > > openembedded-core@lists.openembedded.org > > host lb01.groups.io [45.79.81.153] > > SMTP error from remote mail server after end of data: > > 500 This message has been flagged as spam. > > > > > > diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver > > index cb6c1b4d08d8..99ec280b3594 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(){ > > start-stop-daemon --start --exec "$NFS_NFSD" -- "$@" > > echo done > > } > > -delay_nfsd(){ > > - for delay in 0 1 2 3 4 5 6 7 8 9 > > - do > > - if pidof nfsd >/dev/null > > - then > > - echo -n . > > - sleep 1 > > - else > > - return 0 > > - fi > > - done > > - return 1 > > -} > > stop_nfsd(){ > > - # WARNING: this kills any process with the executable > > - # name 'nfsd'. > > echo -n 'stopping nfsd: ' > > - start-stop-daemon --stop --quiet --signal 1 --name nfsd > > - if delay_nfsd || { > > - echo failed > > - echo ' using signal 9: ' > > - start-stop-daemon --stop --quiet --signal 9 --name nfsd > > - delay_nfsd > > - } > > + $NFS_NFSD 0 > > + if pidof nfsd > > then > > - echo done > > - else > > echo failed > > + else > > + echo done > > fi > > } > > > Is this suppose to apply to the Linux nfs-utils upstream repo? > > A bit confused... Sorry, I should have been more explicit. As it says in the subject, this was for "OE-core" - openembedded-core It has since been committed there: https://git.openembedded.org/openembedded-core/commit/?id=7b09ad289a36 Thanks, NeilBrown
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver index cb6c1b4d08d8..99ec280b3594 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(){ start-stop-daemon --start --exec "$NFS_NFSD" -- "$@" echo done } -delay_nfsd(){ - for delay in 0 1 2 3 4 5 6 7 8 9 - do - if pidof nfsd >/dev/null - then - echo -n . - sleep 1 - else - return 0 - fi - done - return 1 -} stop_nfsd(){ - # WARNING: this kills any process with the executable - # name 'nfsd'. echo -n 'stopping nfsd: ' - start-stop-daemon --stop --quiet --signal 1 --name nfsd - if delay_nfsd || { - echo failed - echo ' using signal 9: ' - start-stop-daemon --stop --quiet --signal 9 --name nfsd - delay_nfsd - } + $NFS_NFSD 0 + if pidof nfsd then - echo done - else echo failed + else + echo done fi }
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. Signed-off-by: NeilBrown <neil@brown.name> --- .../nfs-utils/nfs-utils/nfsserver | 28 +++---------------- 1 file changed, 4 insertions(+), 24 deletions(-) Resending with different From: address because first attempt was bounced as spam openembedded-core@lists.openembedded.org host lb01.groups.io [45.79.81.153] SMTP error from remote mail server after end of data: 500 This message has been flagged as spam.