diff mbox series

[blktests] zbd/007: Add --force option to blkzone reset

Message ID 20200608024458.881519-1-shinichiro.kawasaki@wdc.com (mailing list archive)
State New, archived
Headers show
Series [blktests] zbd/007: Add --force option to blkzone reset | expand

Commit Message

Shinichiro Kawasaki June 8, 2020, 2:44 a.m. UTC
The test case zbd/007 utilizes blkzone command from util-linux project
to reset zones of test target devices. Recently, blkzone was modified to
report EBUSY error when it was called to change zone status of devices
used by the system. This avoids unintended zone status change by mistake
and good for most of use cases.

However this change triggered failure of the test case zbd/007 with the
EBUSY error. The test case executes blkzone to reset zones of block devices
which the system maps to container devices such as dm-linear.

To avoid this failure, modify zbd/007 to check if blkzone supports --force
option. And if it is supported, add it to blkzone command line. This option
was introduced to blkzone to allow zone status change of devices even when
the system use them.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 tests/zbd/007 | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Omar Sandoval June 15, 2020, 11:17 p.m. UTC | #1
On Mon, Jun 08, 2020 at 11:44:58AM +0900, Shin'ichiro Kawasaki wrote:
> The test case zbd/007 utilizes blkzone command from util-linux project
> to reset zones of test target devices. Recently, blkzone was modified to
> report EBUSY error when it was called to change zone status of devices
> used by the system. This avoids unintended zone status change by mistake
> and good for most of use cases.
> 
> However this change triggered failure of the test case zbd/007 with the
> EBUSY error. The test case executes blkzone to reset zones of block devices
> which the system maps to container devices such as dm-linear.
> 
> To avoid this failure, modify zbd/007 to check if blkzone supports --force
> option. And if it is supported, add it to blkzone command line. This option
> was introduced to blkzone to allow zone status change of devices even when
> the system use them.
> 
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
>  tests/zbd/007 | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

Thanks, applied.
diff mbox series

Patch

diff --git a/tests/zbd/007 b/tests/zbd/007
index 2376b3a..9d7ca67 100755
--- a/tests/zbd/007
+++ b/tests/zbd/007
@@ -68,7 +68,7 @@  test_device() {
 
 	# Reset and move write pointers of the container device
 	for ((i=0; i < ${#test_z[@]}; i++)); do
-		local -a arr
+		local -a arr opts
 
 		read -r -a arr < <(_get_dev_container_and_sector \
 					   "${test_z_start[i]}")
@@ -77,8 +77,11 @@  test_device() {
 
 		echo "${container_dev}" "${container_start}" >> "$FULL"
 
-		if ! blkzone reset -o "${container_start}" -c 1 \
-		     "${container_dev}"; then
+		opts=(-o "${container_start}" -c 1)
+		if blkzone -h | grep -q -e --force; then
+			opts+=(--force)
+		fi
+		if ! blkzone reset "${opts[@]}" "${container_dev}"; then
 			echo "Reset zone failed"
 			return 1
 		fi