ソースを参照

[SCSI] aacraid: Re-start helper thread if it dies

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>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Mark Haverkamp 20 年 前
コミット
dc4adbf413
1 ファイル変更12 行追加0 行削除
  1. 12 0
      drivers/scsi/aacraid/commctrl.c

+ 12 - 0
drivers/scsi/aacraid/commctrl.c

@@ -38,6 +38,8 @@
 #include <linux/completion.h>
 #include <linux/completion.h>
 #include <linux/dma-mapping.h>
 #include <linux/dma-mapping.h>
 #include <linux/blkdev.h>
 #include <linux/blkdev.h>
+#include <linux/delay.h>
+#include <linux/kthread.h>
 #include <asm/semaphore.h>
 #include <asm/semaphore.h>
 #include <asm/uaccess.h>
 #include <asm/uaccess.h>
 
 
@@ -293,6 +295,16 @@ return_fib:
 		status = 0;
 		status = 0;
 	} else {
 	} else {
 		spin_unlock_irqrestore(&dev->fib_lock, flags);
 		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 (f.wait) {
 			if(down_interruptible(&fibctx->wait_sem) < 0) {
 			if(down_interruptible(&fibctx->wait_sem) < 0) {
 				status = -EINTR;
 				status = -EINTR;