Cancellations in debugfs
Cancellations in debugfs
Posted Sep 23, 2025 7:23 UTC (Tue) by benzea (subscriber, #96937)Parent article: Revocable references for transient devices
That reminds me of the debugfs file removal race conditions we had in cfg80211. To solve those, we added the debugfs_enter_cancellation()/debugfs_leave_cancellation() API. The idea there is to have a callback that permits notifying the user asynchronously that the resource (the debugfs file in this case) is being removed and any outstanding file operation need to be cancelled ASAP.
In the cfg80211 case, the user file operations are handled by queuing a work item that will then hold the wiphy mutex. However, if the debugfs file is removed before it runs, then the work item is simply cancelled so that the file removal can go ahead immediately.
It does not look to me like this API can easily be used for this debugfs use in cfg80211. That is probably fine, but it could still be an interesting usage scenario to look at.
