On 5/23/2025 8:13 PM, NeilBrown wrote:
CAUTION: This email comes from a non Wind River email account! Do not click links or open attachments unless you recognize the sender and know the content is safe.
On Fri, 23 May 2025, Yan, Haixiao (CN) wrote:
On 5/23/2025 3:42 PM, NeilBrown wrote:
CAUTION: This email comes from a non Wind River email account! Do not click links or open attachments unless you recognize the sender and know the content is safe.
On Fri, 23 May 2025, Yan, Haixiao (CN) wrote:
On 5/23/2025 7:21 AM, NeilBrown wrote:
CAUTION: This email comes from a non Wind River email account! Do not click links or open attachments unless you recognize the sender and know the content is safe.
On Thu, 22 May 2025, Haixiao Yan wrote:
On 2025/5/22 07:32, NeilBrown wrote: > CAUTION: This email comes from a non Wind River email account! > Do not click links or open attachments unless you recognize the sender and know the content is safe. > > On Thu, 22 May 2025, Yan, Haixiao (CN) wrote: >> On linux-5.10.y, my testcase run failed: >> >> root@intel-x86-64:/opt/wr-test/testcases/userspace/nfs-utils_v6# mount -t nfs [::1]:/mnt/nfs_root /mnt/v6 -o nfsvers=3 >> mount.nfs: requested NFS version or transport protocol is not supported >> >> The first bad commit is: >> >> commit 7229200f68662660bb4d55f19247eaf3c79a4217 >> Author: Chuck Lever chuck.lever@oracle.com >> Date: Mon Jun 3 10:35:02 2024 -0400 >> >> nfsd: don't allow nfsd threads to be signalled. >> >> [ Upstream commit 3903902401451b1cd9d797a8c79769eb26ac7fe5 ] >> >> >> Here is the test log: >> >> root@intel-x86-64:/opt/wr-test/testcases/userspace/nfs-utils_v6# dd if=/dev/zero of=/tmp/nfs.img bs=1M count=100 >> 100+0 records in >> 100+0 records out >> 104857600 bytes (105 MB, 100 MiB) copied, 0.0386658 s, 2.7 GB/s >> root@intel-x86-64:/opt/wr-test/testcases/userspace/nfs-utils_v6# mkfs /tmp/nfs.img >> mke2fs 1.46.1 (9-Feb-2021) >> Discarding device blocks: 1024/102400 done >> Creating filesystem with 102400 1k blocks and 25688 inodes >> Filesystem UUID: 77e3bc56-46bb-4e5c-9619-d9a0c0999958 >> Superblock backups stored on blocks: >> 8193, 24577, 40961, 57345, 73729 >> >> Allocating group tables: 0/13 done >> Writing inode tables: 0/13 done >> Writing superblocks and filesystem accounting information: 0/13 done >> root@intel-x86-64:/opt/wr-test/testcases/userspace/nfs-utils_v6# mount /tmp/nfs.img /mnt >> >> root@intel-x86-64:/opt/wr-test/testcases/userspace/nfs-utils_v6# mkdir /mnt/nfs_root >> >> root@intel-x86-64:/opt/wr-test/testcases/userspace/nfs-utils_v6# touch /etc/exports >> >> root@intel-x86-64:/opt/wr-test/testcases/userspace/nfs-utils_v6# echo '/mnt/nfs_root *(insecure,rw,async,no_root_squash)' >> /etc/exports >> >> root@intel-x86-64:/opt/wr-test/testcases/userspace/nfs-utils_v6# /opt/wr-test/bin/svcwp.sh nfsserver restart >> stopping mountd: done >> stopping nfsd: ..........failed >> using signal 9: >> ..........failed > What does your "nfsserver" script do to try to stop/restart the nfsd? > For a very long time the approved way to stop nfsd has been to run > "rpc.nfsd 0". My guess is that whatever script you are using still > trying to send a signal to nfsd. That no longer works. > > Unfortunately the various sysv-init scripts for starting/stopping nfsd > have never been part of nfs-utils so we were not able to update them. > nfs-utils *does* contain systemd unit files for sites which use systemd. > > If you have a non-systemd way of starting/stopping nfsd, we would be > happy to make the relevant scripts part of nfs-utils so that we can > ensure they stay up to date. Actually, we use service nfsserver restart => /etc/init.d/nfsserver =>
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 } then echo done else echo failed fi
The above should all be changed to echo -n 'stopping nfsd: ' rpc.nfsd 0 echo done
or similar. What distro are you using?
I can't see how this would affect your problem with IPv6 but it would be nice if you could confirm that IPv6 still doesn't work even after changing the above. What version of nfs-utils are you using? Are you should that the kernel has IPv6 enabled? Does "ping6 ::1" work?
NeilBrown
It works as expected.
My distro is Yocto and nfs-utils 2.5.3.
Thanks. I've sent a patch to openembedded to change the nfsserver script.
Can you make the change to nfsserver and let me know if it fixes your problem?
What's the version of your nfs-utils?
The patch isn't against nfs-utils. It is against openembedded-core https://git.openembedded.org/openembedded-core which is what yocto is based on.
I was expecting you to manually edit /etc/init.d/nfsserver to make the changes. Or you could possibly:
patch /etc/init.d/nfssever < THE-PATCH
NeilBrown
I have verified the patch, it works as expected.
$ cat 0001-nfs-utils-don-t-use-signals-to-shut-down-nfs-server.patch
From d99df205d0aca0703a49834df39435442044433b Mon Sep 17 00:00:00 2001 From: NeilBrown neil@brown.name Date: Fri, 23 May 2025 23:58:09 +0800 Subject: [PATCH] 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.
Signed-off-by: NeilBrown neil@brown.name Signed-off-by: Haixiao Yan haixiao.yan.cn@windriver.com --- .../nfs-utils/nfs-utils/nfsserver | 28 +++---------------- 1 file 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 0f5747cc6db9..053980271c05 100644 --- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver @@ -66,34 +66,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 }