aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnna Schumaker <Anna.Schumaker@Netapp.com>2023-05-16 10:14:07 -0400
committerZorro Lang <zlang@kernel.org>2023-05-28 02:09:14 +0800
commita7afd52b4a89415074ccd17f8ba5eada7e1855d2 (patch)
tree377e24ea352393524a13ccb545693f6fa27f7b3a
parent199342c9fa4883292f0b988c3c844cb0209ed524 (diff)
downloadxfstests-dev-a7afd52b4a89415074ccd17f8ba5eada7e1855d2.tar.gz
generic: Add a test for xattr ctime updates
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> Reviewed-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
-rwxr-xr-xtests/generic/72843
-rw-r--r--tests/generic/728.out2
2 files changed, 45 insertions, 0 deletions
diff --git a/tests/generic/728 b/tests/generic/728
new file mode 100755
index 0000000000..fe3486be41
--- /dev/null
+++ b/tests/generic/728
@@ -0,0 +1,43 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2023 Netapp Inc., All Rights Reserved.
+#
+# FS QA Test 728
+#
+# Test a bug where 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/attr
+
+# real QA test starts here
+_supported_fs generic
+_require_test
+_require_attrs
+
+rm -rf $TEST_DIR/testfile
+touch $TEST_DIR/testfile
+
+check_xattr_op()
+{
+ what=$1
+ shift 1
+
+ before_ctime=$(stat -c %z $TEST_DIR/testfile)
+ # maximum known ctime granularity is 2s (e.g. FAT)
+ sleep 2
+ $SETFATTR_PROG $* $TEST_DIR/testfile
+ after_ctime=$(stat -c %z $TEST_DIR/testfile)
+
+ test "$before_ctime" != "$after_ctime" || echo "Expected ctime to change after $what."
+}
+
+check_xattr_op setxattr -n user.foobar -v 123
+check_xattr_op removexattr -x user.foobar
+
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/generic/728.out b/tests/generic/728.out
new file mode 100644
index 0000000000..ab39f45fe5
--- /dev/null
+++ b/tests/generic/728.out
@@ -0,0 +1,2 @@
+QA output created by 728
+Silence is golden