dhcpcd-discuss

Re: Race between kernel and udevd uevents

Roy Marples

Mon Apr 16 09:36:01 2018

On 16/04/2018 09:22, Lukas Wunner wrote:
On Wed, Apr 11, 2018 at 05:13:50PM +0100, Roy Marples wrote:
On 11/04/2018 16:28, Lukas Wunner wrote:
when resetting a USB-attached Ethernet interface using the USBDEVFS_RESET
ioctl(), the interface briefly disappears, then reappears.  This results
in add and remove uevents from both the kernel and udevd.

If those uevents are interleaved as
     kernel remove
     kernel add
     udevd remove
     udevd add
then dhcpcd fails to assign addresses on reappearance of the interface.

If on the other hand the uevents are ordered as
     kernel remove
     udevd remove
     kernel add
     udevd add
then everything works as expected.

Adding --nodev on the command line or nodev to dhcpcd.conf makes the
issue go away.

Detailed debug logs are available at
https://github.com/RPi-Distro/repo/issues/102

Does this patch help?

Indeed this fixes the issue, I was able to carry out 30 consecutive
USB bus reset and dhcpcd always brought up the interface correctly,
regardless of uevent ordering.  Thanks a lot!

(The patch was mangled, probably because of copypasta or Thunderbird,
I'm attaching a fixed up version in case anyone else wants to test it,
this applies cleanly with --fuzz=0 to current master.)

Committed here:
https://roy.marples.name/git/dhcpcd.git/commit/?id=cd3ab837c5449d6638eae9bd686dee513a47b677

Thanks for testing!

Roy

References:
Race between kernel and udevd ueventsLukas Wunner
Re: Race between kernel and udevd ueventsRoy Marples
Re: Race between kernel and udevd ueventsLukas Wunner
Archive administrator: postmaster@marples.name