Skip to contentSkip to conversation

zbd/013: Test stacked drivers and queue freezing

PATCH In review Bart Van Assche 2 participants 10 messages May 23, 2025 – May 30, 2025 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 zbd/013: Test stacked drivers and queue freezing

Since there is no test yet in the blktests repository for a device mapper driver stacked on top of a zoned block device, add such a test. This test triggers the following deadlock in kernel versions 6.10..6.14:

Call Trace:
 <TASK>
 __schedule+0x43f/0x12f0
 schedule+0x27/0xf0
 __bio_queue_enter+0x10e/0x230
 __submit_bio+0xf0/0x280
 submit_bio_noacct_nocheck+0x185/0x3d0
 blk_zone_wplug_bio_work+0x1ad/0x1f0
 process_one_work+0x17b/0x330
 worker_thread+0x2ce/0x3f0
 kthread+0xec/0x220
 ret_from_fork+0x31/0x50
 ret_from_fork_asm+0x1a/0x30
 </TASK>
Call Trace:
 <TASK>
 __schedule+0x43f/0x12f0
 schedule+0x27/0xf0
 blk_mq_freeze_queue_wait+0x6f/0xa0
 queue_attr_store+0x14f/0x1b0
 kernfs_fop_write_iter+0x13b/0x1f0
 vfs_write+0x253/0x420
 ksys_write+0x64/0xe0
 do_syscall_64+0x82/0x160
 entry_SYSCALL_64_after_hwframe+0x76/0x7e
 </TASK>
---
 tests/zbd/013     | 110 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/zbd/013.out |   2 +
 2 files changed, 112 insertions(+)
 create mode 100755 tests/zbd/013
 create mode 100644 tests/zbd/013.out
tests/zbd/013 new file +110 -0
new file mode 100755
index 000000000000..88aea23ee68a
@@ -0,0 +1,110 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2025 Google LLC
+
+. tests/zbd/rc
+. common/null_blk
+
+DESCRIPTION="test stacked drivers and queue freezing"
+QUICK=1
+
+requires() {
+	_have_driver dm-crypt
+	_have_fio
+	_have_module null_blk
+	_have_program cryptsetup
+}
+
+# Trigger blk_mq_freeze_queue() repeatedly because there is a bug in the
+# Linux kernel 6.10..6.14 zoned block device code that triggers a deadlock
+# between zoned writes and queue freezing.
+queue_freeze_loop() {
+	while true; do
+		echo 4 >"$1"
+		sleep .1
+		echo 8 >"$1"
+		sleep .1
+	done
+}
+
+test() {
+	set -e
+
+	echo "Running ${TEST_NAME}"
+
+	_init_null_blk nr_devices=0 queue_mode=2
+
+	# A small conventional block device for the LUKS header.
+	local null_blk_params=(
+		blocksize=4096
+		completion_nsec=0
+		memory_backed=1
+		size=4            # MiB
+		submit_queues=1
+		power=1
+	)
+	_configure_null_blk nullb0 "${null_blk_params[@]}"
+	local hdev=/dev/nullb0
+
+	# A larger zoned block device for the data.
+	local null_blk_params=(
+		blocksize=4096
+		completion_nsec=0
+		memory_backed=1
+		size=1024         # MiB
+		submit_queues=1
+		zoned=1
+		power=1
+	)
+	_configure_null_blk nullb1 "${null_blk_params[@]}"
+	local zdev=/dev/nullb1
+
+	local luks_passphrase=this-passphrase-is-not-secret
+	{ echo "${luks_passphrase}" |
+		  cryptsetup luksFormat --batch-mode ${zdev} \
+			     --header ${hdev}; }
+	local luks_vol_name=zbd-013
+	{ echo "${luks_passphrase}" |
+		  cryptsetup luksOpen \
+			     --batch-mode "${zdev}" "${luks_vol_name}" \
+			     --header ${hdev}; }
+	local luksdev="/dev/mapper/${luks_vol_name}"
+	local dmdev
+	dmdev="$(basename "$(readlink "${luksdev}")")"
+	ls -ld "${hdev}" "${zdev}" "${luksdev}" "/dev/${dmdev}" >>"${FULL}"
+	local zdev_basename
+	zdev_basename=$(basename "$zdev")
+	local max_sectors_zdev
+	max_sectors_zdev=/sys/block/"${zdev_basename}"/queue/max_sectors_kb
+	echo 4 > "${max_sectors_zdev}"
+	echo "${zdev_basename}: max_sectors_kb=$(<"${max_sectors_zdev}")" >>"${FULL}"
+	local max_sectors_dm
+	max_sectors_dm=/sys/block/"${dmdev}"/queue/max_sectors_kb
+	echo "${dmdev}: max_sectors_kb=$(<"${max_sectors_dm}")" >>"${FULL}"
+	queue_freeze_loop /sys/block/"$dmdev"/queue/read_ahead_kb &
+	local loop_pid=$!
+	local fio_args=(
+		--bs=64M
+		--direct=1
+		--filename="${luksdev}"
+		--runtime="$TIMEOUT"
+		--time_based
+		--zonemode=zbd
+	)
+	if ! _run_fio_verify_io "${fio_args[@]}" >>"${FULL}" 2>&1; then
+		fail=true
+	fi
+
+	set +e
+
+	kill "${loop_pid}"
+	cryptsetup luksClose "${luks_vol_name}"
+	_exit_null_blk
+
+	if [ -z "$fail" ]; then
+		echo "Test complete"
+	else
+		echo "Test failed"
+		return 1
+	fi
+}
tests/zbd/013.out new file +2 -0
new file mode 100644
index 000000000000..afc2364a9b73
@@ -0,0 +1,2 @@
+Running zbd/013
+Test complete
#1 lore raw
Quoted 22 lines · Bart Van Assche

