nfs/002: Add a test for xattr ctime updates
Subsystems (2)
Anna Schumaker
maintainerPATCH 1/1 nfs/002: 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.
--- 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
tests/nfs/002 new file +39 -0
@@ -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
tests/nfs/002.out new file +2 -0
@@ -0,0 +1,2 @@ +QA output created by 002 +Silence is golden
Signature · 1 line
2.40.1
Quoted 27 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]>--- 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.outtests/nfs/002 new file +8
-0@@ -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.
tests/nfs/002 line 18
Quoted 10 lines
tests/nfs/002 new file +10
-0+# +. ./common/preamble +_begin_fstest auto quick attr + +# Import common functions +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_fs nfs
Great, a new nfs test case!
tests/nfs/002 line 19
Quoted 1 line
tests/nfs/002 new file +1
-0+_require_test_nfs_version 4.2
But I'm wondering if this case can be a generic test case, due to the operations in this case are common (need xattr and ctime support), don't depend on any nfs specific features/operations.
Not sure why nfs4.2 is necessary, can it be removed or replaced ?
Thanks,
Zorro
Quoted 31 lines
tests/nfs/002 new file +20
-0+_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 +exittests/nfs/002.out new file +2
-0@@ -0,0 +1,2 @@ +QA output created by 002 +Silence is goldenSignature · 1 line
2.40.1
Anna Schumaker
maintainerHi Zorro,
Quoted 42 lines · Zorro Lang
Quoted 27 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]>--- 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.outtests/nfs/002 new file +8
-0@@ -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.tests/nfs/002 line 18
Quoted 10 lines
tests/nfs/002 new file +10
-0+# +. ./common/preamble +_begin_fstest auto quick attr + +# Import common functions +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_fs nfsGreat, a new nfs test case!
Quoted 5 lines
tests/nfs/002 line 19
Quoted 1 line
tests/nfs/002 new file +1
-0+_require_test_nfs_version 4.2But I'm wondering if this case can be a generic test case, due to the operations in this case are common (need xattr and ctime support), don't depend on any nfs specific features/operations.
This probably could be a generic test case.
Quoted 2 lines
Not sure why nfs4.2 is necessary, can it be removed or replaced ?
That's because xattrs were added to the NFS protocol in NFS v4.2, so I filtered out the other versions since they're not going to run anyway. I think xattr support is already checked to properly skip this on other versions, however, so changing this to a generic test shouldn't create a new failure on earlier NFS versions.
Should I send a v2 with those changes? And should I find an open test number, or choose something like "generic/999"?
Anna
Quoted 36 lines
Thanks,
ZorroQuoted 31 lines
tests/nfs/002 new file +20
-0+_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 +exittests/nfs/002.out new file +2
-1@@ -0,0 +1,2 @@ +QA output created by 002 +Silence is golden --2.40.1
Quoted 45 lines · Anna Schumaker
Hi Zorro,
Quoted 42 lines · Zorro Lang
Quoted 27 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]>--- 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.outtests/nfs/002 new file +8
-0@@ -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.tests/nfs/002 line 18
Quoted 10 lines
tests/nfs/002 new file +10
-0+# +. ./common/preamble +_begin_fstest auto quick attr + +# Import common functions +. ./common/filter +. ./common/attr + +# real QA test starts here +_supported_fs nfsGreat, a new nfs test case!
Quoted 7 lines
Quoted 5 lines
tests/nfs/002 line 19
Quoted 1 line
tests/nfs/002 new file +1
-0+_require_test_nfs_version 4.2But I'm wondering if this case can be a generic test case, due to the operations in this case are common (need xattr and ctime support), don't depend on any nfs specific features/operations.
This probably could be a generic test case.
Great :)
Quoted 9 lines
Quoted 3 lines
Not sure why nfs4.2 is necessary, can it be removed or replaced ?
That's because xattrs were added to the NFS protocol in NFS v4.2, so I filtered out the other versions since they're not going to run anyway. I think xattr support is already checked to properly skip this on other versions, however, so changing this to a generic test shouldn't create a new failure on earlier NFS versions.
That makes sense.
Quoted 2 lines
Should I send a v2 with those changes? And should I find an open test
Sure, please send v2 to change this case to be a generic test case. Then we can check if more other filesystems has this issue :)
Quoted 1 line
number, or choose something like "generic/999"?
That depends on you. Due to there's only one test case in this patch, so you just need to base on latest for-next branch, then choose a number which has been taken, I'll deal with that if there's conflict when I merge.
Quoted 38 lines
Anna
Quoted 36 lines
Thanks,
ZorroQuoted 31 lines
tests/nfs/002 new file +20
-0+_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 +exittests/nfs/002.out new file +2
-1@@ -0,0 +1,2 @@ +QA output created by 002 +Silence is golden --2.40.1
Quoted 19 lines · Zorro Lang
Quoted 18 lines · Anna Schumaker
Hi Zorro,
Quoted 15 lines · Zorro Lang
Quoted 13 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]>--- 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
Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
tests/nfs/002 new file +0
-0Quoted 8 lines
Quoted 8 lines
tests/nfs/002 line 7
Quoted 8 lines
tests/nfs/002 new file +7
-0@@ -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
^^ ?
Quoted 1 line
Quoted 1 line
Quoted 1 line
tests/nfs/002 line 8
Quoted 1 line
tests/nfs/002 new file +1
-0+# server after setting an xattr, resulting in `stat` reporting a stale ctime.
If there's a known bug fix (git commit) in linux, you can use _fixed_by_kernel_commit(), refer to other cases which use this function.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
tests/nfs/002 line 14
Quoted 6 lines
tests/nfs/002 new file +6
-0+# +. ./common/preamble +_begin_fstest auto quick attr + +# Import common functions +. ./common/filter
I think the common/filter isn't needed.
Quoted 32 lines
Quoted 7 lines
Quoted 7 lines
tests/nfs/002 line 18
Quoted 4 lines
tests/nfs/002 new file +4
-0+. ./common/attr + +# real QA test starts here +_supported_fs nfsGreat, a new nfs test case!
Quoted 7 lines
Quoted 5 lines
tests/nfs/002 line 19
Quoted 1 line
tests/nfs/002 new file +1
-0+_require_test_nfs_version 4.2But I'm wondering if this case can be a generic test case, due to the operations in this case are common (need xattr and ctime support), don't depend on any nfs specific features/operations.
This probably could be a generic test case.
Great :)
Quoted 9 lines
Quoted 3 lines
Not sure why nfs4.2 is necessary, can it be removed or replaced ?
That's because xattrs were added to the NFS protocol in NFS v4.2, so I filtered out the other versions since they're not going to run anyway. I think xattr support is already checked to properly skip this on other versions, however, so changing this to a generic test shouldn't create a new failure on earlier NFS versions.
That makes sense.
Quoted 2 lines
Should I send a v2 with those changes? And should I find an open test
Quoted 14 lines
Sure, please send v2 to change this case to be a generic test case. Then we can check if more other filesystems has this issue :)
Quoted 1 line
number, or choose something like "generic/999"?
That depends on you. Due to there's only one test case in this patch, so you just need to base on latest for-next branch, then choose a number which has been taken, I'll deal with that if there's conflict when I merge.
Quoted 5 lines
Anna
Quoted 4 lines
Thanks,
Zorro
_require_test
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
tests/nfs/002 line 22
Quoted 3 lines
tests/nfs/002 new file +3
-0+_require_attrs + +touch $TEST_DIR/testfile
We can't be sure there's not a file (or even a directory or others) named "testfile" in TEST_DIR when fstests is running. So better to remove it at first. E.g
rm -rf $TEST_DIR/testfile
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
tests/nfs/002 line 26
Quoted 4 lines
tests/nfs/002 new file +4
-0+ +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)
Might "%Z" be better to be compared? (optional)
Thanks,
Zorro
Quoted 26 lines
Quoted 26 lines
Quoted 25 lines
Quoted 24 lines
tests/nfs/002 new file +13
-0+ +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 +exittests/nfs/002.out new file +2
-1@@ -0,0 +1,2 @@ +QA output created by 002 +Silence is golden --2.40.1
Anna Schumaker
maintainerQuoted 21 lines · Zorro Lang
Quoted 19 lines · Zorro Lang
Quoted 18 lines · Anna Schumaker
Hi Zorro,
Quoted 15 lines · Zorro Lang
Quoted 13 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]>--- 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
Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
tests/nfs/002 new file +0
-0Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
tests/nfs/002 line 7
Quoted 8 lines
tests/nfs/002 new file +7
-0@@ -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^^ ?
Whoops, typo! I'll fix that in v2
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
tests/nfs/002 line 8
Quoted 2 lines
tests/nfs/002 new file +1
-0+# server after setting an xattr, resulting in `stat` reporting a stale ctime.If there's a known bug fix (git commit) in linux, you can use
_fixed_by_kernel_commit(), refer to other cases which use this function.
Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
tests/nfs/002 line 14
Quoted 6 lines
tests/nfs/002 new file +6
-0+# +. ./common/preamble +_begin_fstest auto quick attr + +# Import common functions +. ./common/filterI think the common/filter isn't needed.
Okay
Quoted 57 lines
Quoted 32 lines
Quoted 7 lines
Quoted 7 lines
tests/nfs/002 line 18
Quoted 4 lines
tests/nfs/002 new file +4
-0+. ./common/attr + +# real QA test starts here +_supported_fs nfsGreat, a new nfs test case!
Quoted 7 lines
Quoted 5 lines
tests/nfs/002 line 19
Quoted 1 line
tests/nfs/002 new file +1
-0+_require_test_nfs_version 4.2But I'm wondering if this case can be a generic test case, due to the operations in this case are common (need xattr and ctime support), don't depend on any nfs specific features/operations.
This probably could be a generic test case.
Great :)
Quoted 9 lines
Quoted 3 lines
Not sure why nfs4.2 is necessary, can it be removed or replaced ?
That's because xattrs were added to the NFS protocol in NFS v4.2, so I filtered out the other versions since they're not going to run anyway. I think xattr support is already checked to properly skip this on other versions, however, so changing this to a generic test shouldn't create a new failure on earlier NFS versions.
That makes sense.
Quoted 2 lines
Should I send a v2 with those changes? And should I find an open test
Quoted 14 lines
Sure, please send v2 to change this case to be a generic test case. Then we can check if more other filesystems has this issue :)
Quoted 1 line
number, or choose something like "generic/999"?
That depends on you. Due to there's only one test case in this patch, so you just need to base on latest for-next branch, then choose a number which has been taken, I'll deal with that if there's conflict when I merge.
Quoted 5 lines
Anna
Quoted 4 lines
Thanks,
Zorro
_require_testQuoted 3 lines
Quoted 3 lines
Quoted 3 lines
tests/nfs/002 line 22
Quoted 3 lines
tests/nfs/002 new file +3
-0+_require_attrs + +touch $TEST_DIR/testfileWe can't be sure there's not a file (or even a directory or others) named "testfile" in
TEST_DIRwhen fstests is running. So better to remove it at first. E.g
Quoted 1 line
rm -rf $TEST_DIR/testfile
Okay
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
tests/nfs/002 line 26
Quoted 5 lines
tests/nfs/002 new file +4
-0+ +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)Might "%Z" be better to be compared? (optional)
No, I tried that at first but since it's reporting seconds since epoch it doesn't have enough granularity to detect the change.
Anna
Quoted 31 lines
Thanks,
ZorroQuoted 26 lines
Quoted 26 lines
Quoted 25 lines
Quoted 24 lines
tests/nfs/002 new file +13
-0+ +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 +exittests/nfs/002.out new file +2
-1@@ -0,0 +1,2 @@ +QA output created by 002 +Silence is golden --2.40.1