rescan causes offlined tape to reload

Matthew Jacob mj at feral.com
Sun Jan 23 05:54:17 UTC 2011


On 1/20/2011 2:33 PM, G. Paul Ziemba wrote:

The basic gist of the error is that during the probe sequence a command 
is likely coming back with ASC 0x04 ASCQ 0x02 (Logical unit not ready, 
initializing command required).

Unfortunately, this causes camperiphscsisenseerror to issue 
scsi_start_stop command. Why this did not occur before I am a little 
baffled about because the same code was in place in the time frame you 
had it 'working'.

See if the attached patch helps
-------------- next part --------------
Index: sys/cam/cam_periph.c
===================================================================
--- sys/cam/cam_periph.c	(revision 217716)
+++ sys/cam/cam_periph.c	(working copy)
@@ -1525,36 +1525,43 @@
 			*action_string = "Unretryable error";
 			break;
 		case SS_START:
-		{
-			int le;
+			if (SID_TYPE(&cgd.inq_data) != T_SEQUENTIAL) {
+				int le;
 
-			/*
-			 * Send a start unit command to the device, and
-			 * then retry the command.
-			 */
-			*action_string = "Attempting to start unit";
-			periph->flags |= CAM_PERIPH_RECOVERY_INPROG;
+				/*
+				 * Send a start unit command to the device, and
+				 * then retry the command.
+				 */
+				*action_string = "Attempting to start unit";
+				periph->flags |= CAM_PERIPH_RECOVERY_INPROG;
 
-			/*
-			 * Check for removable media and set
-			 * load/eject flag appropriately.
-			 */
-			if (SID_IS_REMOVABLE(&cgd.inq_data))
-				le = TRUE;
-			else
-				le = FALSE;
+				/*
+				 * Check for removable media and set
+				 * load/eject flag appropriately.
+				 */
+				if (SID_IS_REMOVABLE(&cgd.inq_data))
+					le = TRUE;
+				else
+					le = FALSE;
 
-			scsi_start_stop(&ccb->csio,
-					/*retries*/1,
-					camperiphdone,
-					MSG_SIMPLE_Q_TAG,
-					/*start*/TRUE,
-					/*load/eject*/le,
-					/*immediate*/FALSE,
-					SSD_FULL_SIZE,
-					/*timeout*/50000);
+				scsi_start_stop(&ccb->csio,
+						/*retries*/1,
+						camperiphdone,
+						MSG_SIMPLE_Q_TAG,
+						/*start*/TRUE,
+						/*load/eject*/le,
+						/*immediate*/FALSE,
+						SSD_FULL_SIZE,
+						/*timeout*/50000);
+			} else {
+				xpt_free_ccb(orig_ccb);
+				ccb->ccb_h.status |= CAM_DEV_QFRZN;
+				*action_string = "Will not autostart a "
+				    "sequential access device";
+				err_action = SS_FAIL;
+				error = EIO;
+			}
 			break;
-		}
 		case SS_TUR:
 		{
 			/*


More information about the freebsd-scsi mailing list