Skip to contentSkip to conversation

hotplug for klibc utils

PATCH Arnd Bergmann 3 participants 6 messages Feb 27, 2004 – Feb 28, 2004

lore
Share & tools
lore
#0 lore raw

Several people have run into problems when attaching large disk arrays to a mainframe because of running /sbin/hotplug as a bash script takes far longer than the interval between hotplug events.

Attaching more than 300 devices at once will cause an out-of-memory condition and the kernel starts killing random processes.

Running only udev instead of hotplug from the kernel is fast enough.

Christian Bornträger was so kind to reimplement the Gregs hotplug shell script in C and verify that this solves the problem.

The shell version currently does:

Quoted 5 lines

DIR="/etc/hotplug.d"
for I in "${DIR}/$1/"*.hotplug "${DIR}/"default/*.hotplug ; do

        if [ -f $I ]; then test -x $I && $I $1 ; fi

done
exit 1;

	Arnd <><
utils/Makefile +1 -1
diff -urN klibc-0.115/utils/Makefile klibc-0.115-hotplug/utils/Makefile
@@ -6,7 +6,7 @@
 CFLAGS       = $(MAKEDEPS) $(OPTFLAGS) $(REQFLAGS) -W -Wall
 LIBS         = $(KLIBC) $(LIBGCC)
 PROGS       := chroot dd fstype mkdir mkfifo mount pivot_root umount \
-	       true false sleep ln
+	       true false sleep ln hotplug
 STATICPROGS := $(patsubst %,static/%,$(PROGS))
 SHAREDPROGS := $(patsubst %,shared/%,$(PROGS))
 LIBOBJS	     = file_mode.o
utils/hotplug.c +80 -0

80 lines not on this page · raw message

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&opÌk
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw
Quoted 4 lines · Arnd Bergmann

Several people have run into problems when attaching large disk arrays to a mainframe because of running /sbin/hotplug as a bash script takes far longer than the interval between hotplug events.

Quoted 13 lines

Attaching more than 300 devices at once will cause an out-of-memory condition and the kernel starts killing random processes.

Running only udev instead of hotplug from the kernel is fast enough.

The shell version currently does:

Quoted 5 lines

DIR="/etc/hotplug.d"
for I in "${DIR}/$1/"*.hotplug "${DIR}/"default/*.hotplug ; do

       if [ -f $I ]; then test -x $I && $I $1 ; fi

done
exit 1;

And so it does.

Just to double-check:
does this program also works for cases where the files in /etc/hotplug.d/default
are scripts themselves?
Can't really see how this will help, since in that case we will have to start bash anyway ... but what do I know ...

Cheers,

Hannes

Signature · 15 lines
Dr. Hannes Reinecke			[email protected]
SuSE Linux AG				S390 & zSeries
Maxfeldstraße 5				+49 911 74053 688
90409 Nürnberg				http://www.suse.de


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#2 lore raw
In reply to Arnd Bergmann
Quoted 8 lines · Hannes Reinecke

Arnd Bergmann wrote:

Just to double-check:
does this program also works for cases where the files in /etc/hotplug.d/default
are scripts themselves?
Can't really see how this will help, since in that case we will have to start bash anyway ... but what do I know ...

No, if you have other scripts in /etc/hotplug.d/default, it does not eliminate the problem, although it will at least help a bit since hotplug will go through the bash startup less often.

What scripts do you need in /etc/hotplug.d/default?

	Arnd <><

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#3 lore raw
In reply to Arnd Bergmann
Quoted 12 lines · Arnd Bergmann
Quoted 8 lines · Hannes Reinecke

Arnd Bergmann wrote:

Just to double-check:
does this program also works for cases where the files in /etc/hotplug.d/default
are scripts themselves?
Can't really see how this will help, since in that case we will have to start bash anyway ... but what do I know ...

Quoted 6 lines

No, if you have other scripts in /etc/hotplug.d/default, it does not eliminate the problem, although it will at least help a bit since hotplug will go through the bash startup less often.

What scripts do you need in /etc/hotplug.d/default?

Well, it's not quite clever to call udev by default, as we have devices which needs to be initialized first, e.g our infamous zfcp adapter. If we are to configure this with hotplug events, we basically have to resolve to use scripts.

Hmm. But maybe we can be a bit more clever; after all, the default script in /etc/hotplug.d/default just calls the appropriate agent. If we were to implement this behaviour in the multiplexer, then we can use as a block agent 'udev' and scripts for everything else, always assuming that the other events are not as numerous.

ccw events aside.

Cheers,

Hannes

Signature · 15 lines
Dr. Hannes Reinecke			[email protected]
SuSE Linux AG				S390 & zSeries
Maxfeldstraße 5				+49 911 74053 688
90409 Nürnberg				http://www.suse.de


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#4 lore raw
In reply to Arnd Bergmann
Quoted 5 lines · Hannes Reinecke

Hmm. But maybe we can be a bit more clever; after all, the default script in /etc/hotplug.d/default just calls the appropriate agent. If we were to implement this behaviour in the multiplexer, then we can use as a block agent 'udev' and scripts for everything else, always assuming that the other events are not as numerous.

IFAIR, the current /etc/hotplug.d/default/default.hotplug is simply what used to be /sbin/hotplug before it did any multiplexing.

It should be easy to just convert the /etc/hotplug/*.agent scripts to /etc/hotplug.d/*/*.hotplug. At least for new distributions that don't need to provide support for /etc/hotplug/*.agent, you could simply leave out /etc/hotplug.d/default/default.hotplug.

	Arnd <><

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#5 lore raw
In reply to Arnd Bergmann
Quoted 18 lines · Hannes Reinecke
Quoted 4 lines · Arnd Bergmann

Several people have run into problems when attaching large disk arrays to a mainframe because of running /sbin/hotplug as a bash script takes far longer than the interval between hotplug events.

Quoted 13 lines

Attaching more than 300 devices at once will cause an out-of-memory condition and the kernel starts killing random processes.

Running only udev instead of hotplug from the kernel is fast enough.

The shell version currently does:

Quoted 5 lines

DIR="/etc/hotplug.d"
for I in "${DIR}/$1/"*.hotplug "${DIR}/"default/*.hotplug ; do

      if [ -f $I ]; then test -x $I && $I $1 ; fi

done
exit 1;

Quoted 6 lines

And so it does.

Just to double-check:
does this program also works for cases where the files in /etc/hotplug.d/default
are scripts themselves?

Then use the dietHotplug package to handle the autoloading of modules. Then you do not have any shell scripts in the picture at all.

Hope this helps,

greg k-h

-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel