From: Seewer Philippe <philippe.seewer-omB+W0Dpw2o@public.gmane.org>
To: "<initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>"
<initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH] Move kill-dhclient to netroot
Date: Fri, 19 Jun 2009 16:22:42 +0200 [thread overview]
Message-ID: <4A3B9F32.2010805@bfh.ch> (raw)
We need to kill dhclient before calling switch_root. But doing it in
pre-pivot slows down netroot if we are trying do acquire dhcp addresses
from multiple interfaces.
If, for example, we have two interfaces and the first one succeeds
in acquiring an address and mounts, the second interface might still
be trying to acquire an address. Which means that udevadm settle is
waiting for the timeout to occur.
Killing all running dhclients in netroot after a successful mount
solves this.
diff --git a/modules.d/40network/install b/modules.d/40network/install
index 0b76cbd..3014d18 100755
--- a/modules.d/40network/install
+++ b/modules.d/40network/install
@@ -18,7 +18,6 @@ instmods ecb arc4
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
inst_hook cmdline 99 "$moddir/parse-ip-opts.sh"
-inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh"
# TODO ifcfg config style is redhat specific, this should probably
# go into its own module at one time
diff --git a/modules.d/40network/kill-dhclient.sh b/modules.d/40network/kill-dhclient.sh
deleted file mode 100755
index 54b3344..0000000
--- a/modules.d/40network/kill-dhclient.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-for f in /tmp/dhclient.*.pid; do
- [ -e $f ] || continue
- read PID < $f;
- kill $PID;
-done
diff --git a/modules.d/40network/netroot b/modules.d/40network/netroot
index 81b99f7..2356b9e 100755
--- a/modules.d/40network/netroot
+++ b/modules.d/40network/netroot
@@ -108,6 +108,10 @@ if $handler $netif $netroot $NEWROOT; then
[ -f /tmp/dhclient.$iface.dhcpopts ] && cp /tmp/dhclient.$iface.dhcpopts /tmp/net.$ifa
done
+ # We have root, so we don't need any running dhclients anymore.
+ # This frees the udev event queue as well
+ [ -n "$(pidof dhclient)" ] && kill $(pidof dhclient)
+
# Save used netif for later use
[ ! -f /tmp/net.ifaces ] && echo $netif > /tmp/net.ifaces
else
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
reply other threads:[~2009-06-19 14:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A3B9F32.2010805@bfh.ch \
--to=philippe.seewer-omb+w0dpw2o@public.gmane.org \
--cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.