Since there is no test yet in the blktests repository for a device mapper driver stacked on top of a zoned block device, add such a test. This test triggers the following deadlock in kernel versions 6.10..6.14:

Call Trace:
 <TASK>
 __schedule+0x43f/0x12f0
 schedule+0x27/0xf0
 __bio_queue_enter+0x10e/0x230
 __submit_bio+0xf0/0x280
 submit_bio_noacct_nocheck+0x185/0x3d0
 blk_zone_wplug_bio_work+0x1ad/0x1f0
 process_one_work+0x17b/0x330
 worker_thread+0x2ce/0x3f0
 kthread+0xec/0x220
 ret_from_fork+0x31/0x50
 ret_from_fork_asm+0x1a/0x30
 </TASK>
Call Trace:
 <TASK>
 __schedule+0x43f/0x12f0
 schedule+0x27/0xf0
Quoted 8 lines
 blk_mq_freeze_queue_wait+0x6f/0xa0
 queue_attr_store+0x14f/0x1b0
 kernfs_fop_write_iter+0x13b/0x1f0
 vfs_write+0x253/0x420
 ksys_write+0x64/0xe0
 do_syscall_64+0x82/0x160
 entry_SYSCALL_64_after_hwframe+0x76/0x7e
 </TASK>

Thanks for the patch. I ran this test case and observed the deadlock with the kernel v6.15-rc7 and linux-block/for-next tip (git hash efe615cd8823). I hope the kernel side fix gets available before applying this patch to the blktests master branch, because this new test case makes the blktests runs hang.

Please find my comments below.

Quoted 15 lines
---
 tests/zbd/013     | 110 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/zbd/013.out |   2 +
 2 files changed, 112 insertions(+)
 create mode 100755 tests/zbd/013
 create mode 100644 tests/zbd/013.out
tests/zbd/013 new file +0 -0
new file mode 100755
index 000000000000..88aea23ee68a

tests/zbd/013 line 4

Quoted 4 lines
tests/zbd/013 new file +4 -0
@@ -0,0 +1,110 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2025 Google LLC
+

Let's have some more description about the test here. How about the text like this?

# Test the race between writes on zoned dm-crypt device and queue freeze via the

# sysfs attribute "queue/read_ahead_kb", using zoned null_blk.

tests/zbd/013 line 6

Quoted 2 lines
tests/zbd/013 new file +2 -0
+. tests/zbd/rc
+. common/null_blk

Nit: this line can be removed since tests/zbd/rc sources common/null_blk.

tests/zbd/013 line 9

Quoted 3 lines
tests/zbd/013 new file +3 -0
+
+DESCRIPTION="test stacked drivers and queue freezing"
+QUICK=1

TIMED=1 should be here instead of QUICK=1 since this test case refers to $TIMEOUT.

tests/zbd/013 line 14

