From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754739AbcFTWEE (ORCPT ); Mon, 20 Jun 2016 18:04:04 -0400 Received: from linuxhacker.ru ([217.76.32.60]:53006 "EHLO fiona.linuxhacker.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753094AbcFTWDo (ORCPT ); Mon, 20 Jun 2016 18:03:44 -0400 From: Oleg Drokin To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger Cc: Linux Kernel Mailing List , Lustre Development List , Oleg Drokin Subject: [PATCH v2 28/29] staging/lustre/libcfs: Do not call kthread_run in wrong state Date: Mon, 20 Jun 2016 16:55:51 -0400 Message-Id: <1466456152-2199975-29-git-send-email-green@linuxhacker.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1466456152-2199975-1-git-send-email-green@linuxhacker.ru> References: <1466456152-2199975-1-git-send-email-green@linuxhacker.ru> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org kthread_run might sleep during an allocation, and so it's considered unsafe to call with a state that's not RUNNABLE. Move the state setting to after kthread_run call. Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lnet/libcfs/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/libcfs/debug.c b/drivers/staging/lustre/lnet/libcfs/debug.c index 75a2a42..42b15a7 100644 --- a/drivers/staging/lustre/lnet/libcfs/debug.c +++ b/drivers/staging/lustre/lnet/libcfs/debug.c @@ -362,12 +362,12 @@ void libcfs_debug_dumplog(void) * get to schedule() */ init_waitqueue_entry(&wait, current); - set_current_state(TASK_INTERRUPTIBLE); add_wait_queue(&debug_ctlwq, &wait); dumper = kthread_run(libcfs_debug_dumplog_thread, (void *)(long)current_pid(), "libcfs_debug_dumper"); + set_current_state(TASK_INTERRUPTIBLE); if (IS_ERR(dumper)) pr_err("LustreError: cannot start log dump thread: %ld\n", PTR_ERR(dumper)); -- 2.7.4