Skip to content

Commit

Permalink
[SCSI] aacraid: Re-start helper thread if it dies
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mark Haverkamp authored and James Bottomley committed Apr 13, 2006
1 parent 1241f35 commit dc4adbf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/scsi/aacraid/commctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -293,6 +295,16 @@ static int next_getadapter_fib(struct aac_dev * dev, void __user *arg)
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;
Expand Down

0 comments on commit dc4adbf

Please sign in to comment.