public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v3 0/3] NFS: test on all filesystems
@ 2023-04-24 21:08 Petr Vorel
  2023-04-24 21:08 ` [LTP] [PATCH v3 1/3] nfs_lib.sh: Cleanup local and remote directories setup Petr Vorel
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Petr Vorel @ 2023-04-24 21:08 UTC (permalink / raw)
  To: ltp
  Cc: linux-nfs, NeilBrown, Jeff Layton, Steve Dickson, Chuck Lever,
	Trond Myklebust

Hi all,

finally I managed to finish the support for LTP NFS tests to be running
on all available testing filesystems via TST_ALL_FILESYSTEMS=1.

I believe this will help to cover more bugs than testing on single
underlying filesystem.

Thank you to Neil Brown to help with the debugging of umounting loop
device, which was the problem in the past.

Kind regards,
Petr

Petr Vorel (3):
  nfs_lib.sh: Cleanup local and remote directories setup
  nfs_lib.sh: Unexport on proper side on netns
  nfs: Run on all filesystems

 testcases/network/nfs/nfs_stress/nfs_lib.sh | 82 +++++++++++++++------
 1 file changed, 61 insertions(+), 21 deletions(-)

-- 
2.40.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] [PATCH v3 1/3] nfs_lib.sh: Cleanup local and remote directories setup
  2023-04-24 21:08 [LTP] [PATCH v3 0/3] NFS: test on all filesystems Petr Vorel
@ 2023-04-24 21:08 ` Petr Vorel
  2023-04-24 21:08 ` [LTP] [PATCH v3 2/3] nfs_lib.sh: Unexport on proper side on netns Petr Vorel
  2023-04-24 21:08 ` [LTP] [PATCH v3 3/3] nfs: Run on all filesystems Petr Vorel
  2 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2023-04-24 21:08 UTC (permalink / raw)
  To: ltp
  Cc: linux-nfs, NeilBrown, Jeff Layton, Steve Dickson, Chuck Lever,
	Trond Myklebust

Logic for creating local and remote directories was on more places.
Create get_local_dir() and get_remote_dir() functions to keep it on
single place.

local dir is needed in nfs_mount(), but was defined in nfs_setup()
and reused local variable with shell inheritance (ugly!), because there
were all parameters from loop.  Similarly, remote dir is needed in
both nfs_mount() and nfs_setup_server(), but created with shell
inheritance in nfs_setup().  Pass these params to nfs_mount() and
nfs_setup_server() and define variables with new functions
get_local_dir() and get_remote_dir().

Use get_remote_dir() in nfs_get_remote_path().

Move cd to local directory to the end of nfs_mount() (it used to cd
after nfs_mount(), but only if -v parameter contained single version,
but it does not harm to always cd).

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/nfs/nfs_stress/nfs_lib.sh | 52 ++++++++++++++-------
 1 file changed, 34 insertions(+), 18 deletions(-)

diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
index af7d46a21..1b5604ab5 100644
--- a/testcases/network/nfs/nfs_stress/nfs_lib.sh
+++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
-# Copyright (c) Linux Test Project, 2016-2022
+# Copyright (c) Linux Test Project, 2016-2023
 # Copyright (c) 2015-2018 Oracle and/or its affiliates. All Rights Reserved.
 # Copyright (c) International Business Machines  Corp., 2001
 
@@ -53,6 +53,24 @@ get_socket_type()
 	done
 }
 
+# directory mounted by NFS client
+get_local_dir()
+{
+	local v="$1"
+	local n="$2"
+
+	echo "$TST_TMPDIR/$v/$n"
+}
+
+# directory on NFS server
+get_remote_dir()
+{
+	local v="$1"
+	local n="$2"
+
+	echo "$TST_TMPDIR/$v/$n"
+}
+
 nfs_get_remote_path()
 {
 	local v
@@ -63,7 +81,7 @@ nfs_get_remote_path()
 	done
 
 	v=${1:-$v}
-	echo "$TST_TMPDIR/$v/$type"
+	echo "$(get_remote_dir $v $type)"
 }
 
 nfs_server_udp_enabled()
@@ -78,8 +96,8 @@ nfs_server_udp_enabled()
 
 nfs_setup_server()
 {
-
-	local fsid="$1"
+	local remote_dir="$1"
+	local fsid="$2"
 	local export_cmd="exportfs -i -o fsid=$fsid,no_root_squash,rw *:$remote_dir"
 
 	[ -z "$fsid" ] && tst_brk TBROK "empty fsid"
@@ -97,10 +115,14 @@ nfs_setup_server()
 
 nfs_mount()
 {
-	local opts="$1"
+	local local_dir="$1"
+	local remote_dir="$2"
+	local opts="$3"
 	local host_type=rhost
 	local mount_dir
 
+	mkdir -p "$local_dir"
+
 	tst_net_use_netns && host_type=
 
 	if [ $TST_IPV6 ]; then
@@ -131,6 +153,8 @@ nfs_mount()
 
 		tst_brk TBROK "mount command failed"
 	fi
+
+	cd "$local_dir"
 }
 
 nfs_setup()
@@ -162,20 +186,12 @@ nfs_setup()
 			tst_brk TCONF "UDP support disabled on NFS server"
 		fi
 
-		local_dir="$TST_TMPDIR/$i/$n"
-		remote_dir="$TST_TMPDIR/$i/$type"
-		mkdir -p $local_dir
-
-		nfs_setup_server $(($$ + n))
-
-		nfs_mount "-o proto=$type,vers=$i"
+		remote_dir="$(get_remote_dir $i $type)"
+		nfs_setup_server "$remote_dir" "$(($$ + n))"
+		nfs_mount "$(get_local_dir $i $n)" "$remote_dir" "-o proto=$type,vers=$i"
 
 		n=$(( n + 1 ))
 	done
-
-	if [ "$n" -eq 1 ]; then
-		cd ${VERSION}/0
-	fi
 }
 
 nfs_cleanup()
