Browse Source

use findmnt with "--source" or "--target"

This avoids hanging on stale NFS mounts, which are not part of the boot
process.

https://bugzilla.redhat.com/show_bug.cgi?id=975401
master
Harald Hoyer 11 years ago
parent
commit
5e60145449
  1. 30
      dracut-functions.sh
  2. 2
      dracut.sh
  3. 2
      modules.d/96securityfs/securityfs.sh

30
dracut-functions.sh

@ -340,7 +340,7 @@ find_block_device() { @@ -340,7 +340,7 @@ find_block_device() {
echo $_dev
return 0
fi
done < <(findmnt -e -v -n -o 'MAJ:MIN,SOURCE' "$_find_mpt")
done < <(findmnt -e -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt")
fi
# fall back to /etc/fstab

@ -362,7 +362,7 @@ find_block_device() { @@ -362,7 +362,7 @@ find_block_device() {
echo $_dev
return 0
fi
done < <(findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' "$_find_mpt")
done < <(findmnt -e --fstab -v -n -o 'MAJ:MIN,SOURCE' --target "$_find_mpt")

return 1
}
@ -384,7 +384,7 @@ find_mp_fstype() { @@ -384,7 +384,7 @@ find_mp_fstype() {
[[ $_fs = "autofs" ]] && continue
echo -n $_fs
return 0
done < <(findmnt -e -v -n -o 'FSTYPE' "$1")
done < <(findmnt -e -v -n -o 'FSTYPE' --target "$1")
fi

while read _fs; do
@ -392,7 +392,7 @@ find_mp_fstype() { @@ -392,7 +392,7 @@ find_mp_fstype() {
[[ $_fs = "autofs" ]] && continue
echo -n $_fs
return 0
done < <(findmnt --fstab -e -v -n -o 'FSTYPE' "$1")
done < <(findmnt --fstab -e -v -n -o 'FSTYPE' --target "$1")

return 1
}
@ -406,10 +406,28 @@ find_mp_fstype() { @@ -406,10 +406,28 @@ find_mp_fstype() {
# $ find_dev_fstype /dev/sda2;echo
# ext4
find_dev_fstype() {
local _x _mpt _majmin _dev _fs _maj _min _find_dev
local _find_dev _fs
_find_dev="$1"
[[ "$_find_dev" = /dev* ]] || _find_dev="/dev/block/$_find_dev"
find_mp_fstype "$_find_dev"

if [[ $use_fstab != yes ]]; then
while read _fs; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
echo -n $_fs
return 0
done < <(findmnt -e -v -n -o 'FSTYPE' --source "$_find_dev")
fi

while read _fs; do
[[ $_fs ]] || continue
[[ $_fs = "autofs" ]] && continue
echo -n $_fs
return 0
done < <(findmnt --fstab -e -v -n -o 'FSTYPE' --source "$_find_dev")

return 1

}

# finds the major:minor of the block device backing the root filesystem.

2
dracut.sh

@ -789,7 +789,7 @@ chmod 755 "$initdir" @@ -789,7 +789,7 @@ chmod 755 "$initdir"

if [[ $hostonly ]]; then
for i in /sys /proc /run /dev; do
if ! findmnt "$i" &>/dev/null; then
if ! findmnt --target "$i" &>/dev/null; then
dwarning "Turning off host-only mode: '$i' is not mounted!"
unset hostonly
fi

2
modules.d/96securityfs/securityfs.sh

@ -5,6 +5,6 @@ @@ -5,6 +5,6 @@
SECURITYFSDIR="/sys/kernel/security"
export SECURITYFSDIR

if ! findmnt "${SECURITYFSDIR}" >/dev/null 2>&1; then
if ! findmnt --target "${SECURITYFSDIR}" >/dev/null 2>&1; then
mount -t securityfs -o nosuid,noexec,nodev securityfs ${SECURITYFSDIR} >/dev/null 2>&1
fi

Loading…
Cancel
Save