[PATCH] generic/471: add a test to check move in mountpoints of the same export

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



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@xxxxxxxxxx>
---

Hi,

There is an ancient nfsd problem just pop up and is now resolved by
the upstream commit [1]. Looks like it's a basic and simple test which
is probably appropriate for the fstest IMO.

This test in nfs will be failed without patch [1]:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[root@kvm-07-guest24 xfstests]# ./check -nfs generic/471
FSTYP     	-- nfs
PLATFORM  	-- Linux/x86_64 kvm-07-guest24 5.14.0-abc.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Sep 13 04:59:08 EDT 2023
MKFS_OPTIONS  -- localhost:/export_test2
MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 localhost:/export_test2 /mnt_scratch

generic/471 1s ... - output mismatch (see /root/xfstests/results//generic/471.out.bad)
	--- tests/generic/471.out    2023-09-21 05:55:28.514673177 -0400
	+++ /root/xfstests/results//generic/471.out.bad    2023-09-21 08:06:16.935695355 -0400
	@@ -1,2 +1,3 @@
 	QA output created by 471
 	Silence is golden
	+mv: '/mnt_test/mountpoint1-471/A/f' and '/mnt_test/mountpoint1-471/B/f' are the same file
	...
	(Run 'diff -u /root/xfstests/tests/generic/471.out /root/xfstests/results//generic/471.out.bad'  to see the entire diff)

HINT: You _MAY_ be missing kernel fix:
  	fdd2630a739819 nfsd: fix change_info in NFSv4 RENAME replies

Ran: generic/471
Failures: generic/471
Failed 1 of 1 tests

[root@kvm-07-guest24 xfstests]#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

And it can pass after that patch [1] merged:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[root@fsqe-r6515-02 xfstests]# ./check -nfs generic/471
FSTYP     	-- nfs
PLATFORM  	-- Linux/x86_64 fsqe-r6515-02 5.14.0-abcd.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Sep 19 08:10:36 EDT 2023
MKFS_OPTIONS  -- localhost:/export_test1
MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 localhost:/export_test1 /mnt_scratch

generic/471    	0s
Ran: generic/471
Passed all 1 tests

[root@fsqe-r6515-02 xfstests]#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Also I have just checked the xfs and overlayfs but the latter get failed:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[root@fsqe-r6515-02 xfstests]# ./check generic/471
FSTYP         -- xfs (non-debug)
PLATFORM      -- Linux/x86_64 fsqe-r6515-02 5.14.0-abcd.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Sep 19 08:10:36 EDT 2023
MKFS_OPTIONS  -- -f /dev/loop1
MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/loop1 /mnt_scratch

generic/471 0s ...  1s
Ran: generic/471
Passed all 1 tests

[root@fsqe-r6515-02 xfstests]#
[root@fsqe-r6515-02 xfstests]# ./check -overlay generic/471
FSTYP         -- overlay
PLATFORM      -- Linux/x86_64 fsqe-r6515-02 5.14.0-abcd.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Sep 19 08:10:36 EDT 2023
MKFS_OPTIONS  -- /mnt_scratch
MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /mnt_scratch /mnt_scratch/ovl-mnt

generic/471 0s ... - output mismatch (see /root/xfstests/results//generic/471.out.bad)
    --- tests/generic/471.out	2023-09-21 09:02:14.580495256 -0400
    +++ /root/xfstests/results//generic/471.out.bad	2023-09-21 09:02:51.145345830 -0400
    @@ -1,2 +1,3 @@
     QA output created by 471
     Silence is golden
    +mv: '/mnt_test/ovl-mnt/mountpoint1-471/A/f' and '/mnt_test/ovl-mnt/mountpoint1-471/B/f' are the same file
    ...
    (Run 'diff -u /root/xfstests/tests/generic/471.out /root/xfstests/results//generic/471.out.bad'  to see the entire diff)
Ran: generic/471
Failures: generic/471
Failed 1 of 1 tests

[root@fsqe-r6515-02 xfstests]#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For now I'm not sure if the overlayfs don't support this operation or
we just need to fix that.

Thanks,
Yongcheng

[1] https://lore.kernel.org/linux-nfs/ZPyMyv1nNFV2whKP@xxxxxxxxxxxxxxxxxxxxxx/T/#t


 tests/generic/471     | 60 +++++++++++++++++++++++++++++++++++++++++++
 tests/generic/471.out |  2 ++
 2 files changed, 62 insertions(+)
 create mode 100755 tests/generic/471
 create mode 100644 tests/generic/471.out

diff --git a/tests/generic/471 b/tests/generic/471
new file mode 100755
index 00000000..ada48129
--- /dev/null
+++ b/tests/generic/471
@@ -0,0 +1,60 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023 Red Hat, Inc.  All Rights Reserved.
+#
+# FS QA Test 471
+#
+# 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
+
+# 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/471.out b/tests/generic/471.out
new file mode 100644
index 00000000..260f629e
--- /dev/null
+++ b/tests/generic/471.out
@@ -0,0 +1,2 @@
+QA output created by 471
+Silence is golden
-- 
2.31.1




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux