All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nfs/002: Add a test for xattr ctime updates
@ 2023-05-04 20:48 Anna Schumaker
  2023-05-05  4:44 ` Zorro Lang
  0 siblings, 1 reply; 6+ messages in thread
From: Anna Schumaker @ 2023-05-04 20:48 UTC (permalink / raw)
  To: linux-nfs, fstests; +Cc: anna

From: Anna Schumaker <Anna.Schumaker@Netapp.com>

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@Netapp.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-05-05 14:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-04 20:48 [PATCH] nfs/002: Add a test for xattr ctime updates Anna Schumaker
2023-05-05  4:44 ` Zorro Lang
2023-05-05 13:11   ` Anna Schumaker
2023-05-05 14:05     ` Zorro Lang
2023-05-05 14:29       ` Zorro Lang
2023-05-05 14:34         ` Anna Schumaker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.