From: Andrey Borzenkov <arvidjaar@mail.ru>
To: linux-hotplug@vger.kernel.org
Subject: Re: net interface renaming issue (+fix?)
Date: Sun, 09 Apr 2006 18:00:49 +0000 [thread overview]
Message-ID: <200604092200.51452.arvidjaar@mail.ru> (raw)
In-Reply-To: <20060409192140.73644723@eusebe>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sunday 09 April 2006 21:21, Thomas de Grenier de Latour wrote:
> Hi,
>
> I'm running Gentoo Linux, a 2.6.16-ck kernel, and udev-0.89-r2, and
> have had hard time with network interfaces renaming through udev
> rules. The first thing i've tried were rules like this one:
>
> SUBSYSTEM="net", KERNEL="eth*", SYSFS{address}="00:0d:60:12:75:0a",
> NAME="lan"
>
> Plus this one from the standard early rules:
>
> ACTION="add", SUBSYSTEM="net", WAIT_FOR_SYSFS="address"
>
> It doesn't work when i "modprobe e1000" (my ethernet driver):
> ....
> udevd[21612]: udev_event_run: seq 956 forked, pid [21816], 'add' 'net', 0
> seconds old udevd-event[21816]: wait_for_sysfs: file
> '/sys/class/net/eth0/address' appeared after 0 loops udevd-event[21816]:
> udev_rules_get_name: no node name set, will use kernel name 'eth0' ....
> But if i later do a "echo add > /sys/class/net/eth0/uevent", then
> interface is properly renamed. It also works fine if i start with
> the module initialy not loaded, and then trigger the uevent on the
> corresponding pci device (will load the module, etc.)
>
There appears to be race between creating 'address' and getting (usable)
value. See below.
[...]
>
> So i wonder, maybe such a rule should be added to the standard early
> ones? It should maybe use more checks though, to be sure there is
> actually a driver to wait. Something like ENV{PHYSDEVPATH}="?*"
> and/or ENV{PHYSDEVDRIVER}="?*".
>
You probably get reply that they are obsolete and should not be used in new
rules :)
[...]
> Or is "address" being added to sysfs with no useful value yet the real
> issue, and my rule only an ugly workround?
>
Seems so.
net/core/net-syfs.c:dev_isalive():
return dev->reg_state = NETREG_REGISTERED;
net/core/net-syfs.c:show_address():
if (dev_isalive(net))
ret = format_addr(buf, net->dev_addr, net->addr_len);
net/core/dev.c:netdev_run_todo():
err = netdev_register_sysfs(dev);
if (err)
printk(KERN_ERR "%s: failed sysfs registration
(%d)\n",
dev->name, err);
dev->reg_state = NETREG_REGISTERED;
break;
So basically there is a window between net device appearing in sysfs and
'address' returning usable value. To test you could move dev->reg_state
assignment before netdev_register_sysfs call; if this helps it makes sense
ask on net list if this is safe change.
- -andrey
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
iD8DBQFEOUvTR6LMutpd94wRAg+nAKCXnI9mrChpQ9TAz4VVQhSaP/MQjgCfbX6n
5lcJ30K1qpTtbxISei6pN9I=Rwsc
-----END PGP SIGNATURE-----
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid\x110944&bid$1720&dat\x121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
next prev parent reply other threads:[~2006-04-09 18:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-09 17:21 net interface renaming issue (+fix?) Thomas de Grenier de Latour
2006-04-09 17:56 ` Sergey Vlasov
2006-04-09 18:00 ` Andrey Borzenkov [this message]
2006-04-09 19:28 ` Thomas de Grenier de Latour
2006-04-13 8:39 ` Marco d'Itri
2006-04-13 9:06 ` Thomas de Grenier de Latour
2006-04-13 10:29 ` Kay Sievers
2006-04-13 10:36 ` Marco d'Itri
2006-04-13 11:10 ` Kay Sievers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200604092200.51452.arvidjaar@mail.ru \
--to=arvidjaar@mail.ru \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).