scsi: ufs: fix task abort due to req timeout on UFS card after removal
In card removal handler, we firstly complete all the tasks reside in host's
HW queue, then remove all the scsi devices, during which scsi layer shall
flush all the requests reside in the SW queues of these scsi devices and
return only after the queues are clean. Since the UFS card is offline, UFS
driver returns DID_BAD_TARGET to scsi layer when it tries to queue any
requests into host's HW queue. Then scsi layer returns SUCCESS to its upper
layer when it sees DID_BAD_TARGET. In this way, all the requests reside in
these SW queues can be drained clean. However, when scsi layer is draining
these SW queues, if the UFS card is inserted back online, remaining
requests in the queues shall be queued into the host's HW queue. Because
the host is already stopped by now, these requests could not be served,
thus timed out and abort happens. This change add a field to track the UFS
card removal progress. If the card is inserted back before the removal is
done, we bail out without update the card's state. We may lost one or two
insertion event(s) in the case of repeatedly aggressive hot-plug while
heavy read/write access is ongoing, but it does no harm to the stability.
Change-Id: I0972269e7f546f021fc0cdf33f7e442ac4f8a1c5
Signed-off-by:
Can Guo <cang@codeaurora.org>
Loading
Please register or sign in to comment