On 9/14/22 02:52, John Garry wrote:
On 13/09/2022 20:57, Bart Van Assche wrote:
- mod = sdev->host->hostt->module;
+ mod = sdev->drop_module_ref ? sdev->host->hostt->module : NULL;
I suppose that this works.
My reservation is that there were some concerns of current module
referencing solution, so may not be better to build directly on it:
https://lore.kernel.org/linux-scsi/Ynt0aFMX+z%2FUhGJ2@xxxxxxxxxxxxx/
Hi John,
The above link points at a reply from Christoph Hellwig with the
suggestion to use __module_get(). Implementing that suggestion would
require to modify the kernel module implementation. My conclusion from
reading the code in kernel/module/main.c is that increasing the module
reference count after unloading has started currently has no effect. I
have not found any code in the delete_module() system call
implementation that waits for the reference count to drop to zero after
try_stop_module() succeeded. I will look into this.
Thanks,
Bart.