• Bart Van Assche's avatar
    Revert "scsi: scsi_debug: Address races following module load" · f19fe8f3
    Bart Van Assche authored
    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
    
    Link: https://lore.kernel.org/r/20220409043704.28573-1-bvanassche@acm.org
    Fixes: 2aad3cd8 ("scsi: scsi_debug: Address races following module load")
    Cc: Douglas Gilbert <dgilbert@interlog.com>
    Cc: Yi Zhang <yi.zhang@redhat.com>
    Cc: Bob Pearson <rpearsonhpe@gmail.com>
    Reported-by: default avatarYi Zhang <yi.zhang@redhat.com>
    Tested-by: default avatarYi Zhang <yi.zhang@redhat.com>
    Acked-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
    Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    f19fe8f3
scsi_debug.c 226 KB