setup.sh: don't bind controllers with only *some* devices mounted
This makes us iterate through all devices on a controller and check if any of those is mounted. Previously we only checked the very first device, which is obviously insufficient. Change-Id: I776846b931480d1e0a059137950c21f057ecb710 Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/393749 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
d57306d8eb
commit
9c44fad7e7
@ -71,16 +71,19 @@ function get_nvme_name_from_bdf {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_virtio_name_from_bdf {
|
function get_virtio_names_from_bdf {
|
||||||
set +e
|
set +e
|
||||||
virtio_ctrlrs=`lsblk --nodeps --output "NAME,SUBSYSTEMS" | grep virtio | awk '{print $1}'`
|
virtio_ctrlrs=`lsblk --nodeps --output "NAME,SUBSYSTEMS" | grep virtio | awk '{print $1}'`
|
||||||
set -e
|
set -e
|
||||||
|
virtio_names=''
|
||||||
|
|
||||||
for ctrlr in $virtio_ctrlrs; do
|
for ctrlr in $virtio_ctrlrs; do
|
||||||
if readlink "/sys/block/$ctrlr" | grep -q "$1"; then
|
if readlink "/sys/block/$ctrlr" | grep -q "$1"; then
|
||||||
eval "$2=$ctrlr"
|
virtio_names="$virtio_names $ctrlr"
|
||||||
return
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
eval "$2='$virtio_names'"
|
||||||
}
|
}
|
||||||
|
|
||||||
function configure_linux_pci {
|
function configure_linux_pci {
|
||||||
@ -128,13 +131,16 @@ function configure_linux_pci {
|
|||||||
|
|
||||||
for dev_id in `cat $TMP`; do
|
for dev_id in `cat $TMP`; do
|
||||||
for bdf in $(iter_pci_dev_id 1af4 $dev_id); do
|
for bdf in $(iter_pci_dev_id 1af4 $dev_id); do
|
||||||
blkname=''
|
blknames=''
|
||||||
get_virtio_name_from_bdf "$bdf" blkname
|
get_virtio_names_from_bdf "$bdf" blknames
|
||||||
if mount | grep -q "/dev/$blkname"; then
|
for blkname in $blknames; do
|
||||||
echo Active mountpoints on /dev/$blkname, so not binding PCI dev $bdf
|
if mount | grep -q "/dev/$blkname"; then
|
||||||
else
|
echo Active mountpoints on /dev/$blkname, so not binding PCI dev $bdf
|
||||||
linux_bind_driver "$bdf" "$driver_name"
|
continue 2
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
linux_bind_driver "$bdf" "$driver_name"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
rm $TMP
|
rm $TMP
|
||||||
|
Loading…
Reference in New Issue
Block a user