On Sat, Apr 09, 2022 at 03:10:14PM -0400, Douglas Gilbert wrote: > On 2022-04-09 00:37, Bart Van Assche wrote: > > Revert the patch mentioned in the subject since it blocks I/O after > > module unload has started while this is a legitimate use case. For e.g. > > blktests test case srp/001 that patch causes a command timeout to be > > triggered for the following call stack: > > > > __schedule+0x4c3/0xd20 > > schedule+0x82/0x110 > > schedule_timeout+0x122/0x200 > > io_schedule_timeout+0x7b/0xc0 > > __wait_for_common+0x2bc/0x380 > > wait_for_completion_io_timeout+0x1d/0x20 > > blk_execute_rq+0x1db/0x200 > > __scsi_execute+0x1fb/0x310 > > sd_sync_cache+0x155/0x2c0 [sd_mod] > > sd_shutdown+0xbb/0x190 [sd_mod] > > sd_remove+0x5b/0x80 [sd_mod] > > device_remove+0x9a/0xb0 > > device_release_driver_internal+0x2c5/0x360 > > device_release_driver+0x12/0x20 > > bus_remove_device+0x1aa/0x270 > > device_del+0x2d4/0x640 > > __scsi_remove_device+0x168/0x1a0 > > scsi_forget_host+0xa8/0xb0 > > scsi_remove_host+0x9b/0x150 > > sdebug_driver_remove+0x3d/0x140 [scsi_debug] > > device_remove+0x6f/0xb0 > > device_release_driver_internal+0x2c5/0x360 > > device_release_driver+0x12/0x20 > > bus_remove_device+0x1aa/0x270 > > device_del+0x2d4/0x640 > > device_unregister+0x18/0x70 > > sdebug_do_remove_host+0x138/0x180 [scsi_debug] > > scsi_debug_exit+0x45/0xd5 [scsi_debug] > > __do_sys_delete_module.constprop.0+0x210/0x320 > > __x64_sys_delete_module+0x1f/0x30 > > do_syscall_64+0x35/0x80 > > entry_SYSCALL_64_after_hwframe+0x44/0xae > > > > Reported-by: Yi Zhang <yi.zhang@xxxxxxxxxx> > > Cc: Douglas Gilbert <dgilbert@xxxxxxxxxxxx> > > Cc: Yi Zhang <yi.zhang@xxxxxxxxxx> > > Cc: Bob Pearson <rpearsonhpe@xxxxxxxxx> > > Fixes: 2aad3cd85370 ("scsi: scsi_debug: Address races following module load"; ) > > Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx> > > Acked-by: Douglas Gilbert <dgilbert@xxxxxxxxxxxx> > > This was a relatively old patch developed in conjunction with Luis Chamberlain > <mcgrof@xxxxxxxxxx>. So it may have been overtaken by other developments. > I forwarded the "[bug report][bisected] modprob -r scsi-debug take more than > 3mins during blktests srp/ tests" email to Luis but haven't heard back. So I'm > happy to remove it. Upstream patient module removal inside kmod will help and is the right thing to do all around. However modules can also strive to make the removal painless too. How much work a module does to make it painless is up to its authors. In lieu of kmod patient module removal, users of the module should be aware of these issue though and open code it as I have in fstests [0] as an example. Note that kmod patient module removal is not yet merged but soon will be. [0] https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git/commit/?id=d405c21d40aa1f0ca846dd144a1a7731e55679b2 Luis