From: Mark Haverkamp Date: Mon, 27 Mar 2006 17:44:26 +0000 (-0800) Subject: [SCSI] aacraid: Re-start helper thread if it dies X-Git-Tag: v2.6.17-rc2~30^2~33 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=dc4adbf41385486b0c73e7382ce73f0e8b873243;p=linux-2.6-omap-h63xx.git [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 Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c index 47fefca7269..9f75144e524 100644 --- a/drivers/scsi/aacraid/commctrl.c +++ b/drivers/scsi/aacraid/commctrl.c @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include #include @@ -293,6 +295,16 @@ return_fib: 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;