linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 8/11] aacraid: Re-start helper thread if it dies
@ 2006-03-27 17:44 Mark Haverkamp
  0 siblings, 0 replies; only message in thread
From: Mark Haverkamp @ 2006-03-27 17:44 UTC (permalink / raw)
  To: James Bottomley; +Cc: Mark Salyzyn, linux-scsi

Received from Mark Salyzyn

Since the helper thread for the driver can be killed unceremoniously by
an application, we detect the loss of the helper and restart it.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
---
Applies to the scsi-misc-2.6 git tree.

--- scsi-misc-aac.orig/drivers/scsi/aacraid/commctrl.c	2006-03-22 12:44:52.000000000 -0800
+++ scsi-misc-aac/drivers/scsi/aacraid/commctrl.c	2006-03-22 12:47:35.000000000 -0800
@@ -38,6 +38,8 @@
 #include <linux/completion.h>
 #include <linux/dma-mapping.h>
 #include <linux/blkdev.h>
+#include <linux/delay.h>
+#include <linux/kthread.h>
 #include <asm/semaphore.h>
 #include <asm/uaccess.h>
 
@@ -293,6 +295,16 @@
 		status = 0;
 	} else {
 		spin_unlock_irqrestore(&dev->fib_lock, flags);
+		/* If someone killed the AIF aacraid thread, restart it */
+		status = !dev->aif_thread;
+		if (status && dev->queues && dev->fsa_dev) {
+			/* Be paranoid, be very paranoid! */
+			kthread_stop(dev->thread);
+			ssleep(1);
+			dev->aif_thread = 0;
+			dev->thread = kthread_run(aac_command_thread, dev, dev->name);
+			ssleep(1);
+		}
 		if (f.wait) {
 			if(down_interruptible(&fibctx->wait_sem) < 0) {
 				status = -EINTR;

-- 
Mark Haverkamp <markh@osdl.org>


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-03-27 17:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-27 17:44 [PATCH 8/11] aacraid: Re-start helper thread if it dies Mark Haverkamp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).