Documentation/translations/zh_CN/scsi/scsi_eh.rst
Source file repositories/reference/linux-study-clean/Documentation/translations/zh_CN/scsi/scsi_eh.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/translations/zh_CN/scsi/scsi_eh.rst- Extension
.rst- Size
- 18317 bytes
- Lines
- 483
- Domain
- Support Tooling And Documentation
- Bucket
- Documentation
- Inferred role
- Support Tooling And Documentation: documentation
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
.. SPDX-License-Identifier: GPL-2.0
.. include:: ../disclaimer-zh_CN.rst
:Original: Documentation/scsi/scsi_eh.rst
:翻译:
郝栋栋 doubled <doubled@leap-io-kernel.com>
:校译:
===================
SCSI 中间层错误处理
===================
本文档描述了SCSI中间层(mid layer)的错误处理基础架构。
关于SCSI中间层的更多信息,请参阅:
Documentation/scsi/scsi_mid_low_api.rst。
.. 目录
[1] SCSI 命令如何通过中间层传递并进入错误处理(EH)
[1-1] scsi_cmnd(SCSI命令)结构体
[1-2] scmd(SCSI 命令)是如何完成的?
[1-2-1] 通过scsi_done完成scmd
[1-2-2] 通过超时机制完成scmd
[1-3] 错误处理模块如何接管流程
[2] SCSI错误处理机制工作原理
[2-1] 基于细粒度回调的错误处理
[2-1-1] 概览
[2-1-2] scmd在错误处理流程中的传递路径
[2-1-3] 控制流分析
[2-2] 通过transportt->eh_strategy_handler()实现的错误处理
[2-2-1] transportt->eh_strategy_handler()调用前的中间层状态
[2-2-2] transportt->eh_strategy_handler()调用后的中间层状态
[2-2-3] 注意事项
1. SCSI命令在中间层及错误处理中的传递流程
=========================================
1.1 scsi_cmnd结构体
-------------------
每个SCSI命令都由struct scsi_cmnd(简称scmd)结构体
表示。scmd包含两个list_head类型的链表节点:scmd->list
与scmd->eh_entry。其中scmd->list是用于空闲链表或设备
专属的scmd分配链表,与错误处理讨论关联不大。而
scmd->eh_entry则是专用于命令完成和错误处理链表,除非
特别说明,本文讨论中所有scmd的链表操作均通过
scmd->eh_entry实现。
1.2 scmd是如何完成的?
----------------------
底层设备驱动(LLDD)在获取SCSI命令(scmd)后,存在两种
完成路径:底层驱动可通过调用hostt->queuecommand()时从
中间层传递的scsi_done回调函数主动完成命令,或者当命令未
及时完成时由块层(block layer)触发超时处理机制。
1.2.1 通过scsi_done回调完成SCSI命令
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
对于所有非错误处理(EH)命令,scsi_done()是其完成回调
函数。它只调用blk_mq_complete_request()来删除块层的
定时器并触发块设备软中断(BLOCK_SOFTIRQ)。
Annotation
- Atlas domain: Support Tooling And Documentation / Documentation.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.