[LTP] [PATCH 1/1] nfs_lib: Fix fsid randomisation

Petr Vorel pvorel@suse.cz
Fri Mar 11 13:49:23 CET 2022


Testing nfs with multiple versions (-v, i.e. nfs0*_06 - testing with
nfs06.sh) nfs_lib.sh exports multiple different directories all with the
same fsid= value, which is not supposed to work (and breaks on older
nfs-utils).

Therefore increase fsid value for each loop.

Reported-by: Neil Brown <neilb@suse.de>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi,

fsid check is not required, but added to prevent another false positive
in the future.

Thanks Neil!

Kind regards,
Petr

 testcases/network/nfs/nfs_stress/nfs_lib.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/testcases/network/nfs/nfs_stress/nfs_lib.sh b/testcases/network/nfs/nfs_stress/nfs_lib.sh
index 7a7cd9925b..ad96bb4438 100644
--- a/testcases/network/nfs/nfs_stress/nfs_lib.sh
+++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
@@ -79,7 +79,11 @@ nfs_server_udp_enabled()
 
 nfs_setup_server()
 {
-	local export_cmd="exportfs -i -o fsid=$$,no_root_squash,rw *:$remote_dir"
+
+	local fsid="$1"
+	local export_cmd="exportfs -i -o fsid=$fsid,no_root_squash,rw *:$remote_dir"
+
+	[ -z "$fsid" ] && tst_brk TBROK "empty fsid"
 
 	if tst_net_use_netns; then
 		if ! test -d $remote_dir; then
@@ -161,7 +165,7 @@ nfs_setup()
 		remote_dir="$TST_TMPDIR/$i/$type"
 		mkdir -p $local_dir
 
-		nfs_setup_server
+		nfs_setup_server $(($$ + n))
 
 		opts="-o proto=$type,vers=$i"
 		nfs_mount
-- 
2.35.1



More information about the ltp mailing list