aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristof Schmitt <christof.schmitt@de.ibm.com>2007-12-20 06:30:27 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-11 19:29:07 -0500
commitfdf234527a070f6fc89f3ec5ee4ae1b263e59939 (patch)
treead2b5c44584d1add3519887a8a8aef74f85fa922
parentba1724202aafed4bbc4a239ac6fb433f454fddea (diff)
[SCSI] zfcp: Hold queue lock when checking port/unit handle for task management cmd
We need to hold the queue-lock when checking whether we still have a valid unit/port handle for the task management command, i.e whether we can issue this request for this unit/port. If the error recovery is about to close this unit/port, then it competes for the queue-lock. If the close request issued by the error recovery wins, then it is guaranteed that this unit/port has been blocked for other requests. Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 17c251cb10aa..fe57941ab55d 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -3774,6 +3774,10 @@ zfcp_fsf_send_fcp_command_task_management(struct zfcp_adapter *adapter,
3774 goto out; 3774 goto out;
3775 } 3775 }
3776 3776
3777 if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED,
3778 &unit->status)))
3779 goto unit_blocked;
3780
3777 /* 3781 /*
3778 * Used to decide on proper handler in the return path, 3782 * Used to decide on proper handler in the return path,
3779 * could be either zfcp_fsf_send_fcp_command_task_handler or 3783 * could be either zfcp_fsf_send_fcp_command_task_handler or
@@ -3807,25 +3811,13 @@ zfcp_fsf_send_fcp_command_task_management(struct zfcp_adapter *adapter,
3807 3811
3808 zfcp_fsf_start_timer(fsf_req, ZFCP_SCSI_ER_TIMEOUT); 3812 zfcp_fsf_start_timer(fsf_req, ZFCP_SCSI_ER_TIMEOUT);
3809 retval = zfcp_fsf_req_send(fsf_req); 3813 retval = zfcp_fsf_req_send(fsf_req);
3810 if (retval) { 3814 if (!retval)
3811 ZFCP_LOG_INFO("error: Could not send an FCP-command (task "
3812 "management) on adapter %s, port 0x%016Lx for "
3813 "unit LUN 0x%016Lx\n",
3814 zfcp_get_busid_by_adapter(adapter),
3815 unit->port->wwpn,
3816 unit->fcp_lun);
3817 zfcp_fsf_req_free(fsf_req);
3818 fsf_req = NULL;
3819 goto out; 3815 goto out;
3820 }
3821 3816
3822 ZFCP_LOG_TRACE("Send FCP Command (task management function) initiated " 3817 unit_blocked:
3823 "(adapter %s, port 0x%016Lx, unit 0x%016Lx, " 3818 zfcp_fsf_req_free(fsf_req);
3824 "tm_flags=0x%x)\n", 3819 fsf_req = NULL;
3825 zfcp_get_busid_by_adapter(adapter), 3820
3826 unit->port->wwpn,
3827 unit->fcp_lun,
3828 tm_flags);
3829 out: 3821 out:
3830 write_unlock_irqrestore(&adapter->request_queue.queue_lock, lock_flags); 3822 write_unlock_irqrestore(&adapter->request_queue.queue_lock, lock_flags);
3831 return fsf_req; 3823 return fsf_req;