scripts: Fix setup.sh to take into consideration other namespaces
Currently we do not switch driver for NVMe that is mounted. The problem is that we take into consideration only the first namespace, but any other namespace can be still mounted. In such case we should not switch driver. Signed-off-by: Maciej Szwed <maciej.szwed@intel.com> Change-Id: Idd13edccd0929574f2914a71e841e67871dd2e9f Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457762 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
a8a53c7c4b
commit
074fa32636
@ -135,6 +135,8 @@ function linux_hugetlbfs_mounts() {
|
||||
}
|
||||
|
||||
function get_nvme_name_from_bdf {
|
||||
local blknames=()
|
||||
|
||||
set +e
|
||||
nvme_devs=$(lsblk -d --output NAME | grep "^nvme")
|
||||
set -e
|
||||
@ -145,10 +147,11 @@ function get_nvme_name_from_bdf {
|
||||
fi
|
||||
link_bdf=$(basename "$link_name")
|
||||
if [ "$link_bdf" = "$1" ]; then
|
||||
eval "$2=$dev"
|
||||
return
|
||||
blknames+=($dev)
|
||||
fi
|
||||
done
|
||||
|
||||
printf '%s\n' "${blknames[@]}"
|
||||
}
|
||||
|
||||
function get_virtio_names_from_bdf {
|
||||
@ -200,21 +203,27 @@ function configure_linux_pci {
|
||||
|
||||
# NVMe
|
||||
for bdf in $(iter_all_pci_class_code 01 08 02); do
|
||||
blkname=''
|
||||
get_nvme_name_from_bdf "$bdf" blkname
|
||||
blknames=()
|
||||
if ! pci_can_use $bdf; then
|
||||
pci_dev_echo "$bdf" "Skipping un-whitelisted NVMe controller $blkname"
|
||||
pci_dev_echo "$bdf" "Skipping un-whitelisted NVMe controller at $bdf"
|
||||
continue
|
||||
fi
|
||||
if [ "$blkname" != "" ]; then
|
||||
|
||||
mount=false
|
||||
for blkname in $(get_nvme_name_from_bdf $bdf); do
|
||||
mountpoints=$(lsblk /dev/$blkname --output MOUNTPOINT -n | wc -w)
|
||||
else
|
||||
mountpoints="0"
|
||||
fi
|
||||
if [ "$mountpoints" = "0" ]; then
|
||||
if [ "$mountpoints" != "0" ]; then
|
||||
mount=true
|
||||
blknames+=($blkname)
|
||||
fi
|
||||
done
|
||||
|
||||
if ! $mount; then
|
||||
linux_bind_driver "$bdf" "$driver_name"
|
||||
else
|
||||
pci_dev_echo "$bdf" "Active mountpoints on /dev/$blkname, so not binding PCI dev"
|
||||
for name in ${blknames[@]}; do
|
||||
pci_dev_echo "$bdf" "Active mountpoints on /dev/$name, so not binding PCI dev"
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user