Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ba1724202aafed4bbc4a239ac6fb433f454fddea
Commit:     ba1724202aafed4bbc4a239ac6fb433f454fddea
Parent:     3f0ca62add34010241db682e63bb68ba765bf4a9
Author:     Christof Schmitt <[EMAIL PROTECTED]>
AuthorDate: Thu Dec 20 12:30:26 2007 +0100
Committer:  James Bottomley <[EMAIL PROTECTED]>
CommitDate: Fri Jan 11 18:29:06 2008 -0600

    [SCSI] zfcp: Hold queue lock when checking port/unit handle for FCP command
    
    We need to hold the queue-lock when checking whether we still have a valid
    unit/port handle for the FCP 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 <[EMAIL PROTECTED]>
    Signed-off-by: Martin Peschke <[EMAIL PROTECTED]>
    Signed-off-by: James Bottomley <[EMAIL PROTECTED]>
---
 drivers/s390/scsi/zfcp_fsf.c  |    7 +++++++
 drivers/s390/scsi/zfcp_scsi.c |    8 +++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 908e8b2..17c251c 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -3593,6 +3593,12 @@ zfcp_fsf_send_fcp_command_task(struct zfcp_adapter 
*adapter,
                goto failed_req_create;
        }
 
+       if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED,
+                       &unit->status))) {
+               retval = -EBUSY;
+               goto unit_blocked;
+       }
+
        zfcp_unit_get(unit);
        fsf_req->unit = unit;
 
@@ -3733,6 +3739,7 @@ zfcp_fsf_send_fcp_command_task(struct zfcp_adapter 
*adapter,
  send_failed:
  no_fit:
  failed_scsi_cmnd:
+ unit_blocked:
        zfcp_unit_put(unit);
        zfcp_fsf_req_free(fsf_req);
        fsf_req = NULL;
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 3298fd3..b9daf5c 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -258,8 +258,9 @@ zfcp_scsi_command_async(struct zfcp_adapter *adapter, 
struct zfcp_unit *unit,
                goto out;
        }
 
-       if (unlikely(
-            !atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &unit->status))) {
+       tmp = zfcp_fsf_send_fcp_command_task(adapter, unit, scpnt, use_timer,
+                                            ZFCP_REQ_AUTO_CLEANUP);
+       if (unlikely(tmp == -EBUSY)) {
                ZFCP_LOG_DEBUG("adapter %s not ready or unit 0x%016Lx "
                               "on port 0x%016Lx in recovery\n",
                               zfcp_get_busid_by_unit(unit),
@@ -268,9 +269,6 @@ zfcp_scsi_command_async(struct zfcp_adapter *adapter, 
struct zfcp_unit *unit,
                goto out;
        }
 
-       tmp = zfcp_fsf_send_fcp_command_task(adapter, unit, scpnt, use_timer,
-                                            ZFCP_REQ_AUTO_CLEANUP);
-
        if (unlikely(tmp < 0)) {
                ZFCP_LOG_DEBUG("error: initiation of Send FCP Cmnd failed\n");
                retval = SCSI_MLQUEUE_HOST_BUSY;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to