aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2016-09-13 04:58:48 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2016-09-14 13:19:15 -0400
commit3e3f5a8a0f03e5af8a243f6b04cb007068481358 (patch)
tree2330613954349d3d074f5dcbde398affaf07ec2a
parent4086eae52beab7808b8aa1a9f7d4095eebc247c7 (diff)
scsi: csiostor: Fix completion usage
The (re)initializing of the completion object should be done before we trigger the transfer. Doing this after triggering the hardware opens up a race window. Without the timeout we would problaly even deadlock. Use also reinit_completion because we initalize the whole data structure in csio_scscim_init(). There is only one waiter for the completion, therefore there is no need to use complete_all(). Let's make that clear by using complete() instead of complete_all(). The usage pattern of the completion is: waiter context waker context csio_eh_abort_handler() reinit_completion() wait_for_completion_timeout() csio_scsi_err_handler() complete() [mkp: fix typo] Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/csiostor/csio_scsi.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
index c2a6f9f29427..89a52b941ea8 100644
--- a/drivers/scsi/csiostor/csio_scsi.c
+++ b/drivers/scsi/csiostor/csio_scsi.c
@@ -1721,7 +1721,7 @@ out:
1721 1721
1722 /* Wake up waiting threads */ 1722 /* Wake up waiting threads */
1723 csio_scsi_cmnd(req) = NULL; 1723 csio_scsi_cmnd(req) = NULL;
1724 complete_all(&req->cmplobj); 1724 complete(&req->cmplobj);
1725} 1725}
1726 1726
1727/* 1727/*
@@ -1945,6 +1945,7 @@ csio_eh_abort_handler(struct scsi_cmnd *cmnd)
1945 ready = csio_is_lnode_ready(ln); 1945 ready = csio_is_lnode_ready(ln);
1946 tmo = CSIO_SCSI_ABRT_TMO_MS; 1946 tmo = CSIO_SCSI_ABRT_TMO_MS;
1947 1947
1948 reinit_completion(&ioreq->cmplobj);
1948 spin_lock_irq(&hw->lock); 1949 spin_lock_irq(&hw->lock);
1949 rv = csio_do_abrt_cls(hw, ioreq, (ready ? SCSI_ABORT : SCSI_CLOSE)); 1950 rv = csio_do_abrt_cls(hw, ioreq, (ready ? SCSI_ABORT : SCSI_CLOSE));
1950 spin_unlock_irq(&hw->lock); 1951 spin_unlock_irq(&hw->lock);
@@ -1964,8 +1965,6 @@ csio_eh_abort_handler(struct scsi_cmnd *cmnd)
1964 goto inval_scmnd; 1965 goto inval_scmnd;
1965 } 1966 }
1966 1967
1967 /* Wait for completion */
1968 init_completion(&ioreq->cmplobj);
1969 wait_for_completion_timeout(&ioreq->cmplobj, msecs_to_jiffies(tmo)); 1968 wait_for_completion_timeout(&ioreq->cmplobj, msecs_to_jiffies(tmo));
1970 1969
1971 /* FW didnt respond to abort within our timeout */ 1970 /* FW didnt respond to abort within our timeout */