[PATCH] nfs/002: Add a test for xattr ctime updates

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



From: Anna Schumaker <Anna.Schumaker@xxxxxxxxxx>

The NFS client wasn't updating ctime after a setxattr request. This is a
test written while fixing the bug.

Signed-off-by: Anna Schumaker <Anna.Schumaker@xxxxxxxxxx>
---
 tests/nfs/002     | 39 +++++++++++++++++++++++++++++++++++++++
 tests/nfs/002.out |  2 ++
 2 files changed, 41 insertions(+)
 create mode 100755 tests/nfs/002
 create mode 100644 tests/nfs/002.out

diff --git a/tests/nfs/002 b/tests/nfs/002
new file mode 100755
index 000000000000..5bfedef6c57d
--- /dev/null
+++ b/tests/nfs/002
@@ -0,0 +1,39 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023 Netapp Inc., All Rights Reserved.
+#
+# FS QA Test 002
+#
+# Test a bug whene the NFS client wasn't sending a post-op GETATTR to the
+# server after setting an xattr, resulting in `stat` reporting a stale ctime.
+#
+. ./common/preamble
+_begin_fstest auto quick attr
+
+# Import common functions
+. ./common/filter
+. ./common/attr
+
+# real QA test starts here
+_supported_fs nfs
+_require_test_nfs_version 4.2
+_require_attrs
+
+touch $TEST_DIR/testfile
+
+before_ctime=$(stat -c %z $TEST_DIR/testfile)
+$SETFATTR_PROG -n user.foobar -v 123 $TEST_DIR/testfile
+after_ctime=$(stat -c %z $TEST_DIR/testfile)
+
+test "$before_ctime" != "$after_ctime" || echo "Expected ctime to change."
+
+
+before_ctime=$after_ctime
+$SETFATTR_PROG -x user.foobar $TEST_DIR/testfile
+after_ctime=$(stat -c %z $TEST_DIR/testfile)
+
+test "$before_ctime" != "$after_ctime" || echo "Expected ctime to change."
+
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/nfs/002.out b/tests/nfs/002.out
new file mode 100644
index 000000000000..61705c7cc203
--- /dev/null
+++ b/tests/nfs/002.out
@@ -0,0 +1,2 @@
+QA output created by 002
+Silence is golden
-- 
2.40.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