generic/{349,350,351}: fix scsi_debug parameter quoting issues
PATCH 1/1 generic/{349,350,351}: fix scsi_debug parameter quoting issues
From: Darrick J. Wong <[email protected]>
Commit a90ba59dca447d reworked the argument handling code inside _get_scsi_debug_dev to put all the remaining arguments (after we extract the first four arguments) inside an array that gets passed to modprobe:
opts+=("$@")This code takes every command line argument and copies them into the array verbatim. Contrast this to what it did before (excerpted):
opts="...dev_size_mb=$size $@"
echo "scsi_debug options $opts" >> $seqres.full modprobe scsi_debug $opts
The old code put all the arguments into a string, then passed the string unquoted to modprobe, which means that any spaces in the parameters given to _get_scsi_debug_dev become argument separators in the modprobe call. Put more simply, passing "foo=1 bar=1" to _get_scsi_debug_dev results in "foo=1" "bar=1" being passed to modprobe.
Now we no longer do that, which causes these three tests to fail with:
scsi_debug: 1 lbpws10=1' invalid for parameter lbpws'
because we're effectively passing lbpws="1 lbpws10=1" to scsi_debug. Fix this by removing the quoting from the three tests.
--- tests/generic/349 | 2 +- tests/generic/350 | 2 +- tests/generic/351 | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
tests/generic/349 +1 -1
@@ -20,7 +20,7 @@ _require_scsi_debug _require_xfs_io_command "fzero" echo "Create and format" -dev=$(_get_scsi_debug_dev 512 512 0 4 "lbpws=1 lbpws10=1") +dev=$(_get_scsi_debug_dev 512 512 0 4 lbpws=1 lbpws10=1) _pwrite_byte 0x62 0 4m $dev >> $seqres.full echo "Zero range"
tests/generic/350 +1 -1
@@ -20,7 +20,7 @@ _require_scsi_debug _require_xfs_io_command "fpunch" echo "Create and format" -dev=$(_get_scsi_debug_dev 512 512 0 4 "lbpws=1 lbpws10=1") +dev=$(_get_scsi_debug_dev 512 512 0 4 lbpws=1 lbpws10=1) _pwrite_byte 0x62 0 4m $dev >> $seqres.full echo "Zero punch"
tests/generic/351 +2 -2
@@ -27,7 +27,7 @@ _require_xfs_io_command "fzero" _require_xfs_io_command "fpunch" echo "Create and format" -dev=$(_get_scsi_debug_dev 4096 4096 0 4 "lbpws=1 lbpws10=1") +dev=$(_get_scsi_debug_dev 4096 4096 0 4 lbpws=1 lbpws10=1) _pwrite_byte 0x62 0 4m $dev >> $seqres.full $XFS_IO_PROG -c "fsync" $dev
@@ -70,7 +70,7 @@ echo "Destroy device" _put_scsi_debug_dev echo "Create w/o unmap or writesame and format" -dev=$(_get_scsi_debug_dev 512 512 0 4 "lbpws=0 lbpws10=0 lbpu=0 write_same_length=0 unmap_max_blocks=0") +dev=$(_get_scsi_debug_dev 512 512 0 4 lbpws=0 lbpws10=0 lbpu=0 write_same_length=0 unmap_max_blocks=0) _pwrite_byte 0x62 0 4m $dev >> $seqres.full $XFS_IO_PROG -c "fsync" $dev
Quoted 23 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Commit
a90ba59dca447dreworked the argument handling code inside_get_scsi_debug_devto put all the remaining arguments (after we extract the first four arguments) inside an array that gets passed to modprobe:opts+=("$@")This code takes every command line argument and copies them into the array verbatim. Contrast this to what it did before (excerpted):
opts="...dev_size_mb=$size $@"
echo "scsi_debugoptions $opts" >> $seqres.full modprobescsi_debug$optsThe old code put all the arguments into a string, then passed the string unquoted to modprobe, which means that any spaces in the parameters given to
_get_scsi_debug_devbecome argument separators in the modprobe call. Put more simply, passing "foo=1 bar=1" to_get_scsi_debug_devresults in "foo=1" "bar=1" being passed to modprobe.Now we no longer do that, which causes these three tests to fail with:
Quoted 8 lines
scsi_debug:1 lbpws10=1' invalid for parameterlbpws'because we're effectively passing lbpws="1 lbpws10=1" to
scsi_debug. Fix this by removing the quoting from the three tests.Cc <[email protected]> # v2026.09.22Fixes a90ba59dca447d ("common/scsi_debug: don't slow down I/O")Signed-off-by "Darrick J. Wong" <[email protected]>
Looks good to me
Signature · 1 line
- Andrey
Quoted 10 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Commit
a90ba59dca447dreworked the argument handling code inside_get_scsi_debug_devto put all the remaining arguments (after we extract the first four arguments) inside an array that gets passed to modprobe:opts+=("$@")This code takes every command line argument and copies them into the array verbatim. Contrast this to what it did before (excerpted):
Arrg, that's what I get from following good suggestions on shell style..
The fix looks good:
Quoted 25 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Commit
a90ba59dca447dreworked the argument handling code inside_get_scsi_debug_devto put all the remaining arguments (after we extract the first four arguments) inside an array that gets passed to modprobe:opts+=("$@")This code takes every command line argument and copies them into the array verbatim. Contrast this to what it did before (excerpted):
opts="...dev_size_mb=$size $@"
echo "scsi_debugoptions $opts" >> $seqres.full modprobescsi_debug$optsThe old code put all the arguments into a string, then passed the string unquoted to modprobe, which means that any spaces in the parameters given to
_get_scsi_debug_devbecome argument separators in the modprobe call. Put more simply, passing "foo=1 bar=1" to_get_scsi_debug_devresults in "foo=1" "bar=1" being passed to modprobe.Now we no longer do that, which causes these three tests to fail with:
scsi_debug:1 lbpws10=1' invalid for parameterlbpws'
Quoted 7 lines
because we're effectively passing lbpws="1 lbpws10=1" to
scsi_debug. Fix this by removing the quoting from the three tests.Cc <[email protected]> # v2026.09.22Fixes a90ba59dca447d ("common/scsi_debug: don't slow down I/O")Signed-off-by "Darrick J. Wong" <[email protected]>---
Thanks for finding and fixing it.
Quoted 53 lines
tests/generic/349 | 2 +- tests/generic/350 | 2 +- tests/generic/351 | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)tests/generic/349 +1
-1@@ -20,7 +20,7 @@ _require_scsi_debug _require_xfs_io_command "fzero" echo "Create and format" -dev=$(_get_scsi_debug_dev 512 512 0 4 "lbpws=1 lbpws10=1") +dev=$(_get_scsi_debug_dev 512 512 0 4 lbpws=1 lbpws10=1) _pwrite_byte 0x62 0 4m $dev >> $seqres.full echo "Zero range"tests/generic/350 +1
-1@@ -20,7 +20,7 @@ _require_scsi_debug _require_xfs_io_command "fpunch" echo "Create and format" -dev=$(_get_scsi_debug_dev 512 512 0 4 "lbpws=1 lbpws10=1") +dev=$(_get_scsi_debug_dev 512 512 0 4 lbpws=1 lbpws10=1) _pwrite_byte 0x62 0 4m $dev >> $seqres.full echo "Zero punch"tests/generic/351 +2
-2@@ -27,7 +27,7 @@ _require_xfs_io_command "fzero" _require_xfs_io_command "fpunch" echo "Create and format" -dev=$(_get_scsi_debug_dev 4096 4096 0 4 "lbpws=1 lbpws10=1") +dev=$(_get_scsi_debug_dev 4096 4096 0 4 lbpws=1 lbpws10=1) _pwrite_byte 0x62 0 4m $dev >> $seqres.full $XFS_IO_PROG -c "fsync" $dev@@ -70,7 +70,7 @@ echo "Destroy device" _put_scsi_debug_dev echo "Create w/o unmap or writesame and format" -dev=$(_get_scsi_debug_dev 512 512 0 4 "lbpws=0 lbpws10=0 lbpu=0 write_same_length=0 unmap_max_blocks=0") +dev=$(_get_scsi_debug_dev 512 512 0 4 lbpws=0 lbpws10=0 lbpu=0 write_same_length=0 unmap_max_blocks=0) _pwrite_byte 0x62 0 4m $dev >> $seqres.full $XFS_IO_PROG -c "fsync" $dev