Re: [BUG] selftests/powerpc/eeh: eeh-basic breaks the device hosting rootfs, ext4 goes read-only and the test harness crashes

From: Shivang Upadhyay

Date: Wed Nov 25 2026 - 14:39:43 EST


On Thu, Nov 12, 2026 at 11:36:36AM +0530, Venkat Rao Bagalkote wrote:
> Hello!!!
>
> IBM CI has hit a failure that takes down the test harness, While running the
> powerpc EEH selftest on a bare-metal POWER system.
>
> The selftest injects an error into the PCI device that hosts the root
> filesystem. The filesystem goes read-only and the run dies.
>
> [ 1112.079091] EEH: Frozen PHB#3-PE#1fd detected
> [ 1112.079905] aacraid 0003:01:00.0: aacraid: PCI error detected 2
> [ 1112.140830] I/O error, dev sdb, sector 3906906472 op 0x1:(WRITE) ...
> [ 1112.140957] Aborting journal on device sdb2-8.
> [ 1112.140977] EXT4-fs error (device sdb2) in ext4_dirty_inode:7656: IO
> failure
> [ 1112.176664] EXT4-fs error (device sdb2): ext4_journal_check_start:98: ...
> Detected aborted journal
> [ 1187.736385] aacraid 0003:01:00.0: aacraid: PCI error - slot reset
> [ 1217.244306] EXT4-fs (sdb2): Remounting filesystem read-only
> [ 1220.583495] aacraid 0003:01:00.0: aacraid: PCI error - resume
>
> We need to make appropriate changes to selftest, so that it skips the
> adapter, if rootfs is hosted on it.
>
>
> SetUp:
>
> System: IBM 9006-22C (POWER9), PowerNV, bare metal
> Firmware: skiboot-v6.8-45-g8246de863
> Kernel: 7.4.0-rc2+, upstream master at 067c5c24cef2 ("Merge tag
> 'page_alloc-for-7.4-rc2'", 2026-11-10)
>
>
> Issue1: Selftest should skip the adapter that host the rootfs
>
> eeh_can_break() already skips ahci, for similar reason, but has no check for
> a device that backs /. A friendly LLM has suggested
>
> below change, which I tested and it works.
>
> 0003:01:00.0, Skipped: hosts the root filesystem
>
> Other adapters are tested as before and the run completes
>
> diff --git a/tools/testing/selftests/powerpc/eeh/eeh-functions.sh
> b/tools/testing/selftests/powerpc/eeh/eeh-functions.sh
> index 70daa3925dcb..f9db1f9be05a 100644
> --- a/tools/testing/selftests/powerpc/eeh/eeh-functions.sh
> +++ b/tools/testing/selftests/powerpc/eeh/eeh-functions.sh
> @@ -62,6 +62,42 @@ eeh_test_prep() {
>      echo 5000 > /sys/kernel/debug/powerpc/eeh_max_freezes
>  }
>
> +# Print the resolved sysfs path of a block device followed by the paths of
> +# every device stacked underneath it (dm, md, etc).
> +eeh_blk_sysfs_paths() {
> +    local sys="$1"
> +    local s
> +
> +    realpath "$sys"
> +    for s in "$sys"/slaves/* ; do
> +        if [ -e "$s" ] ; then
> +            eeh_blk_sysfs_paths "$s"
> +        fi
> +    done
> +}
> +
> +# Succeeds if the root filesystem lives on a disk behind any function of
> the
> +# slot containing the given PCI device.
> +eeh_hosts_rootfs() {
> +    local slot="${1%.*}"
> +    local majmin src sys
> +
> +    # Use the last "/" entry so an initramfs rootfs entry is ignored.
> +    majmin="$(awk '$5 == "/" { mm = $3 } END { print mm }'
> /proc/self/mountinfo)"
> +    src="$(awk '$5 == "/" { for (i = 6; i < NF; i++) if ($i == "-") s = $(i
> + 2) } END { print s }' /proc/self/mountinfo)"
> +
> +    if [ -e "/sys/dev/block/$majmin" ] ; then
> +        sys="/sys/dev/block/$majmin"
> +    elif [ -b "$src" ] ; then
> +        # e.g. btrfs reports an anonymous major:minor
> +        sys="/sys/class/block/$(basename "$(realpath "$src")")"
> +    else
> +        return 1
> +    fi
> +
> +    eeh_blk_sysfs_paths "$sys" 2>/dev/null | grep -q "/${slot}\.[0-7]/"
> +}
> +
>  eeh_can_break() {
>      # skip bridges since we can't recover them (yet...)
>      if [ -e "/sys/bus/pci/devices/$dev/pci_bus" ] ; then
> @@ -78,6 +114,14 @@ eeh_can_break() {
>          return 1;
>      fi
>
> +    # Breaking the device that hosts the root filesystem makes I/O fail
> +    # during recovery, which can abort the journal and leave / read-only
> +    # (and kill the test harness). Leave it alone.
> +    if eeh_hosts_rootfs "$1" ; then
> +        log "$1, Skipped: hosts the root filesystem"
Well as per my understanding, Testing the device where rootfs is hosted on
seems like a valid usecase for selftest. Maybe we should keep that ability.
Atleast keep it as opt-in.

The above freeze happened because write failed. Can we perhaps create our
own freeze window so that none of
filesystem write fail.

I am suggesting to test the following (suggested by Friendly LLM :),

sync
fsfreeze -f / # flush dirty data and the journal, then block new writes
# ... inject the error, wait for EEH recovery ...
fsfreeze -u / # thaw

Thanks
~Shivang