linux_old1/drivers/s390/scsi
Martin Peschke d79ff14262 [SCSI] zfcp: fix lock imbalance by reworking request queue locking
This patch adds wait_event_interruptible_lock_irq_timeout(), which is a
straight-forward descendant of wait_event_interruptible_timeout() and
wait_event_interruptible_lock_irq().

The zfcp driver used to call wait_event_interruptible_timeout()
in combination with some intricate and error-prone locking. Using
wait_event_interruptible_lock_irq_timeout() as a replacement
nicely cleans up that locking.

This rework removes a situation that resulted in a locking imbalance
in zfcp_qdio_sbal_get():

BUG: workqueue leaked lock or atomic: events/1/0xffffff00/10
    last function: zfcp_fc_wka_port_offline+0x0/0xa0 [zfcp]

It was introduced by commit c2af7545aa
"[SCSI] zfcp: Do not wait for SBALs on stopped queue", which had a new
code path related to ZFCP_STATUS_ADAPTER_QDIOUP that took an early exit
without a required lock being held. The problem occured when a
special, non-SCSI I/O request was being submitted in process context,
when the adapter's queues had been torn down. In this case the bug
surfaced when the Fibre Channel port connection for a well-known address
was closed during a concurrent adapter shut-down procedure, which is a
rare constellation.

This patch also fixes these warnings from the sparse tool (make C=1):

drivers/s390/scsi/zfcp_qdio.c:224:12: warning: context imbalance in
 'zfcp_qdio_sbal_check' - wrong count at exit
drivers/s390/scsi/zfcp_qdio.c:244:5: warning: context imbalance in
 'zfcp_qdio_sbal_get' - unexpected unlock

Last but not least, we get rid of that crappy lock-unlock-lock
sequence at the beginning of the critical section.

It is okay to call zfcp_erp_adapter_reopen() with req_q_lock held.

Reported-by: Mikulas Patocka <mpatocka@redhat.com>
Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Peschke <mpeschke@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org #2.6.35+
Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-08-22 08:53:30 -07:00
..
Makefile [SCSI] zfcp: remove access control tables interface 2013-05-31 16:32:38 -07:00
zfcp_aux.c [SCSI] zfcp: status read buffers on first adapter open with link down 2013-05-31 16:32:38 -07:00
zfcp_ccw.c [SCSI] zfcp: remove access control tables interface 2013-05-31 16:32:38 -07:00
zfcp_dbf.c [SCSI] zfcp: module parameter dbflevel for early debugging 2013-05-31 16:32:38 -07:00
zfcp_dbf.h [SCSI] zfcp: Do not wakeup while suspended 2012-09-24 12:11:01 +04:00
zfcp_def.h [SCSI] zfcp: remove access control tables interface 2013-05-31 16:32:38 -07:00
zfcp_erp.c [SCSI] zfcp: remove access control tables interface 2013-05-31 16:32:38 -07:00
zfcp_ext.h [SCSI] zfcp: remove access control tables interface 2013-05-31 16:32:38 -07:00
zfcp_fc.c [SCSI] zfcp: cleanup port sysfs attribute usage 2013-05-31 16:32:36 -07:00
zfcp_fc.h s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
zfcp_fsf.c [SCSI] zfcp: status read buffers on first adapter open with link down 2013-05-31 16:32:38 -07:00
zfcp_fsf.h [SCSI] zfcp: remove access control tables interface 2013-05-31 16:32:38 -07:00
zfcp_qdio.c [SCSI] zfcp: fix lock imbalance by reworking request queue locking 2013-08-22 08:53:30 -07:00
zfcp_qdio.h s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
zfcp_reqlist.h s390/comments: unify copyright messages and remove file names 2012-07-20 11:15:04 +02:00
zfcp_scsi.c [SCSI] zfcp: block queue limits with data router 2013-05-31 16:32:37 -07:00
zfcp_sysfs.c [SCSI] zfcp: remove access control tables interface 2013-05-31 16:32:38 -07:00
zfcp_unit.c [SCSI] zfcp: cleanup unit sysfs attribute usage 2013-05-31 16:32:37 -07:00