@@ -190,7 +206,7 @@ nfs_cleanup()
 
 	local n=0
 	for i in $VERSION; do
-		local_dir="$TST_TMPDIR/$i/$n"
+		local_dir="$(get_local_dir $i $n)"
 		grep -q "$local_dir" /proc/mounts && umount $local_dir
 		n=$(( n + 1 ))
 	done
@@ -198,7 +214,7 @@ nfs_cleanup()
 	n=0
 	for i in $VERSION; do
 		type=$(get_socket_type $n)
-		remote_dir="$TST_TMPDIR/$i/$type"
+		remote_dir="$(get_remote_dir $i $type)"
 		tst_rhost_run -c "test -d $remote_dir && exportfs -u *:$remote_dir"
 		tst_rhost_run -c "test -d $remote_dir && rm -rf $remote_dir"
 		n=$(( n + 1 ))
-- 
2.40.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [LTP] [PATCH v3 2/3] nfs_lib.sh: Unexport on proper side on netns
  2023-04-24 21:08 [LTP] [PATCH v3 0/3] NFS: test on all filesystems Petr Vorel
  2023-04-24 21:08 ` [LTP] [PATCH v3 1/3] nfs_lib.sh: Cleanup local and remote directories setup Petr Vorel
@ 2023-04-24 21:08 ` Petr Vorel
  2023-04-24 21:08 ` [LTP] [PATCH v3 3/3] nfs: Run on all filesystems Petr Vorel
  2 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2023-04-24 21:08 UTC (permalink / raw)
  To: ltp
  Cc: linux-nfs, NeilBrown, Jeff Layton, Steve Dickson, Chuck Lever,
	Trond Myklebust, Nikita Yushchenko

f6b267055 changed exportfs run locally on netns, therefore unexporting
should be also run at the same namespace. This is not problematic now,
but will be a problem with TST_ALL_FILESYSTEMS=1, which is sensitive for
timing.

Fixes: f6b267055 ("nfs_lib.sh: run exportfs at "server side" in LTP_NETNS case")

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/nfs/nfs_stress/nfs_lib.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
index 1b5604ab5..042fea5e4 100644
--- a/testcases/network/nfs/nfs_stress/nfs_lib.sh
+++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
@@ -215,8 +215,16 @@ nfs_cleanup()
 	for i in $VERSION; do
 		type=$(get_socket_type $n)
 		remote_dir="$(get_remote_dir $i $type)"
-		tst_rhost_run -c "test -d $remote_dir && exportfs -u *:$remote_dir"
-		tst_rhost_run -c "test -d $remote_dir && rm -rf $remote_dir"
+
+		if tst_net_use_netns; then
+			if test -d $remote_dir; then
+				exportfs -u *:$remote_dir
+				rm -rf $remote_dir
+			fi
+		else
+			tst_rhost_run -c "test -d $remote_dir && exportfs -u *:$remote_dir"
+			tst_rhost_run -c "test -d $remote_dir && rm -rf $remote_dir"
+		fi
 		n=$(( n + 1 ))
 	done
 }
-- 
2.40.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [LTP] [PATCH v3 3/3] nfs: Run on all filesystems
  2023-04-24 21:08 [LTP] [PATCH v3 0/3] NFS: test on all filesystems Petr Vorel
  2023-04-24 21:08 ` [LTP] [PATCH v3 1/3] nfs_lib.sh: Cleanup local and remote directories setup Petr Vorel
  2023-04-24 21:08 ` [LTP] [PATCH v3 2/3] nfs_lib.sh: Unexport on proper side on netns Petr Vorel
@ 2023-04-24 21:08 ` Petr Vorel
  2023-04-25 10:30   ` Petr Vorel
  2 siblings, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2023-04-24 21:08 UTC (permalink / raw)
  To: ltp
  Cc: linux-nfs, NeilBrown, Jeff Layton, Steve Dickson, Chuck Lever,
	Trond Myklebust

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 <pvorel@suse.cz>
---
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


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [LTP] [PATCH v3 3/3] nfs: Run on all filesystems
  2023-04-24 21:08 ` [LTP] [PATCH v3 3/3] nfs: Run on all filesystems Petr Vorel
@ 2023-04-25 10:30   ` Petr Vorel
  0 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2023-04-25 10:30 UTC (permalink / raw)
  To: ltp
  Cc: linux-nfs, NeilBrown, Jeff Layton, Steve Dickson, Chuck Lever,
	Trond Myklebust

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

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-04-25 10:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-24 21:08 [LTP] [PATCH v3 0/3] NFS: test on all filesystems Petr Vorel
2023-04-24 21:08 ` [LTP] [PATCH v3 1/3] nfs_lib.sh: Cleanup local and remote directories setup Petr Vorel
2023-04-24 21:08 ` [LTP] [PATCH v3 2/3] nfs_lib.sh: Unexport on proper side on netns Petr Vorel
2023-04-24 21:08 ` [LTP] [PATCH v3 3/3] nfs: Run on all filesystems Petr Vorel
2023-04-25 10:30   ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox