Re: [PATCH v2 03/14] NTB: ntb_transport: Avoid deadlock when cancelling link work
From: Logan Gunthorpe
Date: Tue Sep 15 2026 - 14:31:27 EST
On 2026-09-09 22:08, Koichiro Den wrote:
> During initial link setup, ntb_transport_link_work() can retry with
> nt->link_is_up still false. A retry can block on link_event_lock
> while cleanup holds it and waits in cancel_delayed_work_sync(),
> leading to deadlock.
>
> Move the conditional cancellation outside link_event_lock, before
> QP cleanup. Keep QP cleanup and MW release under the lock so link
> work cannot restart QPs between them. Put the locking in
> ntb_transport_link_cleanup() to cover both worker and remove paths.
>
> Fixes: 3db835dd8f9a ("ntb: Add mutex to make link_event_callback executed linearly.")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Koichiro Den <den@xxxxxxxxxxxxx>
Even with the ordering issue discussed, I think this is an improvement
worth doing:
Reviewed-by: Logan Gunthorpe <logang@xxxxxxxxxxxx>