On Fri, May 05, 2023 at 01:24:27PM -0400, Anna Schumaker wrote: > 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> > > --- > v2: > - Move test to generic/ > - Address comments from the mailing list > --- > tests/generic/728 | 42 ++++++++++++++++++++++++++++++++++++++++++ > tests/generic/728.out | 2 ++ > 2 files changed, 44 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..ab2414c151db > --- /dev/null > +++ b/tests/generic/728 > @@ -0,0 +1,42 @@ > +#! /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) > + $SETFATTR_PROG $* $TEST_DIR/testfile Hi Anna, If there's not objection from you, I'll add below codes at here, and merge this case in next fstests release: + # There might be filesystem's timestamp granularity, so sleep 2 seconds + # for most filesystems can capture a different timestamp across a + # setxattr operation + sleep 2s BTW, is there a known git commit which fix the issue of this case trying to test? Thanks, Zorro > + 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 >