Re: [PATCH blktests 9/9] common: do not require scsi_debug support to be modular

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On May 31, 2022 / 12:21, Shinichiro Kawasaki wrote:
> On May 30, 2022 / 15:08, Christoph Hellwig wrote:
> > Use _have_driver instead of _have_modules in _have_scsi_debug for the
> > basic scsi_debug check, and instead only require an actual module in
> > _init_null_blk when specific module parameters are passed.
> > 
> > Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> > ---
> >  common/scsi_debug | 14 ++++++++++----
> >  tests/block/001   |  4 +++-
> >  2 files changed, 13 insertions(+), 5 deletions(-)
> > 
> > diff --git a/common/scsi_debug b/common/scsi_debug
> > index 95da14e..e9161d3 100644
> > --- a/common/scsi_debug
> > +++ b/common/scsi_debug
> > @@ -5,7 +5,7 @@
> >  # scsi_debug helper functions.
> >  
> >  _have_scsi_debug() {
> > -	_have_modules scsi_debug
> > +	_have_driver scsi_debug
> >  }
> >  
> >  _init_scsi_debug() {
> > @@ -18,8 +18,14 @@ _init_scsi_debug() {
> >  		args+=(zbc=host-managed zone_nr_conv=0)
> >  	fi
> >  
> > -	if ! modprobe -r scsi_debug || ! modprobe scsi_debug "${args[@]}"; then
> > -		return 1
> > +	if ((${#args[@]})); then
> > +		if ! modprobe -qr scsi_debug; then
> > +			exit 1
> > +		fi
> > +		if ! modprobe scsi_debug "${args[@]}"; then
> > +			SKIP_REASON="scsi_debug not modular"
> 
> I tried scsi_debug built-in kernel and observed that 'modprobe -qr scsi_debug'
> command fails, and the script exits at the line of "exit 1". The SKIP_REASON
> comment above will not be printed. I think we need to check the scsi_debug is
> not built-in. As I commented for _init_null_blk, _have_modules needs
> modification to check if the module is not built-in. I guess it can be used for
> scsi_debug also.

Another nit: the SKIP_REASON value update will make shellcheck complain:

common/scsi_debug:26:4: warning: SKIP_REASON appears unused. Verify use (or export if used externally). [SC2034]

As some of other common/* does, sourcing common/shellcheck at beginning of
common/scsi_debug will avoid it.

-- 
Shin'ichiro Kawasaki



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux