public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	Christoph Hellwig <hch@lst.de>,
	Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
Subject: Re: [PATCH blktests v2 1/6] common/rc: avoid module load in _have_driver()
Date: Thu, 18 Aug 2022 18:03:24 -0700	[thread overview]
Message-ID: <d810fd8e-6c49-1ef4-e84a-ee12f209d91b@acm.org> (raw)
In-Reply-To: <20220819003451.jqkmwbzdyqhw2t47@shindev>

On 8/18/22 17:34, Shinichiro Kawasaki wrote:
> On Aug 18, 2022 / 13:02, Bart Van Assche wrote:
>> On 8/17/22 18:26, Shin'ichiro Kawasaki wrote:
>>> The helper function _have_driver() checks availability of the specified
>>> driver, or module, regardless whether it is loadable or not. When the
>>> driver is loadable, it loads the module for checking, but does not
>>> unload it. This makes following test cases fail.
>>>
>>> Such failure happens when nvmeof-mp test group is executed after nvme
>>> test group with tcp transport. _have_driver() for tcp transport loads
>>> nvmet and nvmet-tcp modules. nvmeof-mp test group tries to unload the
>>> nvmet module but it fails because of dependency to the nvmet-tcp module.
>>>
>>> To avoid the failure, do not load module in _have_driver() using -n
>>> dry run option of the modprobe command. While at it, fix a minor problem
>>> of modname '-' replacement. Currently, only the first '-' in modname is
>>> replaced with '_'. Replace all '-'s.
>>>
>>> Fixes: e9645877fbf0 ("common: add a helper if a driver is available")
>>> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
>>> Reviewed-by: Christoph Hellwig <hch@lst.de>
>>> ---
>>>    common/rc | 5 +++--
>>>    1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/common/rc b/common/rc
>>> index 01df6fa..8150fee 100644
>>> --- a/common/rc
>>> +++ b/common/rc
>>> @@ -30,9 +30,10 @@ _have_root() {
>>>    _have_driver()
>>>    {
>>> -	local modname="${1/-/_}"
>>> +	local modname="${1//-/_}"
>>> -	if [ ! -d "/sys/module/${modname}" ] && ! modprobe -q "${modname}"; then
>>> +	if [[ ! -d "/sys/module/${modname}" ]] &&
>>> +		   ! modprobe -qn "${modname}"; then
>>>    		SKIP_REASONS+=("driver ${modname} is not available")
>>>    		return 1
>>>    	fi
>>
>> There are two (unrelated?) changes in this patch but only one change has
>> been explained in the patch description :-(
> 
> Hi Bart, thanks for the review. Regarding the local modname="${1//-/_}" change,
> I explained it at the very end of the patch description with one sentence.
> However, I admit that it was unclear and confusing. Will separate it to another
> patch in v3.

Hi Shinichiro,

In my comment I was referring to the other change :-)

(changing [ ... ] into [[ ... ]]).

Best regards,

Bart.



  reply	other threads:[~2022-08-19  1:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-18  1:26 [PATCH blktests v2 0/6] fix module check issues Shin'ichiro Kawasaki
2022-08-18  1:26 ` [PATCH blktests v2 1/6] common/rc: avoid module load in _have_driver() Shin'ichiro Kawasaki
2022-08-18 20:02   ` Bart Van Assche
2022-08-19  0:34     ` Shinichiro Kawasaki
2022-08-19  1:03       ` Bart Van Assche [this message]
2022-08-19  1:33         ` Shinichiro Kawasaki
2022-08-18  1:26 ` [PATCH blktests v2 2/6] nbd/rc: load nbd module explicitly Shin'ichiro Kawasaki
2022-08-18  1:26 ` [PATCH blktests v2 3/6] common/rc: ensure modules are loadable in _have_modules() Shin'ichiro Kawasaki
2022-08-18 20:06   ` Bart Van Assche
2022-08-19  0:35     ` Shinichiro Kawasaki
2022-08-18  1:26 ` [PATCH blktests v2 4/6] common,tests: replace _have_driver() with _have_drivers() Shin'ichiro Kawasaki
2022-08-18  1:26 ` [PATCH blktests v2 5/6] block/001: use _have_drivers() in place of _have_modules() Shin'ichiro Kawasaki
2022-08-18  1:26 ` [PATCH blktests v2 6/6] srp/rc: allow test with built-in sd_mod and sg drivers Shin'ichiro Kawasaki
2022-08-18 20:07   ` Bart Van Assche
2022-08-19  0:36     ` Shinichiro Kawasaki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d810fd8e-6c49-1ef4-e84a-ee12f209d91b@acm.org \
    --to=bvanassche@acm.org \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox