patch-2.1.88 linux/drivers/scsi/sr.c
Next file: linux/drivers/sgi/char/sgiserial.c
Previous file: linux/drivers/scsi/sd.c
Back to the patch index
Back to the overall index
- Lines: 90
- Date:
Fri Feb 20 18:28:22 1998
- Orig file:
v2.1.87/linux/drivers/scsi/sr.c
- Orig date:
Tue Feb 17 13:12:47 1998
diff -u --recursive --new-file v2.1.87/linux/drivers/scsi/sr.c linux/drivers/scsi/sr.c
@@ -32,7 +32,6 @@
#include <linux/errno.h>
#include <linux/cdrom.h>
#include <linux/interrupt.h>
-#include <linux/config.h>
#include <asm/system.h>
#include <asm/io.h>
@@ -432,10 +431,10 @@
int flag = 0;
while (1==1){
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&io_request_lock, flags);
+
if (CURRENT != NULL && CURRENT->rq_status == RQ_INACTIVE) {
- restore_flags(flags);
+ spin_unlock_irqrestore(&io_request_lock, flags);
return;
};
@@ -451,6 +450,7 @@
*/
if( SDev->host->in_recovery )
{
+ spin_unlock_irqrestore(&io_request_lock, flags);
return;
}
@@ -469,7 +469,11 @@
*/
if( SDev->removable && !in_interrupt() )
{
+ spin_unlock_irqrestore(&io_request_lock, flags);
scsi_ioctl(SDev, SCSI_IOCTL_DOORLOCK, 0);
+ /* scsi_ioctl may allow CURRENT to change, so start over. *
+ SDev->was_reset = 0;
+ continue;
}
SDev->was_reset = 0;
}
@@ -489,7 +493,7 @@
SCpnt = scsi_allocate_device(&CURRENT,
scsi_CDs[DEVICE_NR(CURRENT->rq_dev)].device, 0);
else SCpnt = NULL;
- restore_flags(flags);
+ spin_unlock_irqrestore(&io_request_lock, flags);
/* This is a performance enhancement. We dig down into the request list and
* try to find a queueable request (i.e. device not busy, and host able to
@@ -501,8 +505,7 @@
if (!SCpnt && sr_template.nr_dev > 1){
struct request *req1;
req1 = NULL;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&io_request_lock, flags);
req = CURRENT;
while(req){
SCpnt = scsi_request_queueable(req,
@@ -510,15 +513,15 @@
if(SCpnt) break;
req1 = req;
req = req->next;
- };
+ }
if (SCpnt && req->rq_status == RQ_INACTIVE) {
if (req == CURRENT)
CURRENT = CURRENT->next;
else
req1->next = req->next;
- };
- restore_flags(flags);
- };
+ }
+ spin_unlock_irqrestore(&io_request_lock, flags);
+ }
if (!SCpnt)
return; /* Could not find anything to do */
@@ -527,7 +530,7 @@
/* Queue command */
requeue_sr_request(SCpnt);
- }; /* While */
+ } /* While */
}
void requeue_sr_request (Scsi_Cmnd * SCpnt)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov