[LTP] [PATCH v3 2/2] Add test for data integrity over NFS
Martin Doucha
mdoucha@suse.cz
Wed Dec 4 18:23:10 CET 2024
Add NFS test which checks data integrity of random writes into a file,
with both buffered and direct I/O.
Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
Changes since v1: Added TST_TIMEOUT
Changes since v2: Force NFS blocksize to the underlying FS blocksize
By default, NFS uses very large blocksize (up to 1MB) to optimize network
communication. For the FS integrity test this means a significant slowdown
because the size of the test file and I/O operations increase with
blocksize. Autodetect the blocksize of the underlying filesystem and force
the same value during NFS mount to speed things up.
The TST_TIMEOUT value is calculated as worst-case scenario for 64KB
blocksize. On reasonably modern x86_64 machines, the new tests take about
6 minutes to complete in total (with Btrfs, Ext4 and XFS being tested).
runtest/net.nfs | 11 ++++++
testcases/network/nfs/nfs_stress/nfs10.sh | 47 +++++++++++++++++++++++
2 files changed, 58 insertions(+)
create mode 100755 testcases/network/nfs/nfs_stress/nfs10.sh
diff --git a/runtest/net.nfs b/runtest/net.nfs
index 7f84457bc..fef993da8 100644
--- a/runtest/net.nfs
+++ b/runtest/net.nfs
@@ -94,6 +94,17 @@ nfs09_v40_ip6t nfs09.sh -6 -v 4 -t tcp
nfs09_v41_ip6t nfs09.sh -6 -v 4.1 -t tcp
nfs09_v42_ip6t nfs09.sh -6 -v 4.2 -t tcp
+nfs10_v30_ip4u nfs10.sh -v 3 -t udp
+nfs10_v30_ip4t nfs10.sh -v 3 -t tcp
+nfs10_v40_ip4t nfs10.sh -v 4 -t tcp
+nfs10_v41_ip4t nfs10.sh -v 4.1 -t tcp
+nfs10_v42_ip4t nfs10.sh -v 4.2 -t tcp
+nfs10_v30_ip6u nfs10.sh -6 -v 3 -t udp
+nfs10_v30_ip6t nfs10.sh -6 -v 3 -t tcp
+nfs10_v40_ip6t nfs10.sh -6 -v 4 -t tcp
+nfs10_v41_ip6t nfs10.sh -6 -v 4.1 -t tcp
+nfs10_v42_ip6t nfs10.sh -6 -v 4.2 -t tcp
+
nfslock01_v30_ip4u nfslock01.sh -v 3 -t udp
nfslock01_v30_ip4t nfslock01.sh -v 3 -t tcp
nfslock01_v40_ip4t nfslock01.sh -v 4 -t tcp
diff --git a/testcases/network/nfs/nfs_stress/nfs10.sh b/testcases/network/nfs/nfs_stress/nfs10.sh
new file mode 100755
index 000000000..2fca4f916
--- /dev/null
+++ b/testcases/network/nfs/nfs_stress/nfs10.sh
@@ -0,0 +1,47 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (C) 2024 SUSE LLC <mdoucha@suse.cz>
+#
+# DESCRIPTION: Verify data integrity over NFS, with and without O_DIRECT
+
+TST_CNT=4
+TST_SETUP="nfs10_setup"
+TST_TESTFUNC="do_test"
+TST_DEVICE_SIZE=1024
+TST_TIMEOUT=660
+
+nfs10_setup()
+{
+ local bsize=$(stat -f -c %s .)
+
+ bsize=$(( $bsize < 1024 ? 1024 : $bsize ))
+ NFS_MOUNT_OPTS="rsize=$bsize,wsize=$bsize"
+ nfs_setup
+}
+
+do_test1()
+{
+ tst_res TINFO "Testing buffered write, buffered read"
+ EXPECT_PASS fsplough -c 512 -d "$PWD"
+}
+
+do_test2()
+{
+ tst_res TINFO "Testing buffered write, direct read"
+ EXPECT_PASS fsplough -c 512 -R -d "$PWD"
+}
+
+do_test3()
+{
+ tst_res TINFO "Testing direct write, buffered read"
+ EXPECT_PASS fsplough -c 512 -W -d "$PWD"
+}
+
+do_test4()
+{
+ tst_res TINFO "Testing direct write, direct read"
+ EXPECT_PASS fsplough -c 512 -RW -d "$PWD"
+}
+
+. nfs_lib.sh
+tst_run
--
2.47.0
More information about the ltp
mailing list