ub: Tune retries

Make ub to fail faster in hopeless cases.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Pete Zaitcev 2008-04-19 14:35:30 -07:00 committed by Greg Kroah-Hartman
parent 2c51ae70ed
commit 82fe26ba7a
1 changed files with 4 additions and 5 deletions

View File

@ -792,10 +792,6 @@ static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
scsi_status = 0; scsi_status = 0;
} else { } else {
if (cmd->act_len != cmd->len) { if (cmd->act_len != cmd->len) {
if ((cmd->key == MEDIUM_ERROR ||
cmd->key == UNIT_ATTENTION) &&
ub_rw_cmd_retry(sc, lun, urq, cmd) == 0)
return;
scsi_status = SAM_STAT_CHECK_CONDITION; scsi_status = SAM_STAT_CHECK_CONDITION;
} else { } else {
scsi_status = 0; scsi_status = 0;
@ -811,7 +807,10 @@ static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
else else
scsi_status = DID_ERROR << 16; scsi_status = DID_ERROR << 16;
} else { } else {
if (cmd->error == -EIO) { if (cmd->error == -EIO &&
(cmd->key == 0 ||
cmd->key == MEDIUM_ERROR ||
cmd->key == UNIT_ATTENTION)) {
if (ub_rw_cmd_retry(sc, lun, urq, cmd) == 0) if (ub_rw_cmd_retry(sc, lun, urq, cmd) == 0)
return; return;
} }