aboutsummaryrefslogtreecommitdiffstats
path: root/etc/rc.d/init.d/network
diff options
context:
space:
mode:
authorDavid Kaspar [Dee'Kej] <dkaspar@redhat.com>2018-07-24 15:28:12 +0200
committerDee'Kej <deekej@linuxmail.org>2018-07-24 16:24:00 +0200
commit765c1737b3e3e4ca38f0140bcfadc3f2c11a7413 (patch)
tree1b0a49bf5e95f785b62135ae6f1f989953abeb7e /etc/rc.d/init.d/network
parent3c3fe4a4d1b2a1113ed302df3ac9866ded51b01b (diff)
downloadinitscripts-765c1737b3e3e4ca38f0140bcfadc3f2c11a7413.tar
initscripts-765c1737b3e3e4ca38f0140bcfadc3f2c11a7413.tar.gz
initscripts-765c1737b3e3e4ca38f0140bcfadc3f2c11a7413.tar.bz2
initscripts-765c1737b3e3e4ca38f0140bcfadc3f2c11a7413.tar.xz
initscripts-765c1737b3e3e4ca38f0140bcfadc3f2c11a7413.zip
network: parsing of /proc/mounts returned
This partially reverts the commit 15eaf7ece, because systemd's generated unit files might have incorrect dependencies at some circumstances, thus causing diskless nfs-clients to hang while unmounting root filesystem after '$ service network stop'.
Diffstat (limited to 'etc/rc.d/init.d/network')
-rwxr-xr-xetc/rc.d/init.d/network7
1 files changed, 6 insertions, 1 deletions
diff --git a/etc/rc.d/init.d/network b/etc/rc.d/init.d/network
index 52b2d6b9..06723859 100755
--- a/etc/rc.d/init.d/network
+++ b/etc/rc.d/init.d/network
@@ -162,11 +162,16 @@ stop)
[ "$EUID" != "0" ] && exit 4
# Don't shut the network down if root or /usr is on NFS or a network
# block device.
- if systemctl show --property=RequiredBy -- -.mount usr.mount | grep -q 'remote-fs.target' ; then
+ root_fstype=$(gawk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/" && $3 != "rootfs") { print $3; }}' /proc/mounts)
+ usr_fstype=$(gawk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/usr" && $3 != "rootfs") { print $3; }}' /proc/mounts)
+
+ if [[ "${root_fstype}" == nfs* || "${usr_fstype}" == nfs* ]] || systemctl show --property=RequiredBy -- -.mount usr.mount | grep -q 'remote-fs.target' ; then
net_log $"rootfs or /usr is on network filesystem, leaving network up"
exit 1
fi
+ unset root_fstype usr_fstype
+
# Don't shut the network down when shutting down the system if configured
# as such in sysconfig
if is_false "$IFDOWN_ON_SHUTDOWN"; then