Quoted 5 lines
tests/zbd/013 new file +5 -0
+
+requires() {
+	_have_driver dm-crypt
+	_have_fio
+	_have_module null_blk

Nit: the line above can be removed since group_requires() zbd/rc checks it.

Quoted 7 lines
tests/zbd/013 new file +7 -0
+	_have_program cryptsetup
+}
+
+# Trigger blk_mq_freeze_queue() repeatedly because there is a bug in the
+# Linux kernel 6.10..6.14 zoned block device code that triggers a deadlock
+# between zoned writes and queue freezing.
+queue_freeze_loop() {

tests/zbd/013 line 31

Quoted 10 lines
tests/zbd/013 new file +10 -0
+	while true; do
+		echo 4 >"$1"
+		sleep .1
+		echo 8 >"$1"
+		sleep .1
+	done
+}
+
+test() {
+	set -e

Is this required? When I comment out this line and the "set +e" below, still I was able to recreate the deadlock.

tests/zbd/013 line 35

Quoted 4 lines
tests/zbd/013 new file +4 -0
+
+	echo "Running ${TEST_NAME}"
+
+	_init_null_blk nr_devices=0 queue_mode=2

This line can be removed by renameing the null_blk devices as follows:

nullb0 -> nullb1
nullb1 -> nullb2

nullb0 is not recommended since it can not be reconfigured when the null_blk driver is built-in.

tests/zbd/013 line 47

Quoted 12 lines
tests/zbd/013 new file +12 -0
+
+	# A small conventional block device for the LUKS header.
+	local null_blk_params=(
+		blocksize=4096
+		completion_nsec=0
+		memory_backed=1
+		size=4            # MiB
+		submit_queues=1
+		power=1
+	)
+	_configure_null_blk nullb0 "${null_blk_params[@]}"
+	local hdev=/dev/nullb0

As noted above, I suggest to rename from nullb0 to nullb1.

tests/zbd/013 line 60

Quoted 13 lines
tests/zbd/013 new file +13 -0
+
+	# A larger zoned block device for the data.
+	local null_blk_params=(
+		blocksize=4096
+		completion_nsec=0
+		memory_backed=1
+		size=1024         # MiB
+		submit_queues=1
+		zoned=1
+		power=1
+	)
+	_configure_null_blk nullb1 "${null_blk_params[@]}"
+	local zdev=/dev/nullb1

As noted above, I suggest to rename from nullb1 to nullb2.

Quoted 9 lines
tests/zbd/013 new file +9 -0
+
+	local luks_passphrase=this-passphrase-is-not-secret
+	{ echo "${luks_passphrase}" |
+		  cryptsetup luksFormat --batch-mode ${zdev} \
+			     --header ${hdev}; }
+	local luks_vol_name=zbd-013
+	{ echo "${luks_passphrase}" |
+		  cryptsetup luksOpen \
+			     --batch-mode "${zdev}" "${luks_vol_name}" \

tests/zbd/013 line 79

Quoted 10 lines
tests/zbd/013 new file +10 -0
+			     --header ${hdev}; }
+	local luksdev="/dev/mapper/${luks_vol_name}"
+	local dmdev
+	dmdev="$(basename "$(readlink "${luksdev}")")"
+	ls -ld "${hdev}" "${zdev}" "${luksdev}" "/dev/${dmdev}" >>"${FULL}"
+	local zdev_basename
+	zdev_basename=$(basename "$zdev")
+	local max_sectors_zdev
+	max_sectors_zdev=/sys/block/"${zdev_basename}"/queue/max_sectors_kb
+	echo 4 > "${max_sectors_zdev}"

Is this max_sectors_kb change a key condition to recreate the deadlock? I tried some runs with this change, and still able to recreate the hang on my test node.

Quoted 9 lines
tests/zbd/013 new file +9 -0
+	echo "${zdev_basename}: max_sectors_kb=$(<"${max_sectors_zdev}")" >>"${FULL}"
+	local max_sectors_dm
+	max_sectors_dm=/sys/block/"${dmdev}"/queue/max_sectors_kb
+	echo "${dmdev}: max_sectors_kb=$(<"${max_sectors_dm}")" >>"${FULL}"
+	queue_freeze_loop /sys/block/"$dmdev"/queue/read_ahead_kb &
+	local loop_pid=$!
+	local fio_args=(
+		--bs=64M
+		--direct=1

tests/zbd/013 line 98

Quoted 10 lines
tests/zbd/013 new file +10 -0
+		--filename="${luksdev}"
+		--runtime="$TIMEOUT"
+		--time_based
+		--zonemode=zbd
+	)
+	if ! _run_fio_verify_io "${fio_args[@]}" >>"${FULL}" 2>&1; then
+		fail=true
+	fi
+
+	set +e

As I noted above, I wonder if this line is required.

Thanks!

#2 lore raw
Quoted 4 lines · Shinichiro Kawasaki
Quoted 2 lines · Bart Van Assche

[ ... ]
+. common/null_blk

Quoted 8 lines

Nit: this line can be removed since tests/zbd/rc sources common/null_blk.

tests/zbd/013 line 14

Quoted 4 lines
tests/zbd/013 new file +4 -0
+requires() {
+	_have_driver dm-crypt
+	_have_fio
+	_have_module null_blk

Nit: the line above can be removed since group_requires() zbd/rc checks it.

I prefer to make such dependencies explicit. Relying on indirect dependencies is considered a bad practice in multiple coding style guides since it makes it almost impossible to remove dependencies from dependencies, e.g. removing "_have_module null_blk" from "zbd/rc".

Quoted 5 lines

tests/zbd/013 line 31

Quoted 2 lines
tests/zbd/013 new file +2 -0
+test() {
+	set -e

Is this required? When I comment out this line and the "set +e" below, still I was able to recreate the deadlock.

I want the entire test to fail if a single command fails. Debugging shell scripts is much harder if a script continues after having encountered an unexpected error.

I plan to address the other comments.

Thanks,

Bart.

#3 lore raw
Quoted 14 lines · Bart Van Assche
Quoted 4 lines · Shinichiro Kawasaki
Quoted 2 lines · Bart Van Assche

[ ... ]
+. common/null_blk

Quoted 8 lines

Nit: this line can be removed since tests/zbd/rc sources common/null_blk.

tests/zbd/013 line 14

Quoted 4 lines
tests/zbd/013 new file +4 -0
+requires() {
+	_have_driver dm-crypt
+	_have_fio
+	_have_module null_blk

Nit: the line above can be removed since group_requires() zbd/rc checks it.

Quoted 5 lines

I prefer to make such dependencies explicit. Relying on indirect dependencies is considered a bad practice in multiple coding style guides since it makes it almost impossible to remove dependencies from dependencies, e.g. removing "_have_module null_blk" from "zbd/rc".

I see, that makes sense.

Quoted 10 lines
Quoted 6 lines

tests/zbd/013 line 31

Quoted 3 lines
tests/zbd/013 new file +2 -0
+test() {
+	set -e

Is this required? When I comment out this line and the "set +e" below, still I was able to recreate the deadlock.

I want the entire test to fail if a single command fails. Debugging shell scripts is much harder if a script continues after having encountered an unexpected error.

I see your intent. However, "set -e" and "set +e" does not work in the test case. As the bash man page explains, even when commands fail, "set -e" does not work under some conditions. One of the conditions is "if the command's return value is being inverted with !". And the blktests "check" script calls this test() function in the context of "inverted with !". To make the "set -e" feature work, some changes are required in the "check" script to avoid the "!" statements.

You may remember, once Hannes had requested this "set -e" or "set -o errexit" enablement [1]. I had tried to support it and faced a couple of obstacles. Also, in LSF blktests session a few years ago, Omar noted that he did not enable "set -e" with intention at the beginning of blktests bring up. Then I stop the effort for it.

[1] https://github.com/linux-blktests/blktests/issues/89

Said that, "set -e" is a good practice in general. If it will help blktests contributors including you, I would like to revisit this topic.

When I had tried to support "set -e", I faced were two obstacles:

1) There are certain amount of places which trigger sudden exit under "set -e" condition. To fix this, dirty code changes are required, and this code change will need rather large amount of effort.

2) When a test case exits by "set -e", it may not clean up the test environment. This may leave unexpected test conditions and affect following test cases.

Now I can think of two solutions respectively.

1) Apply "set -e" practice only for the limited test cases. The new test case zbd/013 will be the first one. With this approach, we can keep exisiting scripts as they are, and don't need to spend time to modify them.

2) Use ERR trap to detect if each test case exited by "set -e". If so, force stop the "check" script run to avoid influence to following test cases.

Based on these approach, I will cook trial patches for the check script.

#4 lore raw
Quoted 8 lines · Shinichiro Kawasaki

Said that, "set -e" is a good practice in general. If it will help blktests contributors including you, I would like to revisit this topic.

When I had tried to support "set -e", I faced were two obstacles:

1) There are certain amount of places which trigger sudden exit under "set -e" condition. To fix this, dirty code changes are required, and this code change will need rather large amount of effort.

