From: Anna Schumaker <anna@kernel.org>
To: linux-nfs@vger.kernel.org, fstests@vger.kernel.org, zlang@redhat.com
Cc: anna@kernel.org
Subject: [PATCH v3] generic/728: Add a test for xattr ctime updates
Date: Tue, 16 May 2023 10:14:07 -0400 [thread overview]
Message-ID: <20230516141407.201674-1-anna@kernel.org> (raw)
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>
---
v3:
- Add a 2 second sleep before changing the xattr
v2:
- Move test to generic/
- Address comments from the mailing list
---
tests/generic/728 | 43 +++++++++++++++++++++++++++++++++++++++++++
tests/generic/728.out | 2 ++
2 files changed, 45 insertions(+)
create mode 100755 tests/generic/728
create mode 100644 tests/generic/728.out
diff --git a/tests/generic/728 b/tests/generic/728
new file mode 100755
index 000000000000..8e52eb4b219c
--- /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)
+ 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 000000000000..ab39f45fe5da
--- /dev/null
+++ b/tests/generic/728.out
@@ -0,0 +1,2 @@
+QA output created by 728
+Silence is golden
--
2.40.1
next reply other threads:[~2023-05-16 14:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-16 14:14 Anna Schumaker [this message]
2023-05-16 15:00 ` [PATCH v3] generic/728: Add a test for xattr ctime updates Darrick J. Wong
2023-05-18 5:21 ` Zorro Lang
2023-05-17 5:04 ` Anand Jain
2023-05-18 5:25 ` Zorro Lang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230516141407.201674-1-anna@kernel.org \
--to=anna@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=zlang@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.