[SCSI] libfc: Return a valid return code in fc_fcp_pkt_abort()
Here ticks_left is added to record the result of wait_for_completion_timeout(). [ Patch title and description edited by Robert Love to make it more descriptive ] Signed-off-by: Hillf Danton <dhillf@gmail.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
This commit is contained in:
parent
f56635a869
commit
fa79dbdbdd
@ -1202,6 +1202,7 @@ static void fc_fcp_error(struct fc_fcp_pkt *fsp, struct fc_frame *fp)
|
|||||||
static int fc_fcp_pkt_abort(struct fc_fcp_pkt *fsp)
|
static int fc_fcp_pkt_abort(struct fc_fcp_pkt *fsp)
|
||||||
{
|
{
|
||||||
int rc = FAILED;
|
int rc = FAILED;
|
||||||
|
unsigned long ticks_left;
|
||||||
|
|
||||||
if (fc_fcp_send_abort(fsp))
|
if (fc_fcp_send_abort(fsp))
|
||||||
return FAILED;
|
return FAILED;
|
||||||
@ -1210,13 +1211,13 @@ static int fc_fcp_pkt_abort(struct fc_fcp_pkt *fsp)
|
|||||||
fsp->wait_for_comp = 1;
|
fsp->wait_for_comp = 1;
|
||||||
|
|
||||||
spin_unlock_bh(&fsp->scsi_pkt_lock);
|
spin_unlock_bh(&fsp->scsi_pkt_lock);
|
||||||
rc = wait_for_completion_timeout(&fsp->tm_done, FC_SCSI_TM_TOV);
|
ticks_left = wait_for_completion_timeout(&fsp->tm_done,
|
||||||
|
FC_SCSI_TM_TOV);
|
||||||
spin_lock_bh(&fsp->scsi_pkt_lock);
|
spin_lock_bh(&fsp->scsi_pkt_lock);
|
||||||
fsp->wait_for_comp = 0;
|
fsp->wait_for_comp = 0;
|
||||||
|
|
||||||
if (!rc) {
|
if (!ticks_left) {
|
||||||
FC_FCP_DBG(fsp, "target abort cmd failed\n");
|
FC_FCP_DBG(fsp, "target abort cmd failed\n");
|
||||||
rc = FAILED;
|
|
||||||
} else if (fsp->state & FC_SRB_ABORTED) {
|
} else if (fsp->state & FC_SRB_ABORTED) {
|
||||||
FC_FCP_DBG(fsp, "target abort cmd passed\n");
|
FC_FCP_DBG(fsp, "target abort cmd passed\n");
|
||||||
rc = SUCCESS;
|
rc = SUCCESS;
|
||||||
|
Loading…
Reference in New Issue
Block a user