If we would have to make a choice between set -e and code readability and/or maintainability, I prefer the latter.

Quoted 8 lines

2) When a test case exits by "set -e", it may not clean up the test environment. This may leave unexpected test conditions and affect following test cases.

Now I can think of two solutions respectively.

1) Apply "set -e" practice only for the limited test cases. The new test case zbd/013 will be the first one. With this approach, we can keep exisiting scripts as they are, and don't need to spend time to modify them.

Does this mean no "set +e" statements anywhere and hence that statements that may fail should be surrounded with something that makes bash ignore their exit status, e.g. if ... then ... fi? In some of my own shell scripts I define the following function to make it easy to ignore the exit status of shell commands that may fail:

ignore_failure() {
    if "$@"; then :; fi
}
Quoted 2 lines

2) Use ERR trap to detect if each test case exited by "set -e". If so, force stop the "check" script run to avoid influence to following test cases.

As you probably know there should only be one trap ERR or trap EXIT statement. So that statement should probably occur in the ./check source instead of in each test script. To make that trap statement perform test specific cleanup it would have to call a cleanup function defined in the test/*/* source files.

Another solution is to concatenate all statements that shouldn't fail with "&&" but that doesn't make the test code look pretty.

Thanks,

Bart.

#5 lore raw
Quoted 4 lines · Bart Van Assche
Quoted 3 lines · Shinichiro Kawasaki

Said that, "set -e" is a good practice in general. If it will help blktests contributors including you, I would like to revisit this topic.

Quoted 8 lines
Quoted 5 lines

When I had tried to support "set -e", I faced were two obstacles:

1) There are certain amount of places which trigger sudden exit under "set -e" condition. To fix this, dirty code changes are required, and this code change will need rather large amount of effort.

If we would have to make a choice between set -e and code readability and/or maintainability, I prefer the latter.

I think that preference depends on each contributor. My conclusion _was_ "do not do 'set -e'" for whole blktests. What I suggest now is to decide the preference per test case.

Quoted 6 lines
Quoted 6 lines

2) When a test case exits by "set -e", it may not clean up the test environment. This may leave unexpected test conditions and affect following test cases.

Now I can think of two solutions respectively.

Quoted 7 lines
Quoted 3 lines

1) Apply "set -e" practice only for the limited test cases. The new test case zbd/013 will be the first one. With this approach, we can keep exisiting scripts as they are, and don't need to spend time to modify them.

Does this mean no "set +e" statements anywhere and hence that statements that may fail should be surrounded with something that makes bash ignore their exit status, e.g. if ... then ... fi?

What I'm thinking of is different. What's in my mind is below: (I have not yet implemented, so I'm not yet sure if it is really feasible, though)

- If a contributor thinks a new test case should be error free, declare it by adding the "ERREXIT=1" flag at the beginning of the test case.
- When "check" script finds the "ERREXIT=1" flag in a test case, it does "set -e" before calling test() or test_device() for the test case. After the call, do "set +e".

With this approach, the existing test cases are not affected. And we can do the "set -e" error check in the selected new test cases.

Will this approach fit your needs?

Quoted 7 lines

In some of my own shell
scripts I define the following function to make it easy to ignore the exit status of shell commands that may fail:

ignore_failure() {
    if "$@"; then :; fi
}

This could be a useful helper function to add, if we introduce the "set -e" support into blktests.

Quoted 9 lines
Quoted 3 lines

2) Use ERR trap to detect if each test case exited by "set -e". If so, force stop the "check" script run to avoid influence to following test cases.

As you probably know there should only be one trap ERR or trap EXIT statement. So that statement should probably occur in the ./check source instead of in each test script. To make that trap statement perform test specific cleanup it would have to call a cleanup function defined in the test/*/* source files.

