Bart had put the remove_mpath_devs() call inside a loop because multipathd keeps running while the loop is ongoing and hence can modify paths while the loop is running. The races that multipathd can trigger with the module refcnt is precisely the sort of races which patient module removal is supposed to address. I've tested blktests with this on kdevops without finding any regressions in testing. srp tests were run with and without use_siw=1. Suggested-by: Bart Van Assche <bvanassche@xxxxxxx> Signed-off-by: Luis Chamberlain <mcgrof@xxxxxxxxxx> --- tests/srp/rc | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/tests/srp/rc b/tests/srp/rc index 4d504f7bd0cc..a5c0444a958e 100755 --- a/tests/srp/rc +++ b/tests/srp/rc @@ -320,19 +320,10 @@ start_srp_ini() { # 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 $? } # Associate the LIO device with name $1/$2 with file $3 and SCSI serial $4. -- 2.35.1