From 95fe66fbebeb82f13ce87057e66424203bacd3c9 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 24 Feb 2017 07:07:41 +0000 Subject: [PATCH] scst: Fix locking annotations Avoid that the following warnings are triggered: WARNING: CPU: 5 PID: 32343 at scst/src/scst_copy_mgr.c:2741 scst_cm_on_add_acg+0x12d/0x180 [scst] Call Trace: [] dump_stack+0x86/0xc3 [] __warn+0xcb/0xf0 [] warn_slowpath_null+0x1d/0x20 [] scst_cm_on_add_acg+0x12d/0x180 [scst] [] scst_alloc_add_acg+0xc4/0x280 [scst] [] scst_register_target+0x190/0x3a0 [scst] [] scst_cm_init+0xb8/0xdda [scst] [] init_scst+0xa06/0xc3f [scst] [] do_one_initcall+0x3d/0x160 [] do_init_module+0x5f/0x1f1 [] load_module+0x2719/0x2a50 [] SYSC_finit_module+0xbc/0xf0 [] SyS_finit_module+0xe/0x10 [] entry_SYSCALL_64_fastpath+0x23/0xc1 WARNING: CPU: 2 PID: 12885 at scst/src/scst_copy_mgr.c:2826 scst_cm_check_access_acg+0x180/0x1e0 [scst] Call Trace: [] dump_stack+0x86/0xc3 [] __warn+0xcb/0xf0 [] warn_slowpath_null+0x1d/0x20 [] scst_cm_check_access_acg+0x180/0x1e0 [scst] [] scst_cm_check_access+0x15a/0x280 [scst] [] scst_cm_parse_id_tgt_descr+0x2eb/0x590 [scst] [] scst_cm_parse_descriptors+0x308/0xa60 [scst] [] scst_parse_descriptors+0x60/0x130 [scst] [] scst_tgt_pre_exec+0x375/0x4a0 [scst] [] scst_process_active_cmd+0x439/0x740 [scst] [] scst_cmd_thread+0x202/0x6a0 [scst] [] kthread+0xef/0x110 [] ret_from_fork+0x1f/0x40 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7097 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_copy_mgr.c | 3 +-- scst/src/scst_lib.c | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scst/src/scst_copy_mgr.c b/scst/src/scst_copy_mgr.c index 5c9ce1345..3127dddea 100644 --- a/scst/src/scst_copy_mgr.c +++ b/scst/src/scst_copy_mgr.c @@ -2738,7 +2738,6 @@ int scst_cm_on_add_acg(struct scst_acg *acg) TRACE_ENTRY(); - scst_assert_activity_suspended(); lockdep_assert_held(&scst_mutex); if (scst_cm_tgt == NULL) @@ -2824,7 +2823,7 @@ static bool scst_cm_check_access_acg(const char *initiator_name, TRACE_ENTRY(); scst_assert_activity_suspended(); - lockdep_assert_held(&scst_mutex); + lockdep_assert_held(&scst_mutex2); list_for_each_entry(acg_dev, &acg->acg_dev_list, acg_dev_list_entry) { if (acg_dev->dev == dev) { diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index a35fbfd04..93783445e 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -4590,7 +4590,6 @@ out: return res; } -/* The activity supposed to be suspended and scst_mutex held */ int scst_alloc_add_acg(struct scst_tgt *tgt, const char *acg_name, bool tgt_acg, struct scst_acg **out_acg) { @@ -4599,6 +4598,8 @@ int scst_alloc_add_acg(struct scst_tgt *tgt, const char *acg_name, TRACE_ENTRY(); + lockdep_assert_held(&scst_mutex); + acg = kzalloc(sizeof(*acg), GFP_KERNEL); if (acg == NULL) { PRINT_ERROR("%s", "Allocation of acg failed");