[SCSI] zfcp: avoid false ERP complete due to sema race
authorSwen Schillig <swen@vnet.ibm.com>
Fri, 17 Apr 2009 13:08:06 +0000 (15:08 +0200)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Mon, 27 Apr 2009 15:07:28 +0000 (10:07 -0500)
commit94ab4b38b2ab35a8ca955f4821c970a0ed7ec9ec
tree78b0d65b56e48a4753f39d277a13030f6d8b77d9
parent828bc1212a685918bbdb5866504b63eea2c241f5
[SCSI] zfcp: avoid false ERP complete due to sema race

The ERP thread is performing a task before it is executing the
corresponding down on the semaphore. The response handler of the
just started exchange config should wait for the completion by
performing a down on this semaphore. Since this semaphore is still
positive from the ERP enqueue the handler won't wait and therefore
the exchange config will always fail leaving the adapter in error.
The problem can be solved by performing the down on the semaphore
before starting an ERP task. This is the logically correct order.
Only walk the ERP loop if there is a task to perform.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/s390/scsi/zfcp_erp.c