On Tue, Oct 21, 2025 at 09:15:36AM -0300, Jason Gunthorpe wrote:
On Tue, Oct 21, 2025 at 04:49:59AM +0000, Tzung-Bi Shih wrote:
I didn't get the idea. With a mutex, how to handle the opening files?
Are they something like: (?)
- Maintain a list for opening files in both .open() and .release().
- In misc_deregister_sync(), traverse the list, do something (what?), and wait for the userspace programs close the files.
You don't need any list, we don't want to close files.
Something like this, it is very simple. You can replace the rwsem with a srcu. srcu gives faster read locking but much slower sync.
[...]
I see. The idea is basically the same but don't use revocable at all.
I was misunderstanding about the "sync" we were discussing for misc_deregister_sync(). The "sync", is analogous to synchronize_srcu() of revocable_provider_revoke() in the revocable version [1], doesn't wait for closing all opened files.
[1] https://lore.kernel.org/chrome-platform/aPT-7TTgW_Xop99j@tzungbi-laptop/