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

scripts/setup: Fix check for mounted devices



The previous approach didn't take into the account systems where root
partition is representend in a virtual form of /dev/root (see
clearlinux). In case the device was bound to virtio this would fool
setup.sh into thinking nothing is mounted and proceed with unbinding
the entire rootfs.

Fix this by checking the maj:min numbers of the device instead of its
name against the mountinfo list.

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


Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
Reviewed-by: default avatarMaciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 44775a80
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -160,7 +160,8 @@ function get_mounted_part_dev_from_bdf_block() {

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