ub: Tune retries
authorPete Zaitcev <zaitcev@redhat.com>
Sat, 19 Apr 2008 21:35:30 +0000 (14:35 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 2 May 2008 17:25:52 +0000 (10:25 -0700)
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>
drivers/block/ub.c

index b87ad77e5bb5522ddd5726467275d5ad77e3e5b5..5c6a6e89d2fbceac4077214867a78189bae37ced 100644 (file)
@@ -792,10 +792,6 @@ static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
                        scsi_status = 0;
                } else {
                        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;
                        } else {
                                scsi_status = 0;
@@ -811,7 +807,10 @@ static void ub_rw_cmd_done(struct ub_dev *sc, struct ub_scsi_cmd *cmd)
                        else
                                scsi_status = DID_ERROR << 16;
                } 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)
                                        return;
                        }