OSDN Git Service

scsi: hisi_sas: Fix the conflict between dev gone and host reset
authorXiaofei Tan <tanxiaofei@huawei.com>
Thu, 31 May 2018 12:50:44 +0000 (20:50 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 20 Jun 2018 02:02:25 +0000 (22:02 -0400)
commitd2fc401e47529d9ffd2673a5395d56002e31ad98
tree056e3e902949753f3285df6b1e6ab14e1c445716
parent1324ae1ce55927622b531cc3123387c0fe05244d
scsi: hisi_sas: Fix the conflict between dev gone and host reset

There is a possible conflict when a device is removed and host reset occurs
concurrently.

The reason is that then the device is notified as gone, we try to clear the
ITCT, which is notified via an interrupt. The dev gone function pends on
this event with a completion, which is completed when the ITCT interrupt
occurs.

But host reset will disable all interrupts, the wait_for_completion() may
wait indefinitely.

This patch adds an semaphore to synchronise this two processes. The
semaphore is taken by the host reset as the basis of synchronising.

Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hisi_sas/hisi_sas.h
drivers/scsi/hisi_sas/hisi_sas_main.c