aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_error.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2005-09-06 08:04:26 -0400
committerJames Bottomley <jejb@mulgrave.(none)>2005-09-06 18:26:06 -0400
commitc5478def7a3a2dba9ceda452c2aa3539514d30a9 (patch)
treef007c87094d1fa3fede0cb10a665ecbaf1814223 /drivers/scsi/scsi_error.c
parent32993523dc59759ae6cb349e4d231d4cd2165329 (diff)
[SCSI] switch EH thread startup to the kthread API
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_error.c')
-rw-r--r--drivers/scsi/scsi_error.c29
1 files changed, 2 insertions, 27 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 688bce740786..ebe74ccb518a 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -20,6 +20,7 @@
20#include <linux/string.h> 20#include <linux/string.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/kthread.h>
23#include <linux/interrupt.h> 24#include <linux/interrupt.h>
24#include <linux/blkdev.h> 25#include <linux/blkdev.h>
25#include <linux/delay.h> 26#include <linux/delay.h>
@@ -1585,16 +1586,8 @@ int scsi_error_handler(void *data)
1585 int rtn; 1586 int rtn;
1586 DECLARE_MUTEX_LOCKED(sem); 1587 DECLARE_MUTEX_LOCKED(sem);
1587 1588
1588 /*
1589 * Flush resources
1590 */
1591
1592 daemonize("scsi_eh_%d", shost->host_no);
1593
1594 current->flags |= PF_NOFREEZE; 1589 current->flags |= PF_NOFREEZE;
1595
1596 shost->eh_wait = &sem; 1590 shost->eh_wait = &sem;
1597 shost->ehandler = current;
1598 1591
1599 /* 1592 /*
1600 * Wake up the thread that created us. 1593 * Wake up the thread that created us.
@@ -1602,8 +1595,6 @@ int scsi_error_handler(void *data)
1602 SCSI_LOG_ERROR_RECOVERY(3, printk("Wake up parent of" 1595 SCSI_LOG_ERROR_RECOVERY(3, printk("Wake up parent of"
1603 " scsi_eh_%d\n",shost->host_no)); 1596 " scsi_eh_%d\n",shost->host_no));
1604 1597
1605 complete(shost->eh_notify);
1606
1607 while (1) { 1598 while (1) {
1608 /* 1599 /*
1609 * If we get a signal, it means we are supposed to go 1600 * If we get a signal, it means we are supposed to go
@@ -1624,7 +1615,7 @@ int scsi_error_handler(void *data)
1624 * semaphores isn't unreasonable. 1615 * semaphores isn't unreasonable.
1625 */ 1616 */
1626 down_interruptible(&sem); 1617 down_interruptible(&sem);
1627 if (shost->eh_kill) 1618 if (kthread_should_stop())
1628 break; 1619 break;
1629 1620
1630 SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler" 1621 SCSI_LOG_ERROR_RECOVERY(1, printk("Error handler"
@@ -1663,22 +1654,6 @@ int scsi_error_handler(void *data)
1663 * Make sure that nobody tries to wake us up again. 1654 * Make sure that nobody tries to wake us up again.
1664 */ 1655 */
1665 shost->eh_wait = NULL; 1656 shost->eh_wait = NULL;
1666
1667 /*
1668 * Knock this down too. From this point on, the host is flying
1669 * without a pilot. If this is because the module is being unloaded,
1670 * that's fine. If the user sent a signal to this thing, we are
1671 * potentially in real danger.
1672 */
1673 shost->eh_active = 0;
1674 shost->ehandler = NULL;
1675
1676 /*
1677 * If anyone is waiting for us to exit (i.e. someone trying to unload
1678 * a driver), then wake up that process to let them know we are on
1679 * the way out the door.
1680 */
1681 complete_and_exit(shost->eh_notify, 0);
1682 return 0; 1657 return 0;
1683} 1658}
1684 1659