Fix intermittency in ZFS tests that disable SAS phys
tests/sys/cddl/zfs/include/libsas.kshlib
In disable_sas_disk, wait for the disk to disappear before
returning. If it doesn't disappear within 2 seconds, try disabling
the phy again. This is necessary because disabling the phy
sometimes fails if there is a command outstanding at the time. I
think the HBA's error recovery code might be resetting the phy in
that case. Also, in enable_sas_disk, wait for the disk to reappear.
tests/sys/cddl/zfs/tests/hotspare/hotspare_replace_003_neg.ksh
tests/sys/cddl/zfs/tests/zfsd/zfsd.kshlib
tests/sys/cddl/zfs/tests/zfsd/zfsd_hotspare_004_pos.ksh
tests/sys/cddl/zfs/tests/zfsd/zfsd_hotspare_007_pos.ksh
tests/sys/cddl/zfs/tests/zfsd/zfsd_import_001_pos.ksh
tests/sys/cddl/zfs/tests/zfsd/zfsd_replace_001_pos.ksh
tests/sys/cddl/zfs/tests/zfsd/zfsd_replace_002_pos.ksh
tests/sys/cddl/zfs/tests/zfsd/zfsd_replace_003_pos.ksh
Every place that was using (enable|disable)_sas_disk was already
waiting for the disk to (re|dis)appear, so move that code into a
common location in libsas.kshlib. Also remove some superfluous
rescan_disk calls.
Sponsored by: Spectra Logic Corp