|
|
0903d0 |
From dd235965dd7b5de9dd87e5e5a4244005c5fb21e2 Mon Sep 17 00:00:00 2001
|
|
|
0903d0 |
From: Harald Hoyer <harald@redhat.com>
|
|
|
0903d0 |
Date: Mon, 19 Feb 2018 09:03:02 +0100
|
|
|
0903d0 |
Subject: [PATCH] dracut-function.sh:check_block_and_slaves() check for block
|
|
|
0903d0 |
devices
|
|
|
0903d0 |
|
|
|
0903d0 |
Some nvme have char parents, so check if the "slave" is a block dev.
|
|
|
0903d0 |
|
|
|
0903d0 |
Fixes https://github.com/dracutdevs/dracut/issues/373
|
|
|
0903d0 |
|
|
|
0903d0 |
Cherry-picked from: e64dafd1f2489f1d926cce3e3bfd33f62b29b192
|
|
|
0903d0 |
Resolves: #1549498
|
|
|
0903d0 |
---
|
|
|
0903d0 |
dracut-functions.sh | 18 ++++++++++--------
|
|
|
0903d0 |
1 file changed, 10 insertions(+), 8 deletions(-)
|
|
|
0903d0 |
|
|
|
0903d0 |
diff --git a/dracut-functions.sh b/dracut-functions.sh
|
|
|
0903d0 |
index 98a4b88b..ca54bd7f 100755
|
|
|
0903d0 |
--- a/dracut-functions.sh
|
|
|
0903d0 |
+++ b/dracut-functions.sh
|
|
|
0903d0 |
@@ -616,13 +616,14 @@ check_block_and_slaves() {
|
|
|
0903d0 |
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
|
|
|
0903d0 |
if ! lvm_internal_dev $2; then "$1" $2 && return; fi
|
|
|
0903d0 |
check_vol_slaves "$@" && return 0
|
|
|
0903d0 |
- if [[ -f /sys/dev/block/$2/../dev ]]; then
|
|
|
0903d0 |
+ if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
|
|
|
0903d0 |
check_block_and_slaves $1 $(<"/sys/dev/block/$2/../dev") && return 0
|
|
|
0903d0 |
fi
|
|
|
0903d0 |
[[ -d /sys/dev/block/$2/slaves ]] || return 1
|
|
|
0903d0 |
- for _x in /sys/dev/block/$2/slaves/*/dev; do
|
|
|
0903d0 |
- [[ -f $_x ]] || continue
|
|
|
0903d0 |
- check_block_and_slaves $1 $(<"$_x") && return 0
|
|
|
0903d0 |
+ for _x in /sys/dev/block/$2/slaves/*; do
|
|
|
0903d0 |
+ [[ -f $_x/dev ]] || continue
|
|
|
0903d0 |
+ [[ $_x/subsystem -ef /sys/class/block ]] || continue
|
|
|
0903d0 |
+ check_block_and_slaves $1 $(<"$_x/dev") && return 0
|
|
|
0903d0 |
done
|
|
|
0903d0 |
return 1
|
|
|
0903d0 |
}
|
|
|
0903d0 |
@@ -634,13 +635,14 @@ check_block_and_slaves_all() {
|
|
|
0903d0 |
_ret=0
|
|
|
0903d0 |
fi
|
|
|
0903d0 |
check_vol_slaves_all "$@" && return 0
|
|
|
0903d0 |
- if [[ -f /sys/dev/block/$2/../dev ]]; then
|
|
|
0903d0 |
+ if [[ -f /sys/dev/block/$2/../dev ]] && [[ /sys/dev/block/$2/../subsystem -ef /sys/class/block ]]; then
|
|
|
0903d0 |
check_block_and_slaves_all $1 $(<"/sys/dev/block/$2/../dev") && _ret=0
|
|
|
0903d0 |
fi
|
|
|
0903d0 |
[[ -d /sys/dev/block/$2/slaves ]] || return 1
|
|
|
0903d0 |
- for _x in /sys/dev/block/$2/slaves/*/dev; do
|
|
|
0903d0 |
- [[ -f $_x ]] || continue
|
|
|
0903d0 |
- check_block_and_slaves_all $1 $(<"$_x") && _ret=0
|
|
|
0903d0 |
+ for _x in /sys/dev/block/$2/slaves/*; do
|
|
|
0903d0 |
+ [[ -f $_x/dev ]] || continue
|
|
|
0903d0 |
+ [[ $_x/subsystem -ef /sys/class/block ]] || continue
|
|
|
0903d0 |
+ check_block_and_slaves_all $1 $(<"$_x/dev") && _ret=0
|
|
|
0903d0 |
done
|
|
|
0903d0 |
return $_ret
|
|
|
0903d0 |
}
|