changeset 12306:0e05f150080c

6940761 pathological tape drive prevented boot
author David Major <David.Major@Oracle.COM>
date Tue, 04 May 2010 13:48:52 -0600
parents 2b466624c73b
children eed67f0e6b33
files usr/src/uts/common/io/scsi/targets/st.c
diffstat 1 files changed, 28 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/scsi/targets/st.c	Tue May 04 12:40:22 2010 -0700
+++ b/usr/src/uts/common/io/scsi/targets/st.c	Tue May 04 13:48:52 2010 -0600
@@ -20,8 +20,7 @@
  */
 
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ *  Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
@@ -9962,6 +9961,15 @@
 
 	ASSERT(mutex_owned(ST_MUTEX));
 
+	/* prevent infinite number of retries */
+	if (rinfo->pkt_retry_cnt++ > st_retry_count) {
+		ST_RECOV(ST_DEVINFO, st_label, CE_NOTE,
+		    "Recovery stopped for incomplete %s command, "
+		    "retries exhausted",
+		    st_print_scsi_cmd(pkt->pkt_cdbp[0]));
+		return (COMMAND_DONE_ERROR);
+	}
+
 	switch (pkt->pkt_reason) {
 	case CMD_INCOMPLETE:	/* tran stopped with not normal state */
 		/*
@@ -10072,29 +10080,24 @@
 	}
 
 
-	if (rinfo->pkt_retry_cnt++ < st_retry_count) {
-		if (un->un_pwr_mgmt == ST_PWR_SUSPENDED) {
-			rval = QUE_COMMAND;
-		} else if (bp == un->un_sbufp) {
-			if (rinfo->privatelen == sizeof (recov_info)) {
-				if (rinfo->cmd_attrib->retriable) {
-					/*
-					 * These commands can be rerun
-					 * with impunity
-					 */
-					rval = QUE_COMMAND;
-				}
-			} else {
-				cmd_attribute const *attrib;
-				attrib =
-				    st_lookup_cmd_attribute(pkt->pkt_cdbp[0]);
-				if (attrib->retriable) {
-					rval = QUE_COMMAND;
-				}
-			}
-		}
-	} else {
-		rval = COMMAND_DONE_ERROR;
+	if (un->un_pwr_mgmt == ST_PWR_SUSPENDED) {
+		rval = QUE_COMMAND;
+	} else if (bp == un->un_sbufp) {
+		if (rinfo->privatelen == sizeof (recov_info)) {
+			if (rinfo->cmd_attrib->retriable) {
+				/*
+				 * These commands can be rerun
+				 * with impunity
+				 */
+				rval = QUE_COMMAND;
+			}
+		} else {
+			cmd_attribute const *attrib;
+			attrib = st_lookup_cmd_attribute(pkt->pkt_cdbp[0]);
+			if (attrib->retriable) {
+				rval = QUE_COMMAND;
+			}
+		}
 	}
 
 	if (un->un_state >= ST_STATE_OPEN) {