diff mbox series

[blktests] nbd/004: drop the check for "couldn't allocate config" message

Message ID 20240607052826.249014-1-shinichiro.kawasaki@wdc.com (mailing list archive)
State New, archived
Headers show
Series [blktests] nbd/004: drop the check for "couldn't allocate config" message | expand

Commit Message

Shinichiro Kawasaki June 7, 2024, 5:28 a.m. UTC
The test case nbd/004 was created to confirm the fix by the kernel
commit 06c4da89c24e ("nbd: call genl_unregister_family() first in
nbd_cleanup()"). Originally, the test case was created to check that the
kernel commit avoided a BUG. But the BUG was not recreated on my system
even without the kernel commit, so I was not able to confirm that the
test case was working as expected. On the other hand, I found that the
kernel commit avoided the two other kernel messages "couldn't allocate
config" and "cannot create duplicate filename" on my test system. Then I
suggested adding the checks for those messages to the test case, and the
checks were added [1].

However, it turned out that the kernel commit did not totally avoid the
message "couldn't allocate config". The test case still makes the kernel
report the message with a low ratio. The failure is recreated when the
test case is repeated around 30 times. The CKI project reported that
nbd/004 fails due to the message [2].

When the failure happens, try_module_get() fails in nbd_genl_context():

nbd_genl_connect()
 nbd_alloc_and_init_config()
  try_module_get()            ... fails

This try_module_get() call checks that the module is not unloaded during
the connect operation. The test case does "module load/unload
concurrently with connect/disconnect" then the try_module_get() failure
is expected. It means the failure is false-positive.

Drop the wrong check for "couldn't allocate config" message. Still keep
the check for "cannot create duplicate filename".

[1] https://lore.kernel.org/linux-block/20220707124945.c2rd677hjwkd7mim@shindev/
[2] https://github.com/osandov/blktests/issues/140

Fixes: 349eb683fd06 ("nbd: add a module load and device connect test")
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 tests/nbd/004 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Shinichiro Kawasaki June 18, 2024, 5:33 a.m. UTC | #1
On Jun 07, 2024 / 14:28, Shin'ichiro Kawasaki wrote:
> The test case nbd/004 was created to confirm the fix by the kernel
> commit 06c4da89c24e ("nbd: call genl_unregister_family() first in
> nbd_cleanup()"). Originally, the test case was created to check that the
> kernel commit avoided a BUG. But the BUG was not recreated on my system
> even without the kernel commit, so I was not able to confirm that the
> test case was working as expected. On the other hand, I found that the
> kernel commit avoided the two other kernel messages "couldn't allocate
> config" and "cannot create duplicate filename" on my test system. Then I
> suggested adding the checks for those messages to the test case, and the
> checks were added [1].
> 
> However, it turned out that the kernel commit did not totally avoid the
> message "couldn't allocate config". The test case still makes the kernel
> report the message with a low ratio. The failure is recreated when the
> test case is repeated around 30 times. The CKI project reported that
> nbd/004 fails due to the message [2].
> 
> When the failure happens, try_module_get() fails in nbd_genl_context():
> 
> nbd_genl_connect()
>  nbd_alloc_and_init_config()
>   try_module_get()            ... fails
> 
> This try_module_get() call checks that the module is not unloaded during
> the connect operation. The test case does "module load/unload
> concurrently with connect/disconnect" then the try_module_get() failure
> is expected. It means the failure is false-positive.
> 
> Drop the wrong check for "couldn't allocate config" message. Still keep
> the check for "cannot create duplicate filename".
> 
> [1] https://lore.kernel.org/linux-block/20220707124945.c2rd677hjwkd7mim@shindev/
> [2] https://github.com/osandov/blktests/issues/140
> 
> Fixes: 349eb683fd06 ("nbd: add a module load and device connect test")
> Reported-by: Yi Zhang <yi.zhang@redhat.com>
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

FYI, this patch has got applied.
diff mbox series

Patch

diff --git a/tests/nbd/004 b/tests/nbd/004
index 1758859..a866ea5 100755
--- a/tests/nbd/004
+++ b/tests/nbd/004
@@ -50,8 +50,8 @@  test() {
 
 	_stop_nbd_server_netlink
 
-	if _dmesg_since_test_start | grep -q -e "couldn't allocate config" \
-		-e "cannot create duplicate filename"; then
+	if _dmesg_since_test_start | \
+			grep --quiet "cannot create duplicate filename"; then
 			echo "Fail"
 	fi