patch-2.3.35 linux/drivers/scsi/scsi_error.c

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

diff -u --recursive --new-file v2.3.34/linux/drivers/scsi/scsi_error.c linux/drivers/scsi/scsi_error.c
@@ -1778,6 +1778,17 @@
 	for (SCpnt = SCdone; SCpnt != NULL; SCpnt = SCdone) {
 		SCdone = SCpnt->bh_next;
 		SCpnt->bh_next = NULL;
+                /*
+                 * Oh, this is a vile hack.  scsi_done() expects a timer
+                 * to be running on the command.  If there isn't, it assumes
+                 * that the command has actually timed out, and a timer
+                 * handler is running.  That may well be how we got into
+                 * this fix, but right now things are stable.  We add
+                 * a timer back again so that we can report completion.
+                 * scsi_done() will immediately remove said timer from
+                 * the command, and then process it.
+                 */
+		scsi_add_timer(SCpnt, 100, scsi_eh_times_out);
 		scsi_done(SCpnt);
 	}
 
@@ -1809,7 +1820,14 @@
 	int rtn;
 	DECLARE_MUTEX_LOCKED(sem);
 
+        /*
+         * We only listen to signals if the HA was loaded as a module.
+         * If the HA was compiled into the kernel, then we don't listen
+         * to any signals.
+         */
+        if( host->loaded_as_module ) {
 	siginitsetinv(&current->blocked, SHUTDOWN_SIGS);
+        }
 
 	lock_kernel();
 
@@ -1844,10 +1862,14 @@
 		 * trying to unload a module.
 		 */
 		SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler sleeping\n"));
+                if( host->loaded_as_module ) {
 		down_interruptible(&sem);
 
 		if (signal_pending(current))
 			break;
+                } else {
+                        down(&sem);
+                }
 
 		SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler waking up\n"));
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)