Commit ba1724202aafed4bbc4a239ac6fb433f454fddea
Committed by
James Bottomley
1 parent
3f0ca62add
Exists in
master
and in
7 other branches
[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 <christof.schmitt@de.ibm.com> Signed-off-by: Martin Peschke <mp3@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Showing 2 changed files with 10 additions and 5 deletions Side-by-side Diff
drivers/s390/scsi/zfcp_fsf.c
... | ... | @@ -3593,6 +3593,12 @@ |
3593 | 3593 | goto failed_req_create; |
3594 | 3594 | } |
3595 | 3595 | |
3596 | + if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, | |
3597 | + &unit->status))) { | |
3598 | + retval = -EBUSY; | |
3599 | + goto unit_blocked; | |
3600 | + } | |
3601 | + | |
3596 | 3602 | zfcp_unit_get(unit); |
3597 | 3603 | fsf_req->unit = unit; |
3598 | 3604 | |
... | ... | @@ -3733,6 +3739,7 @@ |
3733 | 3739 | send_failed: |
3734 | 3740 | no_fit: |
3735 | 3741 | failed_scsi_cmnd: |
3742 | + unit_blocked: | |
3736 | 3743 | zfcp_unit_put(unit); |
3737 | 3744 | zfcp_fsf_req_free(fsf_req); |
3738 | 3745 | fsf_req = NULL; |
drivers/s390/scsi/zfcp_scsi.c
... | ... | @@ -258,8 +258,9 @@ |
258 | 258 | goto out; |
259 | 259 | } |
260 | 260 | |
261 | - if (unlikely( | |
262 | - !atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &unit->status))) { | |
261 | + tmp = zfcp_fsf_send_fcp_command_task(adapter, unit, scpnt, use_timer, | |
262 | + ZFCP_REQ_AUTO_CLEANUP); | |
263 | + if (unlikely(tmp == -EBUSY)) { | |
263 | 264 | ZFCP_LOG_DEBUG("adapter %s not ready or unit 0x%016Lx " |
264 | 265 | "on port 0x%016Lx in recovery\n", |
265 | 266 | zfcp_get_busid_by_unit(unit), |
... | ... | @@ -267,9 +268,6 @@ |
267 | 268 | zfcp_scsi_command_fail(scpnt, DID_NO_CONNECT); |
268 | 269 | goto out; |
269 | 270 | } |
270 | - | |
271 | - tmp = zfcp_fsf_send_fcp_command_task(adapter, unit, scpnt, use_timer, | |
272 | - ZFCP_REQ_AUTO_CLEANUP); | |
273 | 271 | |
274 | 272 | if (unlikely(tmp < 0)) { |
275 | 273 | ZFCP_LOG_DEBUG("error: initiation of Send FCP Cmnd failed\n"); |