Bart Van Assche
d4023db711
scsi: qla2xxx: Avoid that lockdep complains about unsafe locking in tcm_qla2xxx_close_session()
...
This patch avoids that lockdep reports the following warning:
=====================================================
WARNING: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected
5.1.0-rc1-dbg+ #11 Tainted: G W
-----------------------------------------------------
rmdir/1478 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire:
00000000e7ac4607 (&(&k->k_lock)->rlock){+.+.}, at: klist_next+0x43/0x1d0
and this task is already holding:
00000000cf0baf5e (&(&ha->tgt.sess_lock)->rlock){-...}, at: tcm_qla2xxx_close_session+0x57/0xb0 [tcm_qla2xxx]
which would create a new lock dependency:
(&(&ha->tgt.sess_lock)->rlock){-...} -> (&(&k->k_lock)->rlock){+.+.}
but this new dependency connects a HARDIRQ-irq-safe lock:
(&(&ha->tgt.sess_lock)->rlock){-...}
... which became HARDIRQ-irq-safe at:
lock_acquire+0xe3/0x200
_raw_spin_lock_irqsave+0x3d/0x60
qla2x00_fcport_event_handler+0x1f3d/0x22b0 [qla2xxx]
qla2x00_async_login_sp_done+0x1dc/0x1f0 [qla2xxx]
qla24xx_process_response_queue+0xa37/0x10e0 [qla2xxx]
qla24xx_msix_rsp_q+0x79/0xf0 [qla2xxx]
__handle_irq_event_percpu+0x79/0x3c0
handle_irq_event_percpu+0x70/0xf0
handle_irq_event+0x5a/0x8b
handle_edge_irq+0x12c/0x310
handle_irq+0x192/0x20a
do_IRQ+0x73/0x160
ret_from_intr+0x0/0x1d
default_idle+0x23/0x1f0
arch_cpu_idle+0x15/0x20
default_idle_call+0x35/0x40
do_idle+0x2bb/0x2e0
cpu_startup_entry+0x1d/0x20
start_secondary+0x24d/0x2d0
secondary_startup_64+0xa4/0xb0
to a HARDIRQ-irq-unsafe lock:
(&(&k->k_lock)->rlock){+.+.}
... which became HARDIRQ-irq-unsafe at:
...
lock_acquire+0xe3/0x200
_raw_spin_lock+0x32/0x50
klist_add_tail+0x33/0xb0
device_add+0x7f4/0xb60
device_create_groups_vargs+0x11c/0x150
device_create_with_groups+0x89/0xb0
vtconsole_class_init+0xb2/0x124
do_one_initcall+0xc5/0x3ce
kernel_init_freeable+0x295/0x32e
kernel_init+0x11/0x11b
ret_from_fork+0x3a/0x50
other info that might help us debug this:
Possible interrupt unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&(&k->k_lock)->rlock);
local_irq_disable();
lock(&(&ha->tgt.sess_lock)->rlock);
lock(&(&k->k_lock)->rlock);
<Interrupt>
lock(&(&ha->tgt.sess_lock)->rlock);
*** DEADLOCK ***
4 locks held by rmdir/1478:
#0 : 000000002c7f1ba4 (sb_writers#10){.+.+}, at: mnt_want_write+0x32/0x70
#1 : 00000000c85eb147 (&default_group_class[depth - 1]#2/1){+.+.}, at: do_rmdir+0x217/0x2d0
#2 : 000000002b164d6f (&sb->s_type->i_mutex_key#13){++++}, at: vfs_rmdir+0x7e/0x1d0
#3 : 00000000cf0baf5e (&(&ha->tgt.sess_lock)->rlock){-...}, at: tcm_qla2xxx_close_session+0x57/0xb0 [tcm_qla2xxx]
the dependencies between HARDIRQ-irq-safe lock and the holding lock:
-> (&(&ha->tgt.sess_lock)->rlock){-...} ops: 127 {
IN-HARDIRQ-W at:
lock_acquire+0xe3/0x200
_raw_spin_lock_irqsave+0x3d/0x60
qla2x00_fcport_event_handler+0x1f3d/0x22b0 [qla2xxx]
qla2x00_async_login_sp_done+0x1dc/0x1f0 [qla2xxx]
qla24xx_process_response_queue+0xa37/0x10e0 [qla2xxx]
qla24xx_msix_rsp_q+0x79/0xf0 [qla2xxx]
__handle_irq_event_percpu+0x79/0x3c0
handle_irq_event_percpu+0x70/0xf0
handle_irq_event+0x5a/0x8b
handle_edge_irq+0x12c/0x310
handle_irq+0x192/0x20a
do_IRQ+0x73/0x160
ret_from_intr+0x0/0x1d
default_idle+0x23/0x1f0
arch_cpu_idle+0x15/0x20
default_idle_call+0x35/0x40
do_idle+0x2bb/0x2e0
cpu_startup_entry+0x1d/0x20
start_secondary+0x24d/0x2d0
secondary_startup_64+0xa4/0xb0
INITIAL USE at:
lock_acquire+0xe3/0x200
_raw_spin_lock_irqsave+0x3d/0x60
qla2x00_loop_resync+0xb3d/0x2690 [qla2xxx]
qla2x00_do_dpc+0xcee/0xf30 [qla2xxx]
kthread+0x1d2/0x1f0
ret_from_fork+0x3a/0x50
}
... key at: [<ffffffffa125f700>] __key.62804+0x0/0xfffffffffff7e900 [qla2xxx]
... acquired at:
__lock_acquire+0x11ed/0x1b60
lock_acquire+0xe3/0x200
_raw_spin_lock_irqsave+0x3d/0x60
klist_next+0x43/0x1d0
device_for_each_child+0x96/0x110
scsi_target_block+0x3c/0x40 [scsi_mod]
fc_remote_port_delete+0xe7/0x1c0 [scsi_transport_fc]
qla2x00_mark_device_lost+0x4d3/0x500 [qla2xxx]
qlt_unreg_sess+0x104/0x2c0 [qla2xxx]
tcm_qla2xxx_close_session+0xa2/0xb0 [tcm_qla2xxx]
target_shutdown_sessions+0x17b/0x190 [target_core_mod]
core_tpg_del_initiator_node_acl+0xf3/0x1f0 [target_core_mod]
target_fabric_nacl_base_release+0x25/0x30 [target_core_mod]
config_item_release+0x9f/0x120 [configfs]
config_item_put+0x29/0x2b [configfs]
configfs_rmdir+0x3d2/0x520 [configfs]
vfs_rmdir+0xb3/0x1d0
do_rmdir+0x25c/0x2d0
__x64_sys_rmdir+0x24/0x30
do_syscall_64+0x77/0x220
entry_SYSCALL_64_after_hwframe+0x49/0xbe
the dependencies between the lock to be acquired
and HARDIRQ-irq-unsafe lock:
-> (&(&k->k_lock)->rlock){+.+.} ops: 14568 {
HARDIRQ-ON-W at:
lock_acquire+0xe3/0x200
_raw_spin_lock+0x32/0x50
klist_add_tail+0x33/0xb0
device_add+0x7f4/0xb60
device_create_groups_vargs+0x11c/0x150
device_create_with_groups+0x89/0xb0
vtconsole_class_init+0xb2/0x124
do_one_initcall+0xc5/0x3ce
kernel_init_freeable+0x295/0x32e
kernel_init+0x11/0x11b
ret_from_fork+0x3a/0x50
SOFTIRQ-ON-W at:
lock_acquire+0xe3/0x200
_raw_spin_lock+0x32/0x50
klist_add_tail+0x33/0xb0
device_add+0x7f4/0xb60
device_create_groups_vargs+0x11c/0x150
device_create_with_groups+0x89/0xb0
vtconsole_class_init+0xb2/0x124
do_one_initcall+0xc5/0x3ce
kernel_init_freeable+0x295/0x32e
kernel_init+0x11/0x11b
ret_from_fork+0x3a/0x50
INITIAL USE at:
lock_acquire+0xe3/0x200
_raw_spin_lock+0x32/0x50
klist_add_tail+0x33/0xb0
device_add+0x7f4/0xb60
device_create_groups_vargs+0x11c/0x150
device_create_with_groups+0x89/0xb0
vtconsole_class_init+0xb2/0x124
do_one_initcall+0xc5/0x3ce
kernel_init_freeable+0x295/0x32e
kernel_init+0x11/0x11b
ret_from_fork+0x3a/0x50
}
... key at: [<ffffffff83f3d900>] __key.15805+0x0/0x40
... acquired at:
__lock_acquire+0x11ed/0x1b60
lock_acquire+0xe3/0x200
_raw_spin_lock_irqsave+0x3d/0x60
klist_next+0x43/0x1d0
device_for_each_child+0x96/0x110
scsi_target_block+0x3c/0x40 [scsi_mod]
fc_remote_port_delete+0xe7/0x1c0 [scsi_transport_fc]
qla2x00_mark_device_lost+0x4d3/0x500 [qla2xxx]
qlt_unreg_sess+0x104/0x2c0 [qla2xxx]
tcm_qla2xxx_close_session+0xa2/0xb0 [tcm_qla2xxx]
target_shutdown_sessions+0x17b/0x190 [target_core_mod]
core_tpg_del_initiator_node_acl+0xf3/0x1f0 [target_core_mod]
target_fabric_nacl_base_release+0x25/0x30 [target_core_mod]
config_item_release+0x9f/0x120 [configfs]
config_item_put+0x29/0x2b [configfs]
configfs_rmdir+0x3d2/0x520 [configfs]
vfs_rmdir+0xb3/0x1d0
do_rmdir+0x25c/0x2d0
__x64_sys_rmdir+0x24/0x30
do_syscall_64+0x77/0x220
entry_SYSCALL_64_after_hwframe+0x49/0xbe
stack backtrace:
CPU: 7 PID: 1478 Comm: rmdir Tainted: G W 5.1.0-rc1-dbg+ #11
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
Call Trace:
dump_stack+0x86/0xca
check_usage.cold.59+0x473/0x563
check_prev_add.constprop.43+0x1f1/0x1170
__lock_acquire+0x11ed/0x1b60
lock_acquire+0xe3/0x200
_raw_spin_lock_irqsave+0x3d/0x60
klist_next+0x43/0x1d0
device_for_each_child+0x96/0x110
scsi_target_block+0x3c/0x40 [scsi_mod]
fc_remote_port_delete+0xe7/0x1c0 [scsi_transport_fc]
qla2x00_mark_device_lost+0x4d3/0x500 [qla2xxx]
qlt_unreg_sess+0x104/0x2c0 [qla2xxx]
tcm_qla2xxx_close_session+0xa2/0xb0 [tcm_qla2xxx]
target_shutdown_sessions+0x17b/0x190 [target_core_mod]
core_tpg_del_initiator_node_acl+0xf3/0x1f0 [target_core_mod]
target_fabric_nacl_base_release+0x25/0x30 [target_core_mod]
config_item_release+0x9f/0x120 [configfs]
config_item_put+0x29/0x2b [configfs]
configfs_rmdir+0x3d2/0x520 [configfs]
vfs_rmdir+0xb3/0x1d0
do_rmdir+0x25c/0x2d0
__x64_sys_rmdir+0x24/0x30
do_syscall_64+0x77/0x220
entry_SYSCALL_64_after_hwframe+0x49/0xbe
Cc: Himanshu Madhani <hmadhani@marvell.com>
Cc: Giridhar Malavali <gmalavali@marvell.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-04-29 17:24:52 -04:00
..
2019-03-25 22:19:01 -04:00
2019-04-29 08:13:43 -04:00
2019-02-25 21:37:26 -05:00
2019-01-22 21:38:21 -05:00
2018-12-18 23:19:21 -05:00
2019-03-19 17:38:20 -04:00
2019-03-09 16:53:47 -08:00
2019-04-03 23:11:35 -04:00
2019-03-09 16:53:47 -08:00
2019-04-29 08:34:08 -04:00
2019-04-15 22:15:06 -04:00
2019-03-09 16:53:47 -08:00
2018-11-09 19:17:14 -07:00
2019-02-08 17:33:00 -05:00
2019-02-19 18:58:38 -05:00
2019-01-29 01:16:09 -05:00
2019-04-12 21:30:12 -04:00
2019-03-27 21:34:20 -04:00
2019-02-04 21:23:59 -05:00
2019-01-08 22:27:24 -05:00
2019-02-04 22:17:33 -05:00
2019-04-15 18:55:01 -04:00
2019-04-18 20:35:58 -04:00
2019-04-18 20:34:46 -04:00
2019-04-12 21:27:23 -04:00
2019-03-19 17:13:37 -04:00
2019-01-29 01:28:49 -05:00
2019-04-03 23:45:59 -04:00
2019-04-29 08:34:10 -04:00
2019-04-29 08:34:09 -04:00
2019-04-29 17:24:52 -04:00
2019-04-12 21:27:23 -04:00
2019-03-19 15:29:10 -04:00
2019-01-29 00:40:54 -05:00
2018-12-18 23:13:12 -05:00
2019-04-29 08:34:10 -04:00
2019-02-25 21:37:25 -05:00
2019-03-02 11:39:54 -08:00
2018-12-19 21:54:07 -05:00
2018-10-17 21:58:51 -04:00
2019-01-29 01:33:00 -05:00
2018-08-30 07:27:22 -04:00
2019-01-08 07:58:37 -05:00
2018-12-18 23:19:21 -05:00
2018-12-18 23:13:12 -05:00
2018-12-18 23:19:21 -05:00
2018-12-18 23:19:21 -05:00
2018-12-18 23:13:12 -05:00
2018-12-18 23:13:12 -05:00
2018-06-19 22:02:25 -04:00
2018-10-15 23:00:38 -04:00
2019-01-22 10:21:43 +01:00
2019-03-19 17:08:35 -04:00
2018-12-18 23:13:12 -05:00
2018-06-26 12:27:06 -04:00
2018-12-18 23:19:21 -05:00
2018-12-18 23:19:21 -05:00
2019-03-19 17:10:34 -04:00
2018-03-15 00:25:37 -04:00
2018-12-18 23:13:12 -05:00
2018-10-17 21:38:20 -04:00
2018-09-25 20:45:53 -04:00
2018-12-18 23:19:21 -05:00
2019-01-08 21:58:35 -05:00
2019-01-08 21:58:35 -05:00
2019-01-08 21:57:42 -05:00
2019-03-25 22:22:44 -04:00
2019-01-08 21:58:35 -05:00
2018-12-18 23:19:21 -05:00
2018-12-28 14:48:06 -08:00
2019-03-18 16:46:14 -04:00
2018-07-10 22:25:03 -04:00
2019-02-25 21:44:40 -05:00
2018-12-18 23:13:12 -05:00
2018-12-18 23:13:12 -05:00
2019-02-08 17:33:00 -05:00
2018-09-21 12:35:39 -04:00
2018-12-18 23:19:21 -05:00
2018-11-06 21:31:28 -05:00
2019-02-05 21:29:21 -05:00
2018-10-15 23:00:38 -04:00
2019-03-09 16:53:47 -08:00
2019-03-06 19:26:45 -05:00
2019-03-16 12:51:50 -07:00
2018-12-18 23:13:12 -05:00
2018-12-18 23:19:21 -05:00
2018-12-18 23:19:21 -05:00
2019-02-05 21:28:52 -05:00
2018-12-18 23:13:12 -05:00
2018-06-19 22:02:25 -04:00
2019-01-08 07:58:37 -05:00
2018-12-18 23:13:12 -05:00
2019-03-19 17:46:16 -04:00
2018-12-28 14:48:06 -08:00
2018-10-17 21:06:49 -04:00
2018-12-19 21:43:30 -05:00
2018-10-17 21:07:54 -04:00
2018-12-18 23:13:12 -05:00
2019-03-19 14:18:46 -04:00
2018-09-28 02:17:51 -04:00
2018-06-19 22:02:25 -04:00
2019-01-29 01:26:57 -05:00
2019-02-27 09:10:16 -05:00
2019-01-03 18:57:57 -08:00
2018-02-13 21:49:15 -05:00
2018-12-18 23:13:12 -05:00
2018-12-18 23:13:12 -05:00
2019-01-11 22:30:51 -05:00
2019-03-19 17:11:37 -04:00
2018-12-18 23:19:21 -05:00
2019-02-13 22:07:03 -05:00
2019-02-13 22:07:03 -05:00
2018-08-30 07:21:04 -04:00
2019-03-09 16:53:47 -08:00
2018-04-20 19:14:28 -04:00
2019-04-03 23:27:23 -04:00
2019-04-03 23:27:23 -04:00
2019-03-19 14:02:18 -04:00
2019-01-03 18:57:57 -08:00
2019-04-15 22:11:22 -04:00
2019-04-29 17:13:12 -04:00
2019-04-29 17:13:12 -04:00
2019-04-15 22:25:00 -04:00
2019-03-27 21:21:07 -04:00
2019-04-12 20:09:34 -04:00
2019-03-18 16:55:48 -04:00
2019-02-05 21:27:40 -05:00
2018-06-26 12:27:06 -04:00
2018-06-04 07:58:06 -07:00
2019-04-29 17:13:12 -04:00
2018-06-19 22:02:25 -04:00
2018-07-30 08:27:02 -06:00
2019-02-15 22:09:54 -05:00
2019-04-29 17:13:12 -04:00
2019-02-12 22:33:00 -05:00
2018-06-12 16:19:22 -07:00
2019-01-03 18:57:57 -08:00
2018-12-18 23:19:21 -05:00
2018-08-02 15:22:13 -06:00
2019-02-05 21:29:49 -05:00
2019-02-27 09:10:16 -05:00
2018-12-18 23:19:21 -05:00
2019-04-03 23:31:03 -04:00
2018-12-18 23:19:21 -05:00
2018-10-15 23:00:38 -04:00
2018-12-07 21:56:06 -05:00
2019-03-19 15:29:10 -04:00
2018-12-28 14:48:06 -08:00
2018-12-18 23:13:12 -05:00
2018-11-15 14:27:08 -05:00
2018-12-18 23:13:12 -05:00
2018-10-17 21:38:20 -04:00