/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
lcw_dump(struct lc_watchdog *lcw)
{
ENTRY;
-#if defined(HAVE_TASKLIST_LOCK)
- read_lock(&tasklist_lock);
-#else
rcu_read_lock();
-#endif
if (lcw->lcw_task == NULL) {
LCONSOLE_WARN("Process " LPPID " was not found in the task "
"list; watchdog callback may be incomplete\n",
libcfs_debug_dumpstack(lcw->lcw_task);
}
-#if defined(HAVE_TASKLIST_LOCK)
- read_unlock(&tasklist_lock);
-#else
rcu_read_unlock();
-#endif
EXIT;
}
static int lcw_dispatch_main(void *data)
{
int rc = 0;
- unsigned long flags;
struct lc_watchdog *lcw;
CFS_LIST_HEAD (zombies);
ENTRY;
- cfs_daemonize("lc_watchdogd");
-
- SIGNAL_MASK_LOCK(current, flags);
- sigfillset(¤t->blocked);
- RECALC_SIGPENDING;
- SIGNAL_MASK_UNLOCK(current, flags);
-
complete(&lcw_start_completion);
while (1) {
int dumplog = 1;
- cfs_wait_event_interruptible(lcw_event_waitq,
- is_watchdog_fired(), rc);
+ rc = wait_event_interruptible(lcw_event_waitq,
+ is_watchdog_fired());
CDEBUG(D_INFO, "Watchdog got woken up...\n");
if (test_bit(LCW_FLAG_STOP, &lcw_flags)) {
CDEBUG(D_INFO, "LCW_FLAG_STOP set, shutting down...\n");
static void lcw_dispatch_start(void)
{
- int rc;
+ cfs_task_t *task;
ENTRY;
LASSERT(lcw_refcount == 1);
init_completion(&lcw_start_completion);
cfs_waitq_init(&lcw_event_waitq);
- CDEBUG(D_INFO, "starting dispatch thread\n");
- rc = cfs_create_thread(lcw_dispatch_main, NULL, 0);
- if (rc < 0) {
- CERROR("error spawning watchdog dispatch thread: %d\n", rc);
- EXIT;
- return;
- }
+ CDEBUG(D_INFO, "starting dispatch thread\n");
+ task = kthread_run(lcw_dispatch_main, NULL, "lc_watchdogd");
+ if (IS_ERR(task)) {
+ CERROR("error spawning watchdog dispatch thread: %ld\n",
+ PTR_ERR(task));
+ EXIT;
+ return;
+ }
wait_for_completion(&lcw_start_completion);
CDEBUG(D_INFO, "watchdog dispatcher initialization complete.\n");