HomeFreeBSD

cxgbe(4): Avoid hang on kldunload on netlink enabled kernels.

Description

cxgbe(4): Avoid hang on kldunload on netlink enabled kernels.

netlink(4) calls back into the driver during detach and it attempts to
start an internal synchronized op recursively, causing an interruptible
hang. Fix it by failing the ioctl if the VI has been marked as DOOMED
by cxgbe_detach.

Here's the stack for the hang for reference.
#6 begin_synchronized_op
#7 cxgbe_media_status
#8 ifmedia_ioctl
#9 cxgbe_ioctl
#10 if_ioctl
#11 get_operstate_ether
#12 get_operstate
#13 dump_iface
#14 rtnl_handle_ifevent
#15 rtnl_handle_ifnet_event
#16 rt_ifmsg
#17 if_unroute
#18 if_down
#19 if_detach_internal
#20 if_detach
#21 ether_ifdetach
#22 cxgbe_vi_detach
#23 cxgbe_detach
#24 DEVICE_DETACH

MFC after: 3 days
Sponsored by: Chelsio Communications

(cherry picked from commit 3814249f1e8dacfcd326dd7c416c528a1d88b6a1)

Details

Provenance
npAuthored on Sep 5 2023, 6:21 PM
Parents
rGa72a0af8194e: mana: add lro and tso stat counters
Branches
Unknown
Tags
Unknown