From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oliver Neukum Date: Wed, 07 Feb 2001 09:02:31 +0000 Subject: Re: Adding PCMCIA support to the kernel tree -- developers needed. Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org > I said, "scan the bus *after* initializing the hot plugging > support and deal with devices that are already plugged in [...]" > You may process a device twice this way, but user level software > can detect this and synchronize when this is really necessary. In > most cases, you just want to modprobe a module, which can safely be > done multiple times, so it is not necessary to bother checking. The problem is that may try to configure a device that's no longer there, or worse a device that is being replaced this way. You need to tell the kernel that it must cease processing events on a bus that you are scanning. > In cases where you really need to avoid doing something twice > (such as spawning a dhcp client on an ethernet port), you can do your > synchronization at user level, by something like: > > # "insert" script > netif=$1 # For example "eth0" > # /var/run was previous cleared earlier in the boot process, so > # we know that if this directory exists, we have been called > # twice. > if mkdir /var/run/$netif ; then > dhclient -pf /var/run/$netif/pid $netif & > fi > > # "remove" script > netif=$1 # For example "eth0" > kill $(cat /var/run/netif/$netif/pid) > rm -rf /var/run/$netif That's the problem. You compute $1 and then you configure it without a guarantee that $1 is still the interface you thought it to be. It is a very small window, but I feel that we shouldn't design something which works only in most cases. Regards Oliver _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel