Re: [PATCH 2/3] scsi: Avoid that .queuecommand() gets called for a quiesced SCSI device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/5/19 10:50 PM, Hannes Reinecke wrote:
On 6/5/19 10:14 PM, Bart Van Assche wrote:
Several SCSI transport and LLD drivers surround code that does not
tolerate concurrent calls of .queuecommand() with scsi_target_block() /
scsi_target_unblock(). These last two functions use
blk_mq_quiesce_queue() / blk_mq_unquiesce_queue() for scsi-mq request
queues to prevent concurrent .queuecommand() calls. However, that is
not sufficient to prevent .queuecommand() calls from scsi_send_eh_cmnd().
Hence surround the .queuecommand() call from the SCSI error handler with
code that avoids that .queuecommand() gets called in the quiesced state.

Note: converting the .queuecommand() call in scsi_send_eh_cmnd() into
code that calls blk_get_request() + blk_execute_rq() is not an option
since scsi_send_eh_cmnd() must be able to make forward progress even
if all requests have been allocated.

Hmm. Have you actually observed this?
Typically, scsi_target_block()/scsi_target_unblock() is called prior to
invoking EH, to allow the system to settle and to guarantee that it's
fully quiesced. Only then EH is started.
Consequently, scsi_target_block()/scsi_target_unblock() really shouldn't
be called during EH; we're essentially single-threaded at this point, so
nothing else will be submitting command.
Can you explain why you need this?

Hi Hannes,

As one can see in the commit message of patch 3/3, I have observed a .queuecommand() call by the SCSI EH causing a crash.

The SCSI EH and blocking of SCSI devices have different triggers:
- As one can see in scsi_times_out(), if a SCSI command times out and an abort has already been scheduled for that command then that command is handed over to the SCSI error handler. After all commands that are in progress have failed the error handler thread is woken up. - The iSCSI and SRP transport drivers call scsi_target_block() if a transport layer error has been observed. This can happen from another thread than the SCSI error handler thread and these functions can be called either before or after the SCSI error handler thread has been woken up.

Bart.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux