Re: [PATCH] net: usbnet: allow overriding of default USB interface naming

Andrew Lunn
2021-06-14T12:24:06Z

> > > Userspace solutions include:
> > > 1. udev backing off and retrying in the event of a collision; or
> > > 2. avoiding ever renaming a device to a name in the "eth%d" namespace.
> >
> > Picking a different namespace does not cause a lack of collisions to
> > happen, you could have multiple usb network devices being found at the
> > same time, right?
> >
> > So no matter what, 1) has to happen.
>
> Within a namespace, the "%d" in "eth%d" means __dev_alloc_name finds a name
> that's not taken. I didn't check the locking but assume that can only happen
> serially, in which case two devices probed in parallel would not mutually
> collide.
>
> So I don't think it's necessarily true that 1) has to happen.

Say you changed the namespace to usb%d. And you want the device in USB
port 1.4 to be usb1 and the device in USB port 1.3 to be usb0. They
probe the other way around. You have the same problem, you need to
handle the race condition in udev, back off an try again.

As GregKH said, 1) has to happen.

Andrew