From: Shin'ichiro Kawasaki Date: Fri, 26 May 2023 04:58:42 +0000 (+0900) Subject: block/011: skip when mounted block devices are affected X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0bb9167fa4c5d972f3a4640b185e33c0fbd3c5ee;p=users%2Fsagi%2Fblktests.git block/011: skip when mounted block devices are affected The test case disables PCI device of the test target block device. When the PCI device has other block devices mounted, those block devices are disabled also. If the mounted device is the system disk, the test screws up the system. To avoid such dangerous operation, check if the target PCI device has mounted block devices. In that case, skip the test. Signed-off-by: Shin'ichiro Kawasaki --- diff --git a/tests/block/011 b/tests/block/011 index 4f331b4..0699936 100755 --- a/tests/block/011 +++ b/tests/block/011 @@ -10,12 +10,29 @@ DESCRIPTION="disable PCI device while doing I/O" TIMED=1 CAN_BE_ZONED=1 +pci_dev_mounted() { + local d dev p pdev + + pdev="$(_get_pci_dev_from_blkdev)" + for d in /sys/block/*; do + dev=${d##*/} + p=$(_get_pci_from_dev_sysfs "$d") + [[ $p != "$pdev" ]] && continue + grep -qe "/dev/$dev" /proc/mounts && return 0 + done + return 1 +} + requires() { _have_fio && _have_program setpci } device_requires() { _require_test_dev_is_pci + if pci_dev_mounted; then + SKIP_REASONS+=("mounted block device exists on test target PCI device") + return 1 + fi } test_device() {