Skip to content

Commit

Permalink
[SCSI] libfc: Fix wrong scsi return status under FC_DATA_UNDRUN
Browse files Browse the repository at this point in the history
This bug is exposed when there is a link flap in LLD. Particularly, when it
happens right after a SCSI write command is sent out, no FCP_DATA is sent,
causing fsp->status_code to be set as FC_DATA_UNDRUN in fc_fcp_complete_locked
even no SCSI status is received. Consequently, fc_io_compl treats this as DID_OK.
This results in SCSI returning successful to the initial I/O request even
there is no DATA actually sent. Particularly, if you run an I/O tool w/ data
verification on, the read back for verification is gonna fail.

This is fixed here by checking when FC_DATA_UNDRUN happens, SCSI status is
received w/ FC_SRB_RCV_STATUS set in fsp->state.

Signed-off-by: Yi Zou <yi.zou@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
  • Loading branch information
Yi Zou authored and James Bottomley committed Dec 4, 2009
1 parent c340111 commit 4347fa6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/scsi/libfc/fc_fcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1849,7 +1849,8 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
* scsi status is good but transport level
* underrun.
*/
sc_cmd->result = DID_OK << 16;
sc_cmd->result = (fsp->state & FC_SRB_RCV_STATUS ?
DID_OK : DID_ERROR) << 16;
} else {
/*
* scsi got underrun, this is an error
Expand Down

0 comments on commit 4347fa6

Please sign in to comment.