Linux NFS development
 help / color / mirror / Atom feed
From: Anna Schumaker <anna@kernel.org>
To: linux-nfs@vger.kernel.org, fstests@vger.kernel.org
Cc: anna@kernel.org
Subject: [PATCH] nfs/002: Add a test for xattr ctime updates
Date: Thu,  4 May 2023 16:48:47 -0400	[thread overview]
Message-ID: <20230504204847.405037-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>
---
 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


             reply	other threads:[~2023-05-04 20:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-04 20:48 Anna Schumaker [this message]
2023-05-05  4:44 ` [PATCH] nfs/002: Add a test for xattr ctime updates 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

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=20230504204847.405037-1-anna@kernel.org \
    --to=anna@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox