nfs/nfs08.sh: Add test for NFS cache invalidation
Subsystems (2)
PATCH 1/1 nfs/nfs08.sh: Add test for NFS cache invalidation
v4 [1] of not yet upstreamed patch accidentally broke cache invalidation for directories by clearing NFS_INO_INVALID_DATA inappropriately. Although it was fixed in v5 [2] thus kernel was not actually broken, it's better to prevent this in the future.
[1] https://lore.kernel.org/linux-nfs/[email protected]/
[2] https://lore.kernel.org/linux-nfs/[email protected]/
---
NOTE: although Neil suggested to test on ext2 to make the problems more obvious (ext2 has low-resolution time stamps) and to use sleep, with nfs_lib.sh LTP code it works without sleep and on all filesystems.
It'd require more changes in nfs_lib.sh to force ext2 only for nfs08.sh (other tests are using the library). Not only it's needed, but I also plan to switch nfs_lib.sh to use all available filesystems via TST_ALL_FILESYSTEMS=1, therefore ext2 will be among tested filesystems anyway.
Test fails also on all available NFS versions, thus using the same approach as the other tests - test all versions, although not sure if it's really needed. But test runs very quickly (unlike other nfs tests it's not a stress test), thus I'd keep it.
NOTE: anybody trying to test this patch with TMPDIR (to test different filesystems) test with this fix [1].
Kind regards,
Petr
[1] https://lore.kernel.org/ltp/[email protected]/
runtest/net.nfs | 11 +++++++++++ testcases/network/nfs/nfs_stress/Makefile | 9 +-------- testcases/network/nfs/nfs_stress/nfs08.sh | 20 ++++++++++++++++++++ 3 files changed, 32 insertions(+), 8 deletions(-) create mode 100755 testcases/network/nfs/nfs_stress/nfs08.sh
runtest/net.nfs +11 -0
@@ -72,6 +72,17 @@ nfs4_ipv6_07 nfs07.sh -6 -v 4 -t tcp nfs41_ipv6_07 nfs07.sh -6 -v 4.1 -t tcp nfs42_ipv6_07 nfs07.sh -6 -v 4.2 -t tcp +nfs3_08 nfs08.sh -v 3 -t udp +nfs3t_08 nfs08.sh -v 3 -t tcp +nfs4_08 nfs08.sh -v 4 -t tcp +nfs41_08 nfs08.sh -v 4.1 -t tcp +nfs42_08 nfs08.sh -v 4.2 -t tcp +nfs3_ipv6_08 nfs08.sh -6 -v 3 -t udp +nfs3t_ipv6_08 nfs08.sh -6 -v 3 -t tcp +nfs4_ipv6_08 nfs08.sh -6 -v 4 -t tcp +nfs41_ipv6_08 nfs08.sh -6 -v 4.1 -t tcp +nfs42_ipv6_08 nfs08.sh -6 -v 4.2 -t tcp + nfslock3_01 nfslock01.sh -v 3 -t udp nfslock3t_01 nfslock01.sh -v 3 -t tcp nfslock4_01 nfslock01.sh -v 4 -t tcp
testcases/network/nfs/nfs_stress/Makefile +1 -8
@@ -9,13 +9,6 @@ include $(top_srcdir)/include/mk/testcases.mk nfs04_create_file: CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE nfs05_make_tree: LDLIBS += -lpthread -INSTALL_TARGETS := nfs_lib.sh \ - nfs01.sh \ - nfs02.sh \ - nfs03.sh \ - nfs04.sh \ - nfs05.sh \ - nfs06.sh \ - nfs07.sh +INSTALL_TARGETS := *.sh include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/network/nfs/nfs_stress/nfs08.sh new file +20 -0
@@ -0,0 +1,20 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2023 Petr Vorel <[email protected]> +# Test reproducer for broken NFS cache invalidation for directories. +# Based on reproducer from Neil Brown <[email protected]> + +TST_TESTFUNC="do_test" + +do_test() +{ + tst_res TINFO "testing NFS cache invalidation for directories" + + touch 1 + EXPECT_PASS 'ls | grep 1' + touch 2 + EXPECT_PASS 'ls | grep 2' +} + +. nfs_lib.sh +tst_run
Signature · 5 lines
2.40.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi all,
[ Cc linux-nfs ML, sorry for the noise ]
Kind regards,
Petr
Quoted 106 lines
v4 [1] of not yet upstreamed patch accidentally broke cache invalidation for directories by clearing
NFS_INO_INVALID_DATAinappropriately. Although it was fixed in v5 [2] thus kernel was not actually broken, it's better to prevent this in the future.[1] https://lore.kernel.org/linux-nfs/[email protected]/
[2] https://lore.kernel.org/linux-nfs/[email protected]/Signed-off-by Petr Vorel <[email protected]>---
NOTE: although Neil suggested to test on ext2 to make the problems more obvious (ext2 has low-resolution time stamps) and to use sleep, withnfs_lib.shLTP code it works without sleep and on all filesystems.It'd require more changes in
nfs_lib.shto force ext2 only fornfs08.sh(other tests are using the library). Not only it's needed, but I also plan to switchnfs_lib.shto use all available filesystems via TST_ALL_FILESYSTEMS=1, therefore ext2 will be among tested filesystems anyway.Test fails also on all available NFS versions, thus using the same approach as the other tests - test all versions, although not sure if it's really needed. But test runs very quickly (unlike other nfs tests it's not a stress test), thus I'd keep it.
NOTE: anybody trying to test this patch with TMPDIR (to test different filesystems) test with this fix [1].
Kind regards,
Petr[1] https://lore.kernel.org/ltp/[email protected]/
runtest/net.nfs | 11 +++++++++++ testcases/network/nfs/nfs_stress/Makefile | 9 +-------- testcases/network/nfs/nfs_stress/nfs08.sh | 20 ++++++++++++++++++++ 3 files changed, 32 insertions(+), 8 deletions(-) create mode 100755 testcases/network/nfs/nfs_stress/nfs08.shruntest/net.nfs +11
-0@@ -72,6 +72,17 @@ nfs4_ipv6_07 nfs07.sh -6 -v 4 -t tcp nfs41_ipv6_07 nfs07.sh -6 -v 4.1 -t tcp nfs42_ipv6_07 nfs07.sh -6 -v 4.2 -t tcp +nfs3_08 nfs08.sh -v 3 -t udp +nfs3t_08 nfs08.sh -v 3 -t tcp +nfs4_08 nfs08.sh -v 4 -t tcp +nfs41_08 nfs08.sh -v 4.1 -t tcp +nfs42_08 nfs08.sh -v 4.2 -t tcp +nfs3_ipv6_08 nfs08.sh -6 -v 3 -t udp +nfs3t_ipv6_08 nfs08.sh -6 -v 3 -t tcp +nfs4_ipv6_08 nfs08.sh -6 -v 4 -t tcp +nfs41_ipv6_08 nfs08.sh -6 -v 4.1 -t tcp +nfs42_ipv6_08 nfs08.sh -6 -v 4.2 -t tcp + nfslock3_01 nfslock01.sh -v 3 -t udp nfslock3t_01 nfslock01.sh -v 3 -t tcp nfslock4_01 nfslock01.sh -v 4 -t tcptestcases/network/nfs/nfs_stress/Makefile +1
-8@@ -9,13 +9,6 @@ include $(top_srcdir)/include/mk/testcases.mk nfs04_create_file: CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE nfs05_make_tree: LDLIBS += -lpthread -INSTALL_TARGETS := nfs_lib.sh \ - nfs01.sh \ - nfs02.sh \ - nfs03.sh \ - nfs04.sh \ - nfs05.sh \ - nfs06.sh \ - nfs07.sh +INSTALL_TARGETS := *.sh include $(top_srcdir)/include/mk/generic_leaf_target.mktestcases/network/nfs/nfs_stress/nfs08.sh new file +20
-0@@ -0,0 +1,20 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2023 Petr Vorel <[email protected]> +# Test reproducer for broken NFS cache invalidation for directories. +# Based on reproducer from Neil Brown <[email protected]> + +TST_TESTFUNC="do_test" + +do_test() +{ + tst_res TINFO "testing NFS cache invalidation for directories" + + touch 1 + EXPECT_PASS 'ls | grep 1' + touch 2 + EXPECT_PASS 'ls | grep 2' +} + +. nfs_lib.sh +tst_run
Hi!
Quoted 94 lines
v4 [1] of not yet upstreamed patch accidentally broke cache invalidation for directories by clearing
NFS_INO_INVALID_DATAinappropriately. Although it was fixed in v5 [2] thus kernel was not actually broken, it's better to prevent this in the future.[1] https://lore.kernel.org/linux-nfs/[email protected]/
[2] https://lore.kernel.org/linux-nfs/[email protected]/Signed-off-by Petr Vorel <[email protected]>---
NOTE: although Neil suggested to test on ext2 to make the problems more obvious (ext2 has low-resolution time stamps) and to use sleep, withnfs_lib.shLTP code it works without sleep and on all filesystems.It'd require more changes in
nfs_lib.shto force ext2 only fornfs08.sh(other tests are using the library). Not only it's needed, but I also plan to switchnfs_lib.shto use all available filesystems via TST_ALL_FILESYSTEMS=1, therefore ext2 will be among tested filesystems anyway.Test fails also on all available NFS versions, thus using the same approach as the other tests - test all versions, although not sure if it's really needed. But test runs very quickly (unlike other nfs tests it's not a stress test), thus I'd keep it.
NOTE: anybody trying to test this patch with TMPDIR (to test different filesystems) test with this fix [1].
Kind regards,
Petr[1] https://lore.kernel.org/ltp/[email protected]/
runtest/net.nfs | 11 +++++++++++ testcases/network/nfs/nfs_stress/Makefile | 9 +-------- testcases/network/nfs/nfs_stress/nfs08.sh | 20 ++++++++++++++++++++ 3 files changed, 32 insertions(+), 8 deletions(-) create mode 100755 testcases/network/nfs/nfs_stress/nfs08.shruntest/net.nfs +11
-0@@ -72,6 +72,17 @@ nfs4_ipv6_07 nfs07.sh -6 -v 4 -t tcp nfs41_ipv6_07 nfs07.sh -6 -v 4.1 -t tcp nfs42_ipv6_07 nfs07.sh -6 -v 4.2 -t tcp +nfs3_08 nfs08.sh -v 3 -t udp +nfs3t_08 nfs08.sh -v 3 -t tcp +nfs4_08 nfs08.sh -v 4 -t tcp +nfs41_08 nfs08.sh -v 4.1 -t tcp +nfs42_08 nfs08.sh -v 4.2 -t tcp +nfs3_ipv6_08 nfs08.sh -6 -v 3 -t udp +nfs3t_ipv6_08 nfs08.sh -6 -v 3 -t tcp +nfs4_ipv6_08 nfs08.sh -6 -v 4 -t tcp +nfs41_ipv6_08 nfs08.sh -6 -v 4.1 -t tcp +nfs42_ipv6_08 nfs08.sh -6 -v 4.2 -t tcp + nfslock3_01 nfslock01.sh -v 3 -t udp nfslock3t_01 nfslock01.sh -v 3 -t tcp nfslock4_01 nfslock01.sh -v 4 -t tcptestcases/network/nfs/nfs_stress/Makefile +1
-8@@ -9,13 +9,6 @@ include $(top_srcdir)/include/mk/testcases.mk nfs04_create_file: CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE nfs05_make_tree: LDLIBS += -lpthread -INSTALL_TARGETS := nfs_lib.sh \ - nfs01.sh \ - nfs02.sh \ - nfs03.sh \ - nfs04.sh \ - nfs05.sh \ - nfs06.sh \ - nfs07.sh +INSTALL_TARGETS := *.sh include $(top_srcdir)/include/mk/generic_leaf_target.mktestcases/network/nfs/nfs_stress/nfs08.sh new file +8
-0@@ -0,0 +1,20 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2023 Petr Vorel <[email protected]> +# Test reproducer for broken NFS cache invalidation for directories. +# Based on reproducer from Neil Brown <[email protected]> + +TST_TESTFUNC="do_test" +
testcases/network/nfs/nfs_stress/nfs08.sh line 18
Quoted 10 lines
testcases/network/nfs/nfs_stress/nfs08.sh new file +10
-0+do_test() +{ + tst_res TINFO "testing NFS cache invalidation for directories" + + touch 1 + EXPECT_PASS 'ls | grep 1' + + touch 2 + EXPECT_PASS 'ls | grep 2' +}
I do not get how this actually detects case invalidation, it probably does, but slightly better description how this actually excercises the case would help.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 8 lines
Hi!
Quoted 7 lines
v4 [1] of not yet upstreamed patch accidentally broke cache invalidation for directories by clearing
NFS_INO_INVALID_DATAinappropriately. Although it was fixed in v5 [2] thus kernel was not actually broken, it's better to prevent this in the future.[1] https://lore.kernel.org/linux-nfs/[email protected]/
[2] https://lore.kernel.org/linux-nfs/[email protected]/
...
Quoted 17 lines
Quoted 17 lines
testcases/network/nfs/nfs_stress/nfs08.sh new file +14
-0@@ -0,0 +1,20 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2023 Petr Vorel <[email protected]> +# Test reproducer for broken NFS cache invalidation for directories. +# Based on reproducer from Neil Brown <[email protected]> + +TST_TESTFUNC="do_test" + +do_test() +{ + tst_res TINFO "testing NFS cache invalidation for directories" + + touch 1 + EXPECT_PASS 'ls | grep 1'
Quoted 8 lines
testcases/network/nfs/nfs_stress/nfs08.sh line 18
Quoted 4 lines
testcases/network/nfs/nfs_stress/nfs08.sh new file +4
-0+ + touch 2 + EXPECT_PASS 'ls | grep 2' +}I do not get how this actually detects case invalidation, it probably does, but slightly better description how this actually excercises the case would help.
The behavior is:
"touch 1" asks for data invalidation (new file created), therefore following ls (EXPECT_PASS 'ls | grep 1') fills the cache. "touch 2" should again ask for data invalidation, but it the unfixed v4 version of the patch it did not resulted to cache invalidation. Therefore second ls (EXPECT_PASS 'ls | grep 2') shows just 1, but not 2. i.e. in the affected kernel only second ls failed, but obviously both should be checked (nobody knows how another bug on cache invalidation will behave).
I can add the description above to the commit message and adjust the comment in the file.
Kind regards,
Petr
network/nfs/nfs_stress/nfs08.sh +2 -0
@@ -2,6 +2,8 @@ # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (c) 2023 Petr Vorel <[email protected]> # Test reproducer for broken NFS cache invalidation for directories. +# Kernel patch caused broken cache invalidation, which caused the second 'ls' +# did not show '2'. # Based on reproducer from Neil Brown <[email protected]> TST_TESTFUNC="do_test"
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Hi all,
Quoted 46 lines
Quoted 8 lines
Hi!
Quoted 7 lines
v4 [1] of not yet upstreamed patch accidentally broke cache invalidation for directories by clearing
NFS_INO_INVALID_DATAinappropriately. Although it was fixed in v5 [2] thus kernel was not actually broken, it's better to prevent this in the future.[1] https://lore.kernel.org/linux-nfs/[email protected]/
[2] https://lore.kernel.org/linux-nfs/[email protected]/...
Quoted 17 lines
Quoted 17 lines
testcases/network/nfs/nfs_stress/nfs08.sh new file +14
-0@@ -0,0 +1,20 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2023 Petr Vorel <[email protected]> +# Test reproducer for broken NFS cache invalidation for directories. +# Based on reproducer from Neil Brown <[email protected]> + +TST_TESTFUNC="do_test" + +do_test() +{ + tst_res TINFO "testing NFS cache invalidation for directories" + + touch 1 + EXPECT_PASS 'ls | grep 1'Quoted 8 lines
testcases/network/nfs/nfs_stress/nfs08.sh line 18
Quoted 4 lines
testcases/network/nfs/nfs_stress/nfs08.sh new file +4
-0+ + touch 2 + EXPECT_PASS 'ls | grep 2' +}I do not get how this actually detects case invalidation, it probably does, but slightly better description how this actually excercises the case would help.
The behavior is:
"touch 1" asks for data invalidation (new file created), therefore following ls (
EXPECT_PASS'ls | grep 1') fills the cache. "touch 2" should again ask for data invalidation, but it the unfixed v4 version of the patch it did not resulted to cache invalidation. Therefore second ls (EXPECT_PASS'ls | grep 2') shows just 1, but not 2. i.e. in the affected kernel only second ls failed, but obviously both should be checked (nobody knows how another bug on cache invalidation will behave).
Quoted 2 lines
I can add the description above to the commit message and adjust the comment in the file.
Merged with the updated description.
Kind regards,
Petr