diff mbox series

[3/4] nfsstat01.sh: Add support for NFSv4*

Message ID 20240131151446.936281-4-pvorel@suse.cz
State Accepted
Headers show
Series nfsstat: Test also on NFSv4* | expand

Commit Message

Petr Vorel Jan. 31, 2024, 3:14 p.m. UTC
NFSv4, NFSv4.1 and NFSv4.2 have following changes:
* server (/proc/net/rpc/nfsd) has "remove" remove 1) in proc4ops line 2)
  in column 31.
* client (/proc/net/rpc/nfs) has "remove" record in column 24.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Dear NFS developers,

I hope I found correct column (reading utils/nfsstat/nfsstat.c [1] and
comparing content of /proc/net/rpc/nfs{,d} and nfsstat output), but
please correct me, if other value should be tested.

You can test this LTP patchset with these commands:

git clone -b rename-net.nfs.v2 https://github.com/pevik/ltp.git && cd ltp
# optionally install LTP build dependencies with ./ci/YOUR_DISTRO.sh
make autotools && ./configure
for i in testcases/lib testcases/kernel/fs/fsstress/ testcases/network/nfs*/; do cd $i && make -j`nproc` && make install; cd -; done

PATH=/opt/ltp/testcases/bin:$PATH LTP_SINGLE_FS_TYPE=ext4 nfsstat01.sh -v4.1 # -v can be 3, 4, 4.1, 4.2

Kind regards,
Petr

[1] https://git.linux-nfs.org/?p=steved/nfs-utils.git;a=blob;f=utils/nfsstat/nfsstat.c;h=ca845325f0dc02a4f005dd44b010fcadcff4d3c7;hb=HEAD

 testcases/network/nfs/nfsstat01/nfsstat01.sh | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/testcases/network/nfs/nfsstat01/nfsstat01.sh b/testcases/network/nfs/nfsstat01/nfsstat01.sh
index 4c09ae135..c2856eff1 100755
--- a/testcases/network/nfs/nfsstat01/nfsstat01.sh
+++ b/testcases/network/nfs/nfsstat01/nfsstat01.sh
@@ -45,7 +45,9 @@  get_calls()
 #           tracking using the 'nfsstat' command and /proc/net/rpc
 do_test()
 {
-	local client_calls server_calls new_server_calls new_client_calls field
+	local client_calls server_calls new_server_calls new_client_calls
+	local client_field server_field
+	local client_v=$VERSION server_v=$VERSION
 
 	tst_res TINFO "checking RPC calls for server/client"
 
@@ -75,21 +77,23 @@  do_test()
 
 	tst_res TINFO "checking NFS calls for server/client"
 	case $VERSION in
-	2) field=13
+	2) client_field=13 server_field=13
 	;;
-	*) field=15
+	3) client_field=15 server_field=15
+	;;
+	4*) client_field=24 server_field=31 client_v=4 server_v=4ops
 	;;
 	esac
 
-	server_calls="$(get_calls proc$VERSION $field nfsd)"
-	client_calls="$(get_calls proc$VERSION $field nfs)"
+	server_calls="$(get_calls proc$server_v $server_field nfsd)"
+	client_calls="$(get_calls proc$client_v $client_field nfs)"
 	tst_res TINFO "calls $server_calls/$client_calls"
 
 	tst_res TINFO "Checking for tracking of NFS calls for server/client"
 	rm -f nfsstat01.tmp
 
-	new_server_calls="$(get_calls proc$VERSION $field nfsd)"
-	new_client_calls="$(get_calls proc$VERSION $field nfs)"
+	new_server_calls="$(get_calls proc$server_v $server_field nfsd)"
+	new_client_calls="$(get_calls proc$client_v $client_field nfs)"
 	tst_res TINFO "new calls $new_server_calls/$new_client_calls"
 
 	if [ "$new_server_calls" -le "$server_calls" ]; then