Use variables:
* TST_ALL_FILESYSTEMS=1 to run on all filesystems
* TST_FORMAT_DEVICE=1 to get loop device formatted
* TST_MOUNT_DEVICE=1 to get it mounted
Filesystems (tested the usual LTP way on loop device) are used for
server side (exportfs), client side (NFS mount) is kept outside of it.
For some reason umounting needs some time before NFS server stops using
underlying loop device. Also exportfs needs time before files can be
removed. Otherwise second umounting fails:
nfs07 4 TINFO: Cleaning up testcase
umount: /var/tmp/LTP_nfs07.FNZ7yCbqZe/mntpoint: target is busy.
nfs07 4 TINFO: umount(/var/tmp/LTP_nfs07.FNZ7yCbqZe/mntpoint) failed, try 1 ...
nfs07 4 TINFO: Likely gvfsd-trash is probing newly mounted fs, kill it to speed up tests.
umount: /var/tmp/LTP_nfs07.FNZ7yCbqZe/mntpoint: target is busy.
Solved with adding two sleeps for 1 sec (using less is not enough,
specially for nfs07.sh).
Skipping some problematic filesystems:
* exfat
Although it works on some systems (e.g. openSUSE Tumbleweed
with kernel 6.2.8-1-default, nfs-utils 2.6.2, exfatprogs 1.2.0), it
fails on other systems (e.g. SLES 15-SP4 with kernel 5.14.21, nfs-utils
2.1.1, exfatprogs 1.0.4 or Debian 12 bookworm with kernel 6.1.0-6-amd64,
nfs-utils 2.6.2, exfatprogs 1.2.0)
* tmpfs on nfs-utils < 2
tmpfs fails on nfs-utils 1.3.3:
nfs07 1 TINFO: mount.nfs: (linux nfs-utils 1.3.3)
nfs07 1 TINFO: setup NFSv4.2, socket type tcp
nfs07 1 TINFO: Mounting NFS: mount -v -t nfs -o proto=tcp,vers=4.2 10.0.0.2:/tmp/LTP_nfs07.cex71Q5bxw/mntpoint/4.2/tcp /tmp/LTP_nfs07.cex71Q5bxw/4.2/0
mount.nfs: mount(2): No such file or directory
mount.nfs: mounting 10.0.0.2:/tmp/LTP_nfs07.cex71Q5bxw/mntpoint/4.2/tcp failed, reason given by server: No such file or directory
mount.nfs: timeout set for Mon Apr 24 21:34:02 2023
mount.nfs: trying text-based options 'proto=tcp,vers=4.2,addr=10.0.0.2,clientaddr=10.0.0.1'
nfs07 1 TBROK: mount command failed
But it works on nfs-utils 2.1.1 on SLE15-SP4.
Signed-off-by: Petr Vorel <[email protected]>
---
I'd expect that c5528f40 ("Fix NFSv4 export of tmpfs filesystems")
from 2.5.4 is needed, but it works in SLE 15-SP4 which is 2.1.1 and this
patch was not backported.
testcases/network/nfs/nfs_stress/nfs_lib.sh | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
index 042fea5e4..1c6657a14 100644
--- a/testcases/network/nfs/nfs_stress/nfs_lib.sh
+++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
@@ -28,7 +28,10 @@ NFS_PARSE_ARGS_CALLER="$TST_PARSE_ARGS"
TST_OPTS="v:t:$TST_OPTS"
TST_PARSE_ARGS=nfs_parse_args
TST_USAGE=nfs_usage
-TST_NEEDS_TMPDIR=1
+TST_ALL_FILESYSTEMS=1
+TST_SKIP_FILESYSTEMS="exfat"
+TST_MOUNT_DEVICE=1
+TST_FORMAT_DEVICE=1
TST_NEEDS_ROOT=1
TST_NEEDS_CMDS="$TST_NEEDS_CMDS mount exportfs mount.nfs"
TST_SETUP="${TST_SETUP:-nfs_setup}"
@@ -68,7 +71,7 @@ get_remote_dir()
local v="$1"
local n="$2"
- echo "$TST_TMPDIR/$v/$n"
+ echo "$TST_MNTPOINT/$v/$n"
}
nfs_get_remote_path()
@@ -165,6 +168,7 @@ nfs_setup()
local local_dir
local remote_dir
local mount_dir
+ local util_version
if [ "$(stat -f . | grep "Type: nfs")" ]; then
tst_brk TCONF "Cannot run nfs-stress test on mounted NFS"
@@ -178,6 +182,14 @@ nfs_setup()
tst_res TINFO "$(mount.nfs -V)"
+ util_version=$(mount.nfs -V | sed 's/.*nfs-utils \([0-9]\)\..*/\1/')
+ if ! tst_is_int "$util_version"; then
+ tst_brk TBROK "Failed to detect mount.nfs major version"
+ fi
+ if [ "$TST_FS_TYPE" = "tmpfs" ] && [ "$util_version" -lt 2 ]; then
+ tst_brk TCONF "Testing tmpfs requires nfs-utils > 1"
+ fi
+
for i in $VERSION; do
type=$(get_socket_type $n)
tst_res TINFO "setup NFSv$i, socket type $type"
@@ -210,6 +222,7 @@ nfs_cleanup()
grep -q "$local_dir" /proc/mounts && umount $local_dir
n=$(( n + 1 ))
done
+ sleep 1
n=0
for i in $VERSION; do
@@ -219,12 +232,15 @@ nfs_cleanup()
if tst_net_use_netns; then
if test -d $remote_dir; then
exportfs -u *:$remote_dir
+ sleep 1
rm -rf $remote_dir
fi
else
tst_rhost_run -c "test -d $remote_dir && exportfs -u *:$remote_dir"
+ sleep 1
tst_rhost_run -c "test -d $remote_dir && rm -rf $remote_dir"
fi
+
n=$(( n + 1 ))
done
}
--
2.40.0
Hi all,
unfortunately nfs05.sh fails for some reason (the only test which fails).
It works on various filesystems:
nfs05 1 TINFO: using not default LTP netns: 'tst_ns_exec 31811 net,mnt'
nfs05 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface
nfs05 1 TINFO: add local addr 10.0.0.2/24
nfs05 1 TINFO: add local addr fd00:1:1:1::2/64
nfs05 1 TINFO: initialize 'rhost' 'ltp_ns_veth1' interface
nfs05 1 TINFO: add remote addr 10.0.0.1/24
nfs05 1 TINFO: add remote addr fd00:1:1:1::1/64
nfs05 1 TINFO: Network config (local -- remote):
nfs05 1 TINFO: ltp_ns_veth2 -- ltp_ns_veth1
nfs05 1 TINFO: 10.0.0.2/24 -- 10.0.0.1/24
nfs05 1 TINFO: fd00:1:1:1::2/64 -- fd00:1:1:1::1/64
tst_device.c:96: TINFO: Found free device 0 '/dev/loop0'
tst_supported_fs_types.c:90: TINFO: Kernel supports ext2
tst_supported_fs_types.c:55: TINFO: mkfs.ext2 does exist
tst_supported_fs_types.c:90: TINFO: Kernel supports ext3
tst_supported_fs_types.c:55: TINFO: mkfs.ext3 does exist
tst_supported_fs_types.c:90: TINFO: Kernel supports ext4
tst_supported_fs_types.c:55: TINFO: mkfs.ext4 does exist
tst_supported_fs_types.c:90: TINFO: Kernel supports xfs
tst_supported_fs_types.c:55: TINFO: mkfs.xfs does exist
tst_supported_fs_types.c:90: TINFO: Kernel supports btrfs
tst_supported_fs_types.c:55: TINFO: mkfs.btrfs does exist
tst_supported_fs_types.c:90: TINFO: Kernel supports vfat
tst_supported_fs_types.c:55: TINFO: mkfs.vfat does exist
tst_supported_fs_types.c:157: TINFO: Skipping exfat as requested by the test
tst_supported_fs_types.c:120: TINFO: FUSE does support ntfs
tst_supported_fs_types.c:55: TINFO: mkfs.ntfs does exist
tst_supported_fs_types.c:90: TINFO: Kernel supports tmpfs
tst_supported_fs_types.c:42: TINFO: mkfs is not needed for tmpfs
nfs05 1 TINFO: === Testing on ext2 ===
nfs05 1 TINFO: Formatting ext2 with opts='/dev/loop0'
nfs05 1 TINFO: Mounting device: mount -t ext2 /dev/loop0 /tmp/LTP_nfs05.BXqm4Onw7z/mntpoint
nfs05 1 TINFO: timeout per run is 0h 10m 0s
nfs05 1 TINFO: mount.nfs: (linux nfs-utils 2.6.2)
nfs05 1 TINFO: setup NFSv4, socket type tcp
nfs05 1 TINFO: Mounting NFS: mount -v -t nfs -o proto=tcp,vers=4 10.0.0.2:/tmp/LTP_nfs05.BXqm4Onw7z/mntpoint/4/tcp /tmp/LTP_nfs05.BXqm4Onw7z/4/0
nfs05 1 TINFO: start nfs05_make_tree -d 10 -f 30 -t 8
tst_test.c:1558: TINFO: Timeout per run is 0h 11m 00s
nfs05_make_tree.c:211: TPASS: 'make' successfully build and clean all targets
Summary:
passed 1
failed 0
broken 0
skipped 0
warnings 0
nfs05 1 TPASS: test finished
nfs05 2 TINFO: Cleaning up testcase
nfs05 2 TINFO: === Testing on ext3 ===
...
But later it fails for btrfs:
nfs05 5 TINFO: === Testing on btrfs ===
nfs05 5 TINFO: Formatting btrfs with opts='/dev/loop0'
nfs05 5 TINFO: Mounting device: mount -t btrfs /dev/loop0 /tmp/LTP_nfs05.BXqm4Onw7z/mntpoint
nfs05 5 TINFO: timeout per run is 0h 10m 0s
nfs05 5 TINFO: mount.nfs: (linux nfs-utils 2.6.2)
nfs05 5 TINFO: setup NFSv4, socket type tcp
nfs05 5 TINFO: Mounting NFS: mount -v -t nfs -o proto=tcp,vers=4 10.0.0.2:/tmp/LTP_nfs05.BXqm4Onw7z/mntpoint/4/tcp /tmp/LTP_nfs05.BXqm4Onw7z/4/0
nfs05 5 TINFO: start nfs05_make_tree -d 10 -f 30 -t 8
tst_test.c:1558: TINFO: Timeout per run is 0h 11m 00s
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: 1021.2.5: final close failed: No space left on device
collect2: error: ld returned 1 exit status
make[2]: *** [makefile:7: 1021.2.5] Error 1
make[1]: *** [makefile:9: dir] Error 2
make: *** [makefile:9: dir] Error 2
tst_cmd.c:121: TBROK: 'make' exited with a non-zero code 2 at tst_cmd.c:121
Summary:
passed 0
failed 0
broken 1
skipped 0
warnings 0
nfs05 5 TBROK: nfs05_make_tree -d 10 -f 30 -t 8 failed
nfs05 5 TINFO: Cleaning up testcase
/usr/lib64/gcc/x86_64-suse-linux/13/../../../../x86_64-suse-linux/bin/ld: 1015.2.9: final close failed: No space left on device
I expect the problem is not with btrfs itself, but with somehow broken cleanup
of the space.
Kind regards,
Petr