aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYongcheng Yang <yoyang@redhat.com>2023-09-21 21:43:47 +0800
committerZorro Lang <zlang@kernel.org>2023-10-05 22:37:32 +0800
commitfb817fa4be6b51162b4e783596cc47957f28786f (patch)
tree8e795c4bb335f55e73371dede3c1c75a9afeeba0
parent7a093dfa66d61ad107235161a5a52444d361e387 (diff)
downloadxfstests-dev-fb817fa4be6b51162b4e783596cc47957f28786f.tar.gz
generic: add a test to check move in mountpoints of the same export
Add a new test to ckeck file move (rename) operation among different mount points which are mounting to a same export. This should be a simple test but it recently unveils an ancient nfsd bug. Thus let's make it to be a regresstion check. Signed-off-by: Yongcheng Yang <yoyang@redhat.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
-rwxr-xr-xtests/generic/73258
-rw-r--r--tests/generic/732.out2
2 files changed, 60 insertions, 0 deletions
diff --git a/tests/generic/732 b/tests/generic/732
new file mode 100755
index 0000000000..785aac58f3
--- /dev/null
+++ b/tests/generic/732
@@ -0,0 +1,58 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023 Red Hat, Inc. All Rights Reserved.
+#
+# FS QA Test No. 732
+#
+# Mount the same export to different mount points and move (rename)
+# files among those mount points.
+# This simple test recently unveils an ancient nfsd bug that is fixed
+# by fdd2630a739819 ("nfsd: fix change_info in NFSv4 RENAME replies").
+#
+. ./common/preamble
+_begin_fstest auto quick rename
+
+# Override the default cleanup function.
+_cleanup()
+{
+ $UMOUNT_PROG $testdir1 2>/dev/null
+ $UMOUNT_PROG $testdir2 2>/dev/null
+ cd /
+ rm -r -f $tmp.*
+}
+
+# real QA test starts here
+_supported_fs generic
+[ "$FSTYP" = "nfs" ] && _fixed_by_kernel_commit fdd2630a739819 \
+ "nfsd: fix change_info in NFSv4 RENAME replies"
+
+_require_test
+_require_scratch
+
+echo "Silence is golden"
+
+_scratch_mkfs >> $seqres.full
+testdir1=$TEST_DIR/mountpoint1-$seq
+testdir2=$TEST_DIR/mountpoint2-$seq
+rm -rf $testdir1 $testdir2
+mkdir -p $testdir1 $testdir2
+
+# Don't share the data and attribute caches among mount points for NFS.
+# This caching behavior is necessary to reproduce this issue as we're
+# checking the alignment of each mount point's own unique cache.
+[ "$FSTYP" = "nfs" ] && MOUNT_OPTIONS="-o nosharecache"
+
+SCRATCH_MNT=$testdir1 _scratch_mount
+SCRATCH_MNT=$testdir2 _scratch_mount
+rm -rf $testdir1/{A,B}
+mkdir $testdir1/{A,B}
+touch $testdir1/A/f
+mv $testdir1/A/f $testdir1/B/
+cat $testdir2/B/f
+mv $testdir2/B/f $testdir2/A/
+cat $testdir1/A/f
+mv $testdir1/A/f $testdir1/B/
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/732.out b/tests/generic/732.out
new file mode 100644
index 0000000000..451f82ce2d
--- /dev/null
+++ b/tests/generic/732.out
@@ -0,0 +1,2 @@
+QA output created by 732
+Silence is golden