From 1045dab06f20ec9c997d4a2e28c73aa501f5f646 Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Wed, 21 Nov 2018 14:08:19 +0100 Subject: [PATCH] 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 Reviewed-on: https://review.gerrithub.io/434209 Chandler-Test-Pool: SPDK Automated Test System Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Karol Latecki Reviewed-by: Jim Harris --- scripts/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index 4b46b3611..0dd1bf53f 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -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