Skip to content
Commit bbb08767 authored by Ahmed S. Darwish's avatar Ahmed S. Darwish Committed by Martin K. Petersen
Browse files

scsi: target: core: Remove in_interrupt() check in transport_handle_cdb_direct()

transport_handle_cdb_direct() uses in_interrupt() to detect if it is safe
to sleep. It produces a stack trace and returns with an error which is
clearly for debugging.

The usage of in_interrupt() in drivers is phased out and Linus clearly
requested that code which changes behaviour depending on context should
either be separated or the context be conveyed in an argument passed by the
caller, which usually knows the context.

transport_handle_cdb_direct() has a comment saying that it may only be
invoked from process context. It invokes transport_generic_new_cmd() which
performs GFP_KERNEL memory allocations. in_interrupt() does not detect all
the contexts where it is invalid to sleep (for the blocking GFP_KERNEL
allocation) as it fails to detect sections with disabled preemption.

Replace the in_interrupt() based check with a might_sleep() annotation.

Link: https://lore.kernel.org/r/20201220203638.43615-7-bigeasy@linutronix.de


Signed-off-by: default avatarAhmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 513e2994
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment