Bug 390271

Summary: endless loop in ifdown-eth, OS freeze
Product: [Fedora] Fedora Reporter: Stas <stas_k_spam>
Component: initscriptsAssignee: Bill Nottingham <notting>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: mglantz, rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-11-26 18:39:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
proposed patch to avoid endless loop
none
simpler patch none

Description Stas 2007-11-19 12:51:16 UTC
Description of problem:

ifdown-eth contains some code to deal with case when HWADDR is changed in
ifcfg-ethX to rename device on startup. If HWADDR change is detected, "ifdown
ethY" is executed to shut down corresponding device. But if we have 2 ethernet
devices eth0 and eth1 and swap HWADDRs in corresponding ifcfg-eth files, then
endless loop occurs:
- "ifdown eth0" calls "ifdown-eth eth0"
- ifdown-eth execs "ifdown eth1"
- "ifdown eth1" calls "ifdown-eth eth1"
- ifdown-eth execs "ifdown eth0"
- ...
No diagnostics is printed during this, so to end-user it looks like freeze.
Ctl-Alt-Del doesn't help.

Version-Release number of selected component (if applicable):

Latest version of initscripts from CVS as of 18 Nov 2007 still has this code.

How reproducible:

Reliably.

Steps to Reproduce:
1. Use computer with 2 ethernet cards, both up.
2. Swap HWADDR values between ifcfg-eth0 and ifcfg-eth1
3. shutdown -r now
4. Look at console - OS freezes on network shutdown.
  
Actual results:

Freeze on shutdown.

Expected results:

Clean shutdown, syncing disks, halt or reboot depending on "shutdown" switch.

Additional info:

Patch attached.

Comment 1 Stas 2007-11-19 12:51:17 UTC
Created attachment 263461 [details]
proposed patch to avoid endless loop

Comment 2 Stas 2007-11-21 10:35:23 UTC
Steps to Reproduce on Fedora Core 8 Live CD:
1. Use computer with 2 ethernet cards, both up
2. Swap HWADDR values between ifcfg-eth0 and ifcfg-eth1
3. Run "/etc/init.d/network stop"
4. See how it never ends

Comment 3 Bill Nottingham 2007-11-21 16:38:08 UTC
Created attachment 266091 [details]
simpler patch

Here's what I'm proposing - I'm trying to think of a case where you'd want to
continue when the device names don't match, and I can't think of one.

Comment 4 Stas 2007-11-22 14:55:51 UTC
This patch works. And I agree, it's much better to bail out in case of
inconsistency instead of trying to guess which interface user was willing to
shut down.
Thank you.

Comment 5 Bill Nottingham 2007-11-26 18:39:52 UTC
Added in CVS, will be in rawhide. May make a F8 update.

Comment 6 Stas 2007-11-27 14:27:02 UTC
BTW, that backquote in the patch seems to break things. It's typo, I guess.
I didn't notice that before because I was applying your patch using cut-n-paste.
I don't even test it now when I see it because patch adds odd number of backquotes.

Comment 7 Bill Nottingham 2007-11-27 17:14:01 UTC
Whoops, thanks.

Comment 8 Stas 2008-03-18 18:14:44 UTC
Now it hangs when MAC address is wrong (and NEWCONFIG is empty because of that,
and grep takes 1 argument and waits for input on stdin).

Comment 9 Stas 2008-03-18 19:07:23 UTC
It can be fixed merely by adding
[ -n "${NEWCONFIG}" ] &&
right before
eval $(LANG=C fgrep "DEVICE=" $NEWCONFIG)


Comment 10 Bill Nottingham 2008-03-18 20:36:27 UTC
Something similar added in git.

Comment 11 Magnus Glantz 2011-01-15 00:15:23 UTC
*** Bug 669728 has been marked as a duplicate of this bug. ***