generic/728: Add a test for xattr ctime updates
Subsystems (2)
Anna Schumaker
maintainerPATCH v2 1/1 generic/728: Add a test for xattr ctime updates
From: Anna Schumaker <[email protected]>
The NFS client wasn't updating ctime after a setxattr request. This is a test written while fixing the bug.
---
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
tests/generic/728 new file +42 -0
@@ -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 + 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
tests/generic/728.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 728 +Silence is golden
Signature · 1 line
2.40.1
Quoted 46 lines · Anna Schumaker
From: Anna Schumaker <[email protected]>
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 <[email protected]>---
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.outtests/generic/728 new file +22
-0@@ -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
tests/generic/728 line 32
Quoted 10 lines
tests/generic/728 new file +10
-0+ + +_check_xattr_op() +{ + what=$1 + shift 1 + + before_ctime=$(stat -c %z $TEST_DIR/testfile) + $SETFATTR_PROG $* $TEST_DIR/testfile + after_ctime=$(stat -c %z $TEST_DIR/testfile)
What happens if the filesystem's timestamp granularity isn't sufficient to capture a difference across a setxattr operation? Most of the time we only update the (fast) timestamps at every clock tick, right?
--D
Quoted 21 lines
tests/generic/728 new file +10
-0+ + 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 +exittests/generic/728.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 728 +Silence is goldenSignature · 1 line
2.40.1
Quoted 53 lines · Darrick J. Wong
Quoted 52 lines · Anna Schumaker
From: Anna Schumaker <[email protected]>
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 <[email protected]>---
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.outtests/generic/728 new file +28
-0@@ -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
Quoted 8 lines
tests/generic/728 line 32
Quoted 4 lines
tests/generic/728 new file +4
-0+ + before_ctime=$(stat -c %z $TEST_DIR/testfile) + $SETFATTR_PROG $* $TEST_DIR/testfile + after_ctime=$(stat -c %z $TEST_DIR/testfile)What happens if the filesystem's timestamp granularity isn't sufficient to capture a difference across a setxattr operation? Most of the time we only update the (fast) timestamps at every clock tick, right?
OK, by talking with Darrick, I think "sleep 2s" might avoid most problem of timestamp granularity at here. (If this change don't affect your original test target). Any thoughts?
Quoted 25 lines
--D
Quoted 21 lines
tests/generic/728 new file +10
-0+ + 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 +exittests/generic/728.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 728 +Silence is goldenSignature · 1 line
2.40.1
Quoted 45 lines · Anna Schumaker
From: Anna Schumaker <[email protected]>
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 <[email protected]>---
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.outtests/generic/728 new file +21
-0@@ -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
tests/generic/728 line 31
Quoted 10 lines
tests/generic/728 new file +10
-0+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
Quoted 22 lines
tests/generic/728 new file +11
-0+ 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 +exittests/generic/728.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 728 +Silence is goldenSignature · 1 line
2.40.1
Anna Schumaker
maintainerQuoted 60 lines · Zorro Lang
Quoted 45 lines · Anna Schumaker
From: Anna Schumaker <[email protected]>
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 <[email protected]>---
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.outtests/generic/728 new file +21
-0@@ -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/testfiletests/generic/728 line 31
Quoted 10 lines
tests/generic/728 new file +10
-0+touch $TEST_DIR/testfile + + +_check_xattr_op() +{ + what=$1 + shift 1 + + before_ctime=$(stat -c %z $TEST_DIR/testfile) + $SETFATTR_PROG $* $TEST_DIR/testfileHi Anna,
Quoted 2 lines
If there's not objection from you, I'll add below codes at here, and merge this case in next fstests release:
Yeah, no objection from me. Sorry I haven't had a chance to get around to the change this week, I've been doing LSF.
Quoted 8 lines
(quoted diff) +4
-0+ # There might be filesystem's timestamp granularity, so sleep 2 seconds + # for most filesystems can capture a different timestamp across a + # setxattr operation + sleep 2sBTW, is there a known git commit which fix the issue of this case trying to test?
Not yet, but there will be soon. Those patches are still in review and might need minor fixups. Can the git commit be added once they're ready?
Anna
Quoted 27 lines
Thanks,
ZorroQuoted 22 lines
tests/generic/728 new file +11
-0+ 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 +exittests/generic/728.out new file +2
-1@@ -0,0 +1,2 @@ +QA output created by 728 +Silence is golden --2.40.1
Quoted 61 lines · Anna Schumaker
Quoted 60 lines · Zorro Lang
Quoted 45 lines · Anna Schumaker
From: Anna Schumaker <[email protected]>
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 <[email protected]>---
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.outtests/generic/728 new file +21
-0@@ -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/testfiletests/generic/728 line 31
Quoted 10 lines
tests/generic/728 new file +10
-0+touch $TEST_DIR/testfile + + +_check_xattr_op() +{ + what=$1 + shift 1 + + before_ctime=$(stat -c %z $TEST_DIR/testfile) + $SETFATTR_PROG $* $TEST_DIR/testfileHi Anna,
Quoted 5 lines
Quoted 2 lines
If there's not objection from you, I'll add below codes at here, and merge this case in next fstests release:
Yeah, no objection from me. Sorry I haven't had a chance to get around to the change this week, I've been doing LSF.
Oh, no push, hope you enjoy that!
Quoted 7 lines
Quoted 7 lines
(quoted diff) +4
-0+ # 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
Quoted 6 lines
Quoted 2 lines
BTW, is there a known git commit which fix the issue of this case trying to test?
Not yet, but there will be soon. Those patches are still in review and might need minor fixups. Can the git commit be added once they're ready?
Sure. Someone would like to add that later (don't forget:), someone else would like to write the commit id as "xxxxxxxxx", then replace it after the patch get merged. Both ways are good to me.
If you prefer the former, I can merge this V2 with above change. Or I can wait the V3 from you.
Thanks,
Zorro
Quoted 31 lines
Anna
Quoted 27 lines
Thanks,
ZorroQuoted 22 lines
tests/generic/728 new file +11
-0+ 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 +exittests/generic/728.out new file +2
-1@@ -0,0 +1,2 @@ +QA output created by 728 +Silence is golden --2.40.1