Skip to contentSkip to conversation

net-persistence fails when adding new NIC and still having /

PATCH In review Matthias Schwarzott 3 participants 7 messages Feb 14, 2007 – Feb 26, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net-persistence fails when adding new NIC and still having /

Hi list!

This time I have a quite ugly bug.
For reference: http://bugs.gentoo.org/show_bug.cgi?id=166486

Short form:
Adding a new NIC leaves a system which takes 30sec more on udevstart, and after that has network interfaces eth0, eth1 and eth1_rename or similar.

Using udev-104 (with net-rename related patches from udev-105). Reproduce:
1. Have 1 or more NICs already in the system (here: eth0 eth1).
2. udev already has created 70-persistent-net.rules, setting names to: eth0 eth1

3. Now insert another NIC into the system and boot:
4. Then at boot for newest NIC write_net_rules get called.

5. write_net_rules detects that /etc/udev/rules.d/ is read only that point and decides to write to /dev/.udev/tmp-rules-*:
RULES_FILE=/dev/.udev/tmp-rules--.....

6. Now problem is: When checking for already used names it does this first:
[ -e $RULES_FILE ] || return
Sadly $RULES_FILE does not exist at that point, thus it skips to also look into /etc/udev/rules.d/70-persistent-net.rules

7. Two possible cases:
a) newest NIC gets eth2 from kernel.
Not checking already used netif names does not harm and udev writes eth2 down to the file.

b) newest NIC gets name already used (here: eth0) and other nics get higher numbers.
Now missing check tells write_net_rules that eth0 is free for use => it writes a rule using it and also writes it to stdout for direct usage.

8. udev enters the netif rename code for all interfaces (at same time).
a) In this case all interfaces get unique new names and it will work (with eth?_rename only being a tmp name for one loop or so).

b) udev enters a loop in which two interfaces try to rename themselves to same name (here: eth0).

The new NIC already has eth0 => stays so.
The old NIC that has ever been eth0 (and at this boot is eth1) gets renamed to eth1_rename (for making place for real owner of eth1).
But then renaming to eth0 must fail (name already used).
This failing leads to a busy waiting loop for exactly 30sec.

After that we have:
eth0: new NIC that should be eth2
eth1: correct name assigned
eth1_rename: nic that should be eth0

Deleting the (wrong) check from 6. solves this (Patch attached).

It could also be replaced by a more versatile check but I think that is not necessary (somewhere integrated with read-only detection).

Greetings
Matthias

Signature · 1 line
Matthias Schwarzott (zzam)
extras/rule_generator/rule_generator.functions +0 -1
diff -ru udev-104-orig/extras/rule_generator/rule_generator.functions udev-104/extras/rule_generator/rule_generator.functions
@@ -92,7 +92,6 @@
 	local linkre="$2"
 	local match="$3"
 
-	[ -e $RULES_FILE ] || return
 	local search='.*[[:space:],]'"$key"'"\('"$linkre"'\)"[[:space:]]*\(,.*\|\\\|\)$'
 	echo $(sed -n -e "${match}s/${search}/\1/p" $RO_RULES_FILE $RULES_FILE)
 }

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#1 lore raw

Re: [PATCH] net-persistence fails when adding new NIC and still

Hi!

I did a little digging, and I think these Debian-Bug-reports are also describing this problem/a similar one:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug@8750
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug@5845
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug@6948

All being symptomes for same error:
That is write_net_rules not reading existing rules-file.

Matthias

Signature · 11 lines
Matthias Schwarzott (zzam)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#2 lore raw

Re: [PATCH] net-persistence fails when adding new NIC and still

In reply to Matthias Schwarzott
Quoted 5 lines · Matthias Schwarzott

Hi list!

This time I have a quite ugly bug.
For reference: http://bugs.gentoo.org/show_bug.cgi?id6486

Quoted 7 lines

Short form:
Adding a new NIC leaves a system which takes 30sec more on udevstart, and after that has network interfaces eth0, eth1 and eth1_rename or similar.

Deleting the (wrong) check from 6. solves this (Patch attached).

Anything speaking against commiting this patch?

Matthias

Signature · 11 lines
Matthias Schwarzott (zzam)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#3 lore raw

Re: [PATCH] net-persistence fails when adding new NIC and still

In reply to Matthias Schwarzott
Quoted 1 line · Matthias Schwarzott

Anything speaking against commiting this patch?

I uploaded a new Debian package with the change, but I did not really think much about it. (Why did I add that check in the first place?)

Signature · 12 lines
ciao,
Marco

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#4 lore raw

Re: [PATCH] net-persistence fails when adding new NIC and still

In reply to Matthias Schwarzott
Quoted 5 lines · Marco d'Itri
Quoted 1 line · Matthias Schwarzott

Anything speaking against commiting this patch?

I uploaded a new Debian package with the change, but I did not really think much about it. (Why did I add that check in the first place?)

Nice. I've applied it to the udev tree too now.

Thanks,
Kay

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

#5 lore raw

Re: [PATCH] net-persistence fails when adding new NIC and still

In reply to Matthias Schwarzott
Quoted 4 lines · Kay Sievers
Quoted 3 lines
Quoted 1 line

Anything speaking against commiting this patch?

I uploaded a new Debian package with the change, but I did not really think much about it. (Why did I add that check in the first place?)

Nice. I've applied it to the udev tree too now.

I did not actually say that it's correct, just that I have applied it. :-)

Signature · 12 lines
ciao,
Marco

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
#6 lore raw

Re: [PATCH] net-persistence fails when adding new NIC and still

In reply to Matthias Schwarzott
Quoted 8 lines · Marco d'Itri
Quoted 4 lines · Kay Sievers
Quoted 3 lines
Quoted 1 line

Anything speaking against commiting this patch?

I uploaded a new Debian package with the change, but I did not really think much about it. (Why did I add that check in the first place?)

Nice. I've applied it to the udev tree too now.

I did not actually say that it's correct, just that I have applied it. :-)

Hehe, that's how it works sometimes, to find out what is correct. If nobody complains now, it probably was. :)

Kay

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CIDÞVDEV
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel