]> www.infradead.org Git - users/hch/xfstests-dev.git/commitdiff
generic: add a test to check move in mountpoints of the same export
authorYongcheng Yang <yoyang@redhat.com>
Thu, 21 Sep 2023 13:43:47 +0000 (21:43 +0800)
committerZorro Lang <zlang@kernel.org>
Thu, 5 Oct 2023 14:37:32 +0000 (22:37 +0800)
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>
tests/generic/732 [new file with mode: 0755]
tests/generic/732.out [new file with mode: 0644]

diff --git a/tests/generic/732 b/tests/generic/732
new file mode 100755 (executable)
index 0000000..785aac5
--- /dev/null
@@ -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 (file)
index 0000000..451f82c
--- /dev/null
@@ -0,0 +1,2 @@
+QA output created by 732
+Silence is golden