Re: [PATCH net v3] net: mana: fix reset work race with device removal

From: Fan Wu

Date: Tue Sep 22 2026 - 03:12:29 EST


Thanks - agreed, a lock shape reads better here, and v4 will use one.

To be clear about why it isn't a plain mutex: admission runs in hard IRQ
context (mana_gd_intr() -> mana_gd_process_eqe() ->
mana_schedule_serv_work()), and mana_gd_remove() can be entered on the
service work's own stack (its rescan exit calls
pci_stop_and_remove_bus_device()), so cancel_work_sync() is out and
remove() can only wait until the work has stopped touching gc, not for
it to finish. v4 expresses this with a small gc-embedded spinlock
(hardirq-safe, never held across sleeps) plus a waitqueue for the
drain, replacing the flag protocol.

v4 will also fix the two real issues the AI review flagged, which the
lock alone does not address:

- GC_REMOVING currently stays latched if a rescan exit bails out early
(no parent bus) without removing the device; v4 checks for that
before closing admission, so service is never permanently disabled
on a bound device.

- mana_gd_shutdown() now drains as well, since it tears down the same
hardware paths remove() does.