Commit 06058e9b authored by Michal Berger's avatar Michal Berger Committed by Tomasz Zawadzki
Browse files

scripts/setup: Revert back to using lsblk for mount checks



lsblk will include all the potential holders|virtual devices given
block device may be part of. This is relevant in case a nvme|virtio
device is part of the lvm|md setup.

Change-Id: I32198ddcf71746c3cbad4a96496a1762a5c201cd
Signed-off-by: default avatarMichal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5167


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 657e50a0
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -182,18 +182,16 @@ function get_block_dev_from_bdf() {

function get_mounted_part_dev_from_bdf_block() {
	local bdf=$1
	local blocks block part
	local blocks block mounts

	blocks=($(get_block_dev_from_bdf "$bdf"))

	for block in "${blocks[@]}"; do
		for part in "/sys/block/$block/$block"*; do
			[[ -b /dev/${part##*/} ]] || continue
			if [[ $(< /proc/self/mountinfo) == *" $(< "$part/dev") "* ]]; then
				echo "${part##*/}"
		mounts=$(lsblk -n -o MOUNTPOINT "/dev/$block")
		if [[ -n $mounts ]]; then
			echo "$block"
		fi
	done
	done
}

function collect_devices() {
@@ -264,7 +262,8 @@ function collect_driver() {

function verify_bdf_mounts() {
	local bdf=$1
	local blknames=($(get_mounted_part_dev_from_bdf_block "$bdf"))
	local blknames
	blknames=($(get_mounted_part_dev_from_bdf_block "$bdf")) || return 1

	if ((${#blknames[@]} > 0)); then
		for name in "${blknames[@]}"; do