All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Luis Chamberlain <mcgrof@kernel.org>
Cc: osandov@fb.com, linux-block@vger.kernel.org
Subject: Re: [PATCH v2] blktests: replace module removal with patient module removal
Date: Mon, 18 Apr 2022 09:39:06 -0700	[thread overview]
Message-ID: <1293a7e7-71d0-117e-1a4f-8ccfc609bc43@acm.org> (raw)
In-Reply-To: <Yl2KU6vLxawrIXi/@bombadil.infradead.org>

On 4/18/22 08:57, Luis Chamberlain wrote:
> On Fri, Apr 15, 2022 at 09:01:03PM -0700, Bart Van Assche wrote:
>> On 4/15/22 18:49, Luis Chamberlain wrote:
>>> -	modprobe -r nvme-"${nvme_trtype}" 2>/dev/null
>>> -	if [[ "${nvme_trtype}" != "loop" ]]; then
>>> -		modprobe -r nvmet-"${nvme_trtype}" 2>/dev/null
>>> -	fi
>>> -	modprobe -r nvmet 2>/dev/null
>>> +	if [[ "${nvme_trtype}" == "loop" ]]; then
>>> +		_patient_rmmod nvme_"${nvme_trtype}"
>>> +        else
>>> +                _patient_rmmod nvme-"${nvme_trtype}"
>>> +                _patient_rmmod nvmet-"${nvme_trtype}"
>>> +        fi
>>> +	_patient_rmmod nvmet 2>/dev/null
>>
>> The statement _patient_rmmod nvme-"${nvme_trtype}" occurs twice in the above
>> code. How about preserving the structure of the existing code such that that
>> statement only occurs once?
> 
> There is one call for nvme-"${nvme_trtype}", the other is for the
> underscore version, so there are no two calls.
> 
> Did I miss something?

It's only now that I see the underscore/hyphen difference in the if and else
branches. It is not clear to me why this behavior change has been introduced?
The following command produces no output on my test setup:

find /lib/modules -name 'nvme_*'

>>>    # Unload the SRP initiator driver.
>>>    stop_srp_ini() {
>>> -	local i
>>> -
>>>    	log_out
>>> -	for ((i=40;i>=0;i--)); do
>>> -		remove_mpath_devs || return $?
>>> -		unload_module ib_srp >/dev/null 2>&1 && break
>>> -		sleep 1
>>> -	done
>>> -	if [ -e /sys/module/ib_srp ]; then
>>> -		echo "Error: unloading kernel module ib_srp failed"
>>> -		return 1
>>> -	fi
>>> -	unload_module scsi_transport_srp || return $?
>>> +	remove_mpath_devs || return $?
>>> +	_patient_rmmod ib_srp || return 1
>>> +	_patient_rmmod scsi_transport_srp || return $?
>>>    }
>>
>> Removing the loop from around remove_mpath_devs is wrong. It is important
>> that that loop is preserved.
> 
> Why ? Can you test and verify?

If I remember correctly I put remove_mpath_devs call inside the loop because
multipathd keeps running while the loop is ongoing and hence can modify paths
while the loop is running.

Thanks,

Bart.

  reply	other threads:[~2022-04-18 16:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-16  1:49 [PATCH v2] blktests: replace module removal with patient module removal Luis Chamberlain
2022-04-16  4:01 ` Bart Van Assche
2022-04-18 15:57   ` Luis Chamberlain
2022-04-18 16:39     ` Bart Van Assche [this message]
2022-05-11 17:44       ` Luis Chamberlain
2022-05-11 18:22         ` Bart Van Assche
2022-12-20 21:28           ` Luis Chamberlain

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=1293a7e7-71d0-117e-1a4f-8ccfc609bc43@acm.org \
    --to=bvanassche@acm.org \
    --cc=linux-block@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=osandov@fb.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.