Skip to contentSkip to conversation

generic/{349,350,351}: fix scsi_debug parameter quoting issues

PATCH In review Darrick J. Wong 4 participants 4 messages Sep 24 – Sep 28

lore
Share & tools
lore
#0 lore raw

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.

Cc <[email protected]> # v2026.09.22
Fixes a90ba59dca447d ("common/scsi_debug: don't slow down I/O")
---
 tests/generic/349 |    2 +-
 tests/generic/350 |    2 +-
 tests/generic/351 |    4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
tests/generic/349 +1 -1
index 72fbda412ea41c..0d019d4ab46170 100755
@@ -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
index 6079a8d5032303..7dcdda03a613ff 100755
@@ -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
index e73b70e4d7957e..374ea1afe46d76 100755
@@ -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
 
Reviewed-by on v1 1/1
#1 lore raw
Quoted 23 lines · Darrick J. Wong

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:

Quoted 8 lines

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.

Cc <[email protected]> # v2026.09.22
Fixes a90ba59dca447d ("common/scsi_debug: don't slow down I/O")

Looks good to me

Signature · 1 line
- Andrey
Reviewed-by on v1 1/1
#2 lore raw
In reply to Darrick J. Wong
Quoted 10 lines · Darrick J. Wong

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):

Arrg, that's what I get from following good suggestions on shell style..

The fix looks good:

Reviewed-by on v1 1/1
#3 lore raw
In reply to Darrick J. Wong
Quoted 25 lines · Darrick J. Wong

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'

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.22
Fixes a90ba59dca447d ("common/scsi_debug: don't slow down I/O")

---

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
index 72fbda412ea41c..0d019d4ab46170 100755
@@ -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
index 6079a8d5032303..7dcdda03a613ff 100755
@@ -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
index e73b70e4d7957e..374ea1afe46d76 100755
@@ -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