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. Suggested-by: Bart Van Assche Signed-off-by: Luis Chamberlain Rebased-by: Claude AI --- tests/srp/rc | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/tests/srp/rc b/tests/srp/rc index 8585272..2d3d615 100755 --- a/tests/srp/rc +++ b/tests/srp/rc @@ -331,19 +331,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.51.0