!64 scsi: mpt3sas: Transition IOC to Ready state during shutdown
Merge Pull Request from: @fengfeixi
Before kernel 5.14, the scsih_shutdown function in the mpt3sas driver directly calls mpt3sas_base_detach to release all resources.
Therefore, when the system shutdown process is slow, the problem of scsih_qcmd accessing the ioc->request resource that has been released (set to NULL) will be triggered probabilistically due to the problem of the ioc firmware itself. Eventually leading to kernel panic.
Part of the call stack is as follows:
```
crash> bt
PID: 6293 TASK: ffff00ff91244d80 CPU: 30 COMMAND: "kworker/30:1H"
#0 [ffff8000259934d0] machine_kexec at ffff800010031aec
#1 [ffff800025993520] __crash_kexec at ffff80001015048c
#2 [ffff8000259936c0] crash_kexec at ffff8000101505a0
…………
#12 [ffff800025993a20] memset at ffff8000104fa068
#13 [ffff800025993a80] scsi_queue_rq at ffff80001073e930
#14 [ffff800025993ae0] blk_mq_dispatch_rq_list at ffff80001047e3fc
#15 [ffff800025993bd0] __blk_mq_sched_dispatch_requests at ffff800010484814
#16 [ffff800025993c30] blk_mq_sched_dispatch_requests at ffff800010484a5c
#17 [ffff800025993c50] __blk_mq_run_hw_queue at ffff80001047cc98
#18 [ffff800025993c70] __blk_mq_delay_run_hw_queue at ffff80001047cf38
#19 [ffff800025993cc0] blk_mq_run_hw_queue at ffff80001047d064
#20 [ffff800025993cf0] blk_mq_run_hw_queues at ffff80001047d114
#21 [ffff800025993d20] blk_mq_requeue_work at ffff80001047eff0
#22 [ffff800025993d90] process_one_work at ffff8000100a4520
#23 [ffff800025993de0] worker_thread at ffff8000100a47f8
#24 [ffff800025993e50] kthread at ffff8000100abecc
```
Part of the data of the accessed ioc (MPT3SAS_ADAPTER structure), ioc->request request is empty.
```
crash> struct MPT3SAS_ADAPTER 0xffff00ff85806880
struct MPT3SAS_ADAPTER {
list = {
next = 0xffff800008eb8038 <mpt3sas_ioc_list>,
prev = 0xffff800008eb8038 <mpt3sas_ioc_list>
},
...
name = "mpt3sas_cm0\000\000\000\000\000\000\000\
...
remove_host = 1 '\001',
...
request_sz = 128,
request = 0x0,
...
sense = 0x0,
```
The kernel 5.14 upstream patch optimizes the scsih_shutdown process, the ioc memory pool will not be released immediately and ioc->shost_recovery = 1 to ensure that the queuecommand operation will not be performed in the future.
Link:https://gitee.com/openeuler/kernel/pulls/64
Reviewed-by: Zheng Zengkai <zhengzengkai@huawei.com>
Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
Showing
想要评论请 注册 或 登录