patch-2.1.76 linux/drivers/scsi/st.c

Next file: linux/drivers/sound/.blurb
Previous file: linux/drivers/scsi/ncr53c8xx.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.75/linux/drivers/scsi/st.c linux/drivers/scsi/st.c
@@ -995,7 +995,6 @@
       return -ENXIO;
     }
 
-    STp = &(scsi_tapes[dev]);
     if (STp->ready != ST_READY) {
       if (STp->ready == ST_NO_TAPE)
 	return (-ENOMEDIUM);
@@ -1510,7 +1509,6 @@
       return -ENXIO;
     }
 
-    STp = &(scsi_tapes[dev]);
     if (STp->ready != ST_READY) {
       if (STp->ready == ST_NO_TAPE)
 	return (-ENOMEDIUM);
@@ -2298,10 +2296,9 @@
 
    ioctl_result = (STp->buffer)->last_result_fatal;
 
-   scsi_release_command(SCpnt);
-   SCpnt = NULL;
-
    if (!ioctl_result) {  /* SCSI command successful */
+     scsi_release_command(SCpnt);
+     SCpnt = NULL;
      STps->drv_block = blkno;
      STps->drv_file = fileno;
      STps->at_sm = at_sm;
@@ -2349,7 +2346,8 @@
        STp->partition = 0;
      }
 
-   } else {  /* SCSI command was not completely successful */
+   } else {  /* SCSI command was not completely successful. Don't return
+	        from this block without releasing the SCSI command block! */
 
      if (SCpnt->sense_buffer[2] & 0x40) {
        if (cmd_in != MTBSF && cmd_in != MTBSFM &&
@@ -2430,6 +2428,9 @@
 
      if (cmd_in == MTLOCK)
        STp->door_locked = ST_LOCK_FAILS;
+
+     scsi_release_command(SCpnt);
+     SCpnt = NULL;
    }
 
    return ioctl_result;
@@ -2591,7 +2592,6 @@
     if (!SCpnt)
       return (-EBUSY);
 
-    SCpnt->request.rq_status = RQ_INACTIVE;  /* Mark as not busy */
     STps->drv_block = STps->drv_file = (-1);
     STps->eof = ST_NOEOF;
     if ((STp->buffer)->last_result_fatal != 0) {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov