搜索

此内容没有您所选择的语言版本。

1.17. Controlling the SCSI Command Timer and Device Status

download PDF
The Linux SCSI layer sets a timer on each command. When this timer expires, the SCSI layer will quiesce the host bus adapter (HBA) and wait for all outstanding commands to either time out or complete. Afterwards, the SCSI layer will activate the driver's error handler.
When the error handler is triggered, it attempts the following operations in order (until one successfully executes):
  1. Abort the command.
  2. Reset the device.
  3. Reset the bus.
  4. Reset the host.
If all of these operations fail, the device will be set to the offline state. When this occurs, all IO to that device will be failed, until the problem is corrected and the user sets the device to running.
The process is different, however, if a device uses the fibre channel protocol and the rport is blocked. In such cases, the drivers wait for several seconds for the rport to become online again before activating the error handler. This prevents devices from becoming offline due to temporary transport problems.

Device States

To display the state of a device, use:
cat /sys/block/device-name/device/state
To set a device to running state, use:
echo running > /sys/block/device-name/device/state

Command Timer

To control the command timer, you can write to /sys/block/device-name/device/timeout. To do so, run:
echo value /sys/block/device-name/device/timeout
Here, value is the timeout value (in seconds) you want to implement.
Alternatively, you can also modify the timeout udev rule. To do so, open /etc/udev/rules.d/50-udev.rules. You should find the following lines:
	
ACTION=="add", SUBSYSTEM=="scsi" , SYSFS{type}=="0|7|14", \
RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'"
echo 60 refers to the timeout length, in seconds; in this case, timeout is set at 60 seconds. Replace this value with your desired timeout length.
Note that the default timeout for normal file system commands is 60 seconds when udev is being used. If udev is not in use, the default timeout is 30 seconds.
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.