linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH blktests] common/null_blk: check FULL file availability before write
@ 2025-07-04 10:54 Shin'ichiro Kawasaki
  2025-07-07 15:19 ` Yi Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Shin'ichiro Kawasaki @ 2025-07-04 10:54 UTC (permalink / raw)
  To: linux-block; +Cc: Yi Zhang, Bart Van Assche, Shin'ichiro Kawasaki

Commit e2805c7911a4 ("common/null_blk: Log null_blk configuration
parameters") introduced the write to the $FULL file in
_configure_null_blk(). However, the $FULL file is not available when
_configure_null_blk() is called in the fallback_device() context. In
this case, the write fails with the error "No such file or directory".
To avoid the error, confirm that $FULL is available before write to it.

Fixes: e2805c7911a4 ("common/null_blk: Log null_blk configuration parameters")
Link: https://github.com/linux-blktests/blktests/issues/187
Reported-by: Yi Zhang <yi.zhang@redhat.com>
Suggested-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 common/null_blk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/null_blk b/common/null_blk
index 83f508f..7395754 100644
--- a/common/null_blk
+++ b/common/null_blk
@@ -64,7 +64,7 @@ _configure_null_blk() {
 	fi
 	params+=("$@")
 
-	echo "$nullb_path ${params[*]}" >>"${FULL}"
+	[[ -n "${FULL}" ]] && echo "$nullb_path ${params[*]}" >>"${FULL}"
 
 	for param in "${params[@]}"; do
 		local key="${param%%=*}" val="${param#*=}"
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH blktests] common/null_blk: check FULL file availability before write
  2025-07-04 10:54 [PATCH blktests] common/null_blk: check FULL file availability before write Shin'ichiro Kawasaki
@ 2025-07-07 15:19 ` Yi Zhang
  2025-07-07 17:26 ` Bart Van Assche
  2025-07-09  6:59 ` Shinichiro Kawasaki
  2 siblings, 0 replies; 4+ messages in thread
From: Yi Zhang @ 2025-07-07 15:19 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki; +Cc: linux-block, Bart Van Assche

Tested-by: Yi Zhang <yi.zhang@redhat.com>

# ./check zbd/001
common/null_blk: line 67: : No such file or directory
zbd/001 => nullb1 (sysfs and ioctl)                          [passed]
    runtime    ...  0.167s
With the patch
# ./check zbd/001
zbd/001 => nullb1 (sysfs and ioctl)                          [passed]
    runtime  0.167s  ...  0.174s

On Fri, Jul 4, 2025 at 6:54 PM Shin'ichiro Kawasaki
<shinichiro.kawasaki@wdc.com> wrote:
>
> Commit e2805c7911a4 ("common/null_blk: Log null_blk configuration
> parameters") introduced the write to the $FULL file in
> _configure_null_blk(). However, the $FULL file is not available when
> _configure_null_blk() is called in the fallback_device() context. In
> this case, the write fails with the error "No such file or directory".
> To avoid the error, confirm that $FULL is available before write to it.
>
> Fixes: e2805c7911a4 ("common/null_blk: Log null_blk configuration parameters")
> Link: https://github.com/linux-blktests/blktests/issues/187
> Reported-by: Yi Zhang <yi.zhang@redhat.com>
> Suggested-by: Bart Van Assche <bvanassche@acm.org>
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
>  common/null_blk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/null_blk b/common/null_blk
> index 83f508f..7395754 100644
> --- a/common/null_blk
> +++ b/common/null_blk
> @@ -64,7 +64,7 @@ _configure_null_blk() {
>         fi
>         params+=("$@")
>
> -       echo "$nullb_path ${params[*]}" >>"${FULL}"
> +       [[ -n "${FULL}" ]] && echo "$nullb_path ${params[*]}" >>"${FULL}"
>
>         for param in "${params[@]}"; do
>                 local key="${param%%=*}" val="${param#*=}"
> --
> 2.50.0
>
>


-- 
Best Regards,
  Yi Zhang


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH blktests] common/null_blk: check FULL file availability before write
  2025-07-04 10:54 [PATCH blktests] common/null_blk: check FULL file availability before write Shin'ichiro Kawasaki
  2025-07-07 15:19 ` Yi Zhang
@ 2025-07-07 17:26 ` Bart Van Assche
  2025-07-09  6:59 ` Shinichiro Kawasaki
  2 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2025-07-07 17:26 UTC (permalink / raw)
  To: Shin'ichiro Kawasaki, linux-block; +Cc: Yi Zhang

On 7/4/25 3:54 AM, Shin'ichiro Kawasaki wrote:
> Commit e2805c7911a4 ("common/null_blk: Log null_blk configuration
> parameters") introduced the write to the $FULL file in
> _configure_null_blk(). However, the $FULL file is not available when
> _configure_null_blk() is called in the fallback_device() context. In
> this case, the write fails with the error "No such file or directory".
> To avoid the error, confirm that $FULL is available before write to it.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH blktests] common/null_blk: check FULL file availability before write
  2025-07-04 10:54 [PATCH blktests] common/null_blk: check FULL file availability before write Shin'ichiro Kawasaki
  2025-07-07 15:19 ` Yi Zhang
  2025-07-07 17:26 ` Bart Van Assche
@ 2025-07-09  6:59 ` Shinichiro Kawasaki
  2 siblings, 0 replies; 4+ messages in thread
From: Shinichiro Kawasaki @ 2025-07-09  6:59 UTC (permalink / raw)
  To: linux-block@vger.kernel.org; +Cc: Yi Zhang, Bart Van Assche

On Jul 04, 2025 / 19:54, Shin'ichiro Kawasaki wrote:
> Commit e2805c7911a4 ("common/null_blk: Log null_blk configuration
> parameters") introduced the write to the $FULL file in
> _configure_null_blk(). However, the $FULL file is not available when
> _configure_null_blk() is called in the fallback_device() context. In
> this case, the write fails with the error "No such file or directory".
> To avoid the error, confirm that $FULL is available before write to it.
> 
> Fixes: e2805c7911a4 ("common/null_blk: Log null_blk configuration parameters")
> Link: https://github.com/linux-blktests/blktests/issues/187
> Reported-by: Yi Zhang <yi.zhang@redhat.com>
> Suggested-by: Bart Van Assche <bvanassche@acm.org>
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

FYI, I have applied this patch.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-09  6:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-04 10:54 [PATCH blktests] common/null_blk: check FULL file availability before write Shin'ichiro Kawasaki
2025-07-07 15:19 ` Yi Zhang
2025-07-07 17:26 ` Bart Van Assche
2025-07-09  6:59 ` Shinichiro Kawasaki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).