Summary: | Shutdown with pcmcia ethernet card trys to stop net.eth* twice when using pcmcia-cs scripts | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Jason Andryuk <the_deuce> |
Component: | Current packages | Assignee: | Mobile Herd (OBSOLETE) <mobile+disabled> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | azarah, csimonut, mr_bones_ |
Priority: | High | Keywords: | Inclusion |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 68964 | ||
Attachments: |
Patch to /etc/pcmcia/network adding check support
patch too /etc/pcmcia/network adding --quiet option |
Description
Jason Andryuk
2003-09-07 14:50:04 UTC
Created attachment 17238 [details, diff]
Patch to /etc/pcmcia/network adding check support
I started writing this comment to lobby for the above fix, but halfway through I changed my mind as to the correct line of action. -------------------------------- Look in source file cardmgr/cardmgr.c to see that the above change should be made. Here is a code walk through so you can see why the above change should be made. I just include the relevant portions of the respective functions. static void handle_signal(void) SIGTERM: if( do_check(i) == 0 ) do_remove(i); do_check() if ( execute_on_all("check", ...) == 0 ) return 0 int execute_on_all() ret |= execute_on_dev() return ret int execute_on_dev() return execute() int execute() return <return value of script called> '/etc/init.d/pcmcia stop' calls start-stop-daemon --stop no cardmgr. I believe that is sending SIGTERM, so that is where the walk starts. As you can see, do_remove(i) is only called if do_check(i) returns 0. do_check returns 0 if all the execute* functions return 0, which depends on the network script having returned zero. Since net.eth0 has already stopped, we don't want to stop it again. So we don't want to call do_remove(i). That means we need to return a non-zero return value from the '/etc/pcmcia/network' script for the check case. Wait a second. We DO want to run the do_remove(i). The interface has shutdown, but that does not mean that the pcmcia service has been cleaned up. In other words, The modules are left loaded. This isn't a big deal on shutdown, but it isn't the proper thing to do. With the above fix, this can be observed with the following set of commands: after booting and inserting a pcmcia network card: # /etc/init.d/net.eth0 stop # /etc/init.d/pcmcia stop # lsmod This will show the pcmcia and network drivers are still loaded. So, check should always return 0. This ensures that the modules will be removed. In order to get ride of the errors about the network already being stopped, we should call the net.eth* scripts with the --quiet option. That way we do not see the error, and there is no harm in calling the net.eth* script with stop twice. Functionality is preserved. As already noted this is how hotplug calls network scripts. Created attachment 17458 [details, diff]
patch too /etc/pcmcia/network adding --quiet option
This is a patch to the /etc/pcmcia/network script to call
/etc/init.d/net.$DEVICE with --quiet.
Fixed in sys-apps/pcmcia-cs-3.2.8. Thank you for reporting this. |