patch-2.1.96 linux/drivers/scsi/scsi_ioctl.c

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

diff -u --recursive --new-file v2.1.95/linux/drivers/scsi/scsi_ioctl.c linux/drivers/scsi/scsi_ioctl.c
@@ -96,6 +96,7 @@
 
 static int ioctl_internal_command(Scsi_Device *dev, char * cmd)
 {
+    unsigned long flags;
     int result;
     Scsi_Cmnd * SCpnt;
     Scsi_Device * SDpnt;
@@ -105,9 +106,11 @@
     {
 	struct semaphore sem = MUTEX_LOCKED;
 	SCpnt->request.sem = &sem;
+	spin_lock_irqsave(&io_request_lock, flags);
 	scsi_do_cmd(SCpnt,  cmd, NULL,  0,
 		    scsi_ioctl_done,  MAX_TIMEOUT,
 		    MAX_RETRIES);
+	spin_unlock_irqrestore(&io_request_lock, flags);
 	down(&sem);
         SCpnt->request.sem = NULL;
     }
@@ -166,6 +169,7 @@
  */
 static int ioctl_command(Scsi_Device *dev, Scsi_Ioctl_Command *sic)
 {
+    unsigned long flags;
     char * buf;
     unsigned char cmd[12]; 
     char * cmd_in;
@@ -271,8 +275,10 @@
     {
 	struct semaphore sem = MUTEX_LOCKED;
 	SCpnt->request.sem = &sem;
+	spin_lock_irqsave(&io_request_lock, flags);
 	scsi_do_cmd(SCpnt,  cmd,  buf, needed,  scsi_ioctl_done,
 		    timeout, retries);
+	spin_unlock_irqrestore(&io_request_lock, flags);
 	down(&sem);
         SCpnt->request.sem = NULL;
     }
@@ -405,6 +411,8 @@
 	return ioctl_internal_command((Scsi_Device *) dev, scsi_cmd);
 	break;
     default :           
+	if (dev->host->hostt->ioctl)
+		return dev->host->hostt->ioctl(dev, cmd, arg);
 	return -EINVAL;
     }
     return -EINVAL;

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