From 26357306f93b37fab77621f3ac4ec5796a7fdea5 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 4 Dec 2015 10:41:54 -0800 Subject: [PATCH] scst: Fix a runtime warning WARNING: CPU: 5 PID: 20857 at kernel/sched/core.c:7533 __might_sleep+0x82/0x90() do not call blocking ops when !TASK_RUNNING; state=2 set at [] prepare_to_wait_event+0x63/0x110 CPU: 5 PID: 20857 Comm: rmmod Tainted: G OE 4.4.0-rc3+ #1 Call Trace: [] dump_stack+0x4f/0x74 [] warn_slowpath_common+0x8b/0xd0 [] warn_slowpath_fmt+0x41/0x70 [] __might_sleep+0x82/0x90 [] mutex_lock_nested+0x33/0x380 [] test_sess_list+0x1a/0x40 [scst] [] scst_unregister_target+0x36a/0x380 [scst] [] srpt_remove_one+0xb1/0x150 [ib_srpt] [] ib_unregister_client+0xe5/0x190 [ib_core] [] srpt_cleanup_module+0x26/0x34 [ib_srpt] [] SyS_delete_module+0x17b/0x1c0 [] entry_SYSCALL_64_fastpath+0x12/0x6f Signed-off-by: Bart Van Assche --- scst/src/scst_main.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index ac2d9dca2..26e1a5648 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -593,16 +593,6 @@ out_free_tgt: } EXPORT_SYMBOL(scst_register_target); -static inline int test_sess_list(struct scst_tgt *tgt) -{ - int res; - - mutex_lock(&scst_mutex); - res = list_empty(&tgt->sysfs_sess_list); - mutex_unlock(&scst_mutex); - return res; -} - /** * scst_unregister_target() - unregister target. * @@ -656,7 +646,7 @@ again: #endif TRACE_DBG("%s", "Waiting for sessions shutdown"); - wait_event(tgt->unreg_waitQ, test_sess_list(tgt)); + wait_event(tgt->unreg_waitQ, list_empty(&tgt->sysfs_sess_list)); TRACE_DBG("%s", "wait_event() returned"); scst_suspend_activity(SCST_SUSPEND_TIMEOUT_UNLIMITED);