setup.sh: don't unbind devices with LVM on top

Grepping `mount` output for /dev/sdX does not guarantee
the device has no mountpoints. If /dev/sdX happens to
have an LVM built on top, then it could be
/dev/mapper/something that appears in `mount`.

Fix this by checking mountpoints of /dev/sdX and all its
children as reported by `lsblk`.

Change-Id: Id2fa6939645584d009bc87c7341a97f6948ebde9
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/434209
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Darek Stojaczyk 2018-11-21 14:08:19 +01:00 committed by Jim Harris
parent 37b7a30894
commit 1045dab06f

View File

@ -231,7 +231,7 @@ function configure_linux_pci {
blknames=''
get_virtio_names_from_bdf "$bdf" blknames
for blkname in $blknames; do
if mount | grep -q "/dev/$blkname"; then
if [ "$(lsblk /dev/$blkname --output MOUNTPOINT -n | wc -w)" != "0" ]; then
echo Active mountpoints on /dev/$blkname, so not binding PCI dev $bdf
continue 2
fi