Re: ordering of call to unbind() in usbnet_disconnect
From: Oliver Neukum <oneukum@suse.com>
Date: 2022-03-31 09:59:58
On 31.03.22 11:30, Lukas Wunner wrote:
I propose the below patch. If you could provide more details on the regressions you've reported (+ ideally bugzilla links), I'll be happy to include them in the commit message. Thanks!
There is no bugzilla, but the report can be found: https://lore.kernel.org/netdev/CAG48ez0MHBbENX5gCdHAUXZ7h7s20LnepBF-pa5M=7Bi-jZrEA@mail.gmail.com/ (local)
The commit made binding and unbinding of USB Ethernet asymmetrical: Before, usbnet_probe() first invoked the ->bind() callback and then register_netdev(). usbnet_disconnect() mirrored that by first invoking unregister_netdev() and then ->unbind(). Since the commit, the order in usbnet_disconnect() is reversed and no longer mirrors usbnet_probe(). One consequence is that a PHY disconnected (and stopped) in ->unbind() is afterwards stopped once more by unregister_netdev() as it closes the netdev before unregistering. That necessitates a contortion in ->stop() because the PHY may only be stopped if it hasn't already been disconnected. Reverting the commit allows making the call to phy_stop() unconditional in ->stop() and also fixes the issues reported by Oliver.
Very well, but what prevents reintroducing the isssue this revert's target was to fix? Regards Oliver