I was not aware of that restriction. Thanks. I will do some prototype and see if the existing cleanup function handling can work together with the "set -e" exit check.

Quoted 3 lines

Another solution is to concatenate all statements that shouldn't fail with "&&" but that doesn't make the test code look pretty.

I don't think all contributors are okay with this approach.

#6 lore raw
Quoted 14 lines · Shinichiro Kawasaki
Quoted 3 lines · Bart Van Assche

Does this mean no "set +e" statements anywhere and hence that statements that may fail should be surrounded with something that makes bash ignore their exit status, e.g. if ... then ... fi?

What I'm thinking of is different. What's in my mind is below: (I have not yet implemented, so I'm not yet sure if it is really feasible, though)

- If a contributor thinks a new test case should be error free, declare it by adding the "ERREXIT=1" flag at the beginning of the test case.
- When "check" script finds the "ERREXIT=1" flag in a test case, it does "set -e" before calling test() or test_device() for the test case. After the call, do "set +e".

Quoted 4 lines

With this approach, the existing test cases are not affected. And we can do the "set -e" error check in the selected new test cases.

Will this approach fit your needs?

Although I'm not enthusiast about the introduction of yet another global variable, this would fit my needs.

Does this mean that it is hard to make set -e work in individual tests? _check() calls _run_group() in a subshell and _run_group() also calls _run_test() in a subshell so the exclamation mark in front of the subshell creation shouldn't cause set -e to be ignored, isn't it? The use of "time" in _call_test() doesn't affect set -e to be ignored either as far as I know.

Thanks,

Bart.

#7 lore raw
Quoted 15 lines · Bart Van Assche
Quoted 14 lines · Shinichiro Kawasaki
Quoted 3 lines · Bart Van Assche

Does this mean no "set +e" statements anywhere and hence that statements that may fail should be surrounded with something that makes bash ignore their exit status, e.g. if ... then ... fi?

What I'm thinking of is different. What's in my mind is below: (I have not yet implemented, so I'm not yet sure if it is really feasible, though)

- If a contributor thinks a new test case should be error free, declare it by adding the "ERREXIT=1" flag at the beginning of the test case.
- When "check" script finds the "ERREXIT=1" flag in a test case, it does "set -e" before calling test() or test_device() for the test case. After the call, do "set +e".

Quoted 7 lines
Quoted 4 lines

With this approach, the existing test cases are not affected. And we can do the "set -e" error check in the selected new test cases.

Will this approach fit your needs?

Although I'm not enthusiast about the introduction of yet another global variable, this would fit my needs.

I see. I thought that the new global variable is required to detect the exit due to "set -e". But I came up with an idea to not use the new variable. By grepping "set -e" in the test case script, the "check" script can know if the error exit may happen in the test case or not.

Quoted 7 lines

Does this mean that it is hard to make set -e work in individual tests? _check() calls _run_group() in a subshell and _run_group() also calls _run_test() in a subshell so the exclamation mark in front of the subshell creation shouldn't cause set -e to be ignored, isn't it? The use of "time" in _call_test() doesn't affect set -e to be ignored either as far as I know.

No. As far as I try on my systems, the restriction by "the exclamation mark in front of the subshell creation" propagates to subshells. A short script below shows that the "set -e" in func1() is not working.

#!/bin/bash
func1() {
set -e
ls /foo
echo this should not be printed
set +e
}

if ! ( func1 ); then

        echo ""

fi

With this trial, I noticed another important restriction that bash man page
notes: "part of the test following the if or elif reserved words". This also applies to the blktests test case execution context.

Anyway, these restrictions can be avoided with some tweaks. I have created trial implementation patches. Will send them out as RFC.

#8 lore raw
In reply to Shinichiro Kawasaki
Quoted 10 lines · Shinichiro Kawasaki

tests/zbd/013 line 35

Quoted 1 line · Bart Van Assche
tests/zbd/013 new file +1 -0
+	_init_null_blk nr_devices=0 queue_mode=2

This line can be removed by renameing the null_blk devices as follows:

   nullb0 -> nullb1
   nullb1 -> nullb2

nullb0 is not recommended since it can not be reconfigured when the null_blk driver is built-in.

Isn't _remove_null_blk_devices() supposed to remove nullb0 no matter whether null_blk is a kernel module or built-in to the kernel? And if the null_blk driver has been built as a kernel module, how is it supposed to be loaded without calling _init_null_blk()?

Thanks,

Bart.

#9 lore raw
Quoted 6 lines · Bart Van Assche
Quoted 5 lines · Shinichiro Kawasaki

tests/zbd/013 line 35

Quoted 1 line · Bart Van Assche
tests/zbd/013 new file +1 -0
+	_init_null_blk nr_devices=0 queue_mode=2

This line can be removed by renameing the null_blk devices as follows:

Quoted 7 lines
Quoted 5 lines
   nullb0 -> nullb1
   nullb1 -> nullb2

nullb0 is not recommended since it can not be reconfigured when the null_blk driver is built-in.

Isn't _remove_null_blk_devices() supposed to remove nullb0 no matter whether null_blk is a kernel module or built-in to the kernel?

No. When null_blk is built-in, it creates /dev/nullb0, but does not create the nullb0 directory under kernel config directory path.

Quoted 3 lines

And if
the null_blk driver has been built as a kernel module, how is it supposed to be loaded without calling _init_null_blk()?

_configure_null_blk() calls modprobe to load the null_blk module.