#include <linux/timer.h>
#include <linux/signal.h>
#include <linux/sched.h>
+#include <linux/kthread.h>
#include <linux/miscdevice.h>
#include <libcfs/linux/portals_compat25.h>
typedef wait_queue_head_t cfs_waitq_t;
typedef long cfs_task_state_t;
+#define cfs_kthread_run(fn, data, fmt, arg...) kthread_run(fn, data, fmt, ##arg)
+
/* Kernel thread */
typedef int (*cfs_thread_t)(void *);
#define cfs_sigfillset(l) do {} while (0)
#define cfs_recalc_sigpending(l) do {} while (0)
#define cfs_kernel_thread(l,m,n) LBUG()
+#define cfs_kthread_run(fn,d,fmt,...) LBUG()
#ifdef HAVE_LIBPTHREAD
typedef int (*cfs_thread_t)(void *);
int libcfs_debug_dumplog_thread(void *arg)
{
- cfs_daemonize("");
libcfs_debug_dumplog_internal(arg);
cfs_waitq_signal(&debug_ctlwq);
return 0;
void libcfs_debug_dumplog(void)
{
- int rc;
cfs_waitlink_t wait;
+ cfs_task_t *dumper;
ENTRY;
/* we're being careful to ensure that the kernel thread is
set_current_state(TASK_INTERRUPTIBLE);
cfs_waitq_add(&debug_ctlwq, &wait);
- rc = cfs_kernel_thread(libcfs_debug_dumplog_thread,
- (void *)(long_ptr_t)cfs_curproc_pid(),
- CLONE_VM | CLONE_FS | CLONE_FILES);
- if (rc < 0)
+ dumper = cfs_kthread_run(libcfs_debug_dumplog_thread,
+ (void*)(long)cfs_curproc_pid(),
+ "libcfs_debug_dumper");
+ if (IS_ERR(dumper))
printk(KERN_ERR "LustreError: cannot start log dump thread: "
- "%d\n", rc);
+ "%ld\n", PTR_ERR(dumper));
else
cfs_waitq_wait(&wait, CFS_TASK_INTERRUPTIBLE);
lli->lli_async_rc = 0;
rc = ll_md_close(sbi->ll_md_exp, inode, file);
+
+ if (OBD_FAIL_TIMEOUT_MS(OBD_FAIL_PTLRPC_DUMP_LOG, obd_fail_val))
+ libcfs_debug_dumplog();
+
RETURN(rc);
}
}
run_test 170 "test lctl df to handle corrupted log ====================="
+test_171() { # bug20592
+#define OBD_FAIL_PTLRPC_DUMP_LOG 0x50e
+ $LCTL set_param fail_loc=0x50e
+ $LCTL set_param fail_val=3000
+ multiop_bg_pause $DIR/$tfile Os || true
+ # cause log dump
+ sleep 3
+ if dmesg | grep "recursive fault"; then
+ error "caught a recursive fault"
+ fi
+ $LCTL set_param fail_loc=0
+ true
+}
+run_test 171 "test libcfs_debug_dumplog_thread stuck in do_exit() ======"
+
# it would be good to share it with obdfilter-survey/libecho code
setup_obdecho_osc () {
local rc=0