* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2012, 2014, Intel Corporation.
+ * Copyright (c) 2012, 2017, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#include <libcfs/libcfs.h>
#include "tracefile.h"
+#ifndef WITH_WATCHDOG
+#define WITH_WATCHDOG
+#endif
+
struct lc_watchdog {
spinlock_t lcw_lock; /* check or change lcw_list */
int lcw_refcount; /* must hold lcw_pending_timers_lock */
EXIT;
}
-static void lcw_cb(uintptr_t data)
+static void lcw_cb(cfs_timer_cb_arg_t data)
{
- struct lc_watchdog *lcw = (struct lc_watchdog *)data;
+ struct lc_watchdog *lcw = cfs_from_timer(lcw, data, lcw_timer);
ENTRY;
if (lcw->lcw_state != LC_WATCHDOG_ENABLED) {
timediff = ktime_to_timespec64(ktime_sub(ktime_get(),
lcw->lcw_last_touched));
+
+ /* LU-9235: Don't dump stack if the thread is just touched. */
+ if (timediff.tv_sec == 0)
+ return;
+
/*
* Check to see if we should throttle the watchdog timer to avoid
* too many dumps going to the console thus triggering an NMI.
wake_up(&lcw_event_waitq);
wait_for_completion(&lcw_stop_completion);
+ clear_bit(LCW_FLAG_STOP, &lcw_flags);
CDEBUG(D_INFO, "watchdog dispatcher has shut down.\n");
lcw->lcw_state = LC_WATCHDOG_DISABLED;
INIT_LIST_HEAD(&lcw->lcw_list);
- setup_timer(&lcw->lcw_timer, lcw_cb, (unsigned long)lcw);
+ cfs_timer_setup(&lcw->lcw_timer, lcw_cb, (unsigned long)lcw, 0);
mutex_lock(&lcw_refcount_mutex);
if (++lcw_refcount == 1)