scsi: core: Release SCSI devices synchronously
Hello Bart Van Assche,
The patch f93ed747e2c7: "scsi: core: Release SCSI devices synchronously" from Oct 14, 2022, leads to the following three Smatch static checker warnings:
1) drivers/scsi/bfa/bfad_bsg.c:2551 bfad_iocmd_lunmask_reset_lunscan_mode() warn: sleeping in atomic context
bfad_iocmd_lunmask() <- disables preempt
-> bfad_iocmd_lunmask_reset_lunscan_mode()
-> scsi_device_put()
(This is inside the calls to bfad_reset_sdev_bflags() macro).
2) drivers/scsi/device_handler/scsi_dh_alua.c:853 alua_rtpg_select_sdev() warn: sleeping in atomic context
alua_rtpg_work() <- disables preempt
-> alua_rtpg_select_sdev()
-> scsi_device_put()
3) drivers/scsi/device_handler/scsi_dh_alua.c:1013 alua_rtpg_queue() warn: sleeping in atomic context
alua_check_vpd() <- disables preempt
-> alua_rtpg_queue()
-> scsi_device_put()
Hopefully, this bug report is straight forward. The fixes are probably complicated though. :P Basically the function marked "disables preempt" takes a spin lock and calls the other function which calls scsi_device_put().
regards,
dan carpenter
Quoted 22 lines · Dan Carpenter
Hello Bart Van Assche,
The patch
f93ed747e2c7: "scsi: core: Release SCSI devices synchronously" from Oct 14, 2022, leads to the following three Smatch static checker warnings:1)
drivers/scsi/bfa/bfad_bsg.c:2551bfad_iocmd_lunmask_reset_lunscan_mode()warn: sleeping in atomic context
bfad_iocmd_lunmask()<- disables preempt
->bfad_iocmd_lunmask_reset_lunscan_mode()-> scsi_device_put()(This is inside the calls to
bfad_reset_sdev_bflags()macro).2)
drivers/scsi/device_handler/scsi_dh_alua.c:853alua_rtpg_select_sdev()warn: sleeping in atomic context
alua_rtpg_work()<- disables preempt
->alua_rtpg_select_sdev()-> scsi_device_put()3)
drivers/scsi/device_handler/scsi_dh_alua.c:1013alua_rtpg_queue()warn: sleeping in atomic context
Quoted 8 lines
alua_check_vpd()<- disables preempt
->alua_rtpg_queue()-> scsi_device_put()Hopefully, this bug report is straight forward. The fixes are probably complicated though. :P Basically the function marked "disables preempt" takes a spin lock and calls the other function which calls
scsi_device_put().
Thanks Dan for the detailed report. I plan to post fixes for these issues soon.
Bart.