您的问题:“无法访问的网络文件系统”是一个众所周知的例子,它触发了 linux hung task,这与僵尸进程完全不同(杀死父 PID 是不行的任何东西)
挂起的任务,是触发系统调用导致内核出现问题的任务,因此系统调用永远不会返回。
主要的特殊性是调度程序将任务声明为“D”状态,这意味着程序处于不可中断状态。这意味着你无法阻止你的程序:你可以触发所有信号给任务,它不会响应。启动数百个 SIGTERM/SIGKILL 无济于事!
我的旧内核就是这种情况:当我的 nfs 服务器崩溃时,我需要重新启动客户端以终止使用文件系统的任务。我很久以前编译过它(我的硬盘上还有构建树),在配置过程中我在 lib/Kconfig.debug 中看到了这个:
config DETECT_HUNG_TASK
bool "Detect Hung Tasks"
depends on DEBUG_KERNEL
default LOCKUP_DETECTOR
help
Say Y here to enable the kernel to detect "hung tasks",
which are bugs that cause the task to be stuck in
uninterruptible "D" state indefinitiley.
When a hung task is detected, the kernel will print the
current stack trace (which you should report), but the
task will stay in uninterruptible state. If lockdep is
enabled then all held locks will also be reported. This
feature has negligible overhead.
它只是提议在检测时检测这种 tash 或恐慌:我没有检查最近的内核是否真的可以解决问题 (您的问题似乎是这种情况),但我认为不值得启用它。
还有第二个问题:通常,检测发生在 120 秒后,但我也看到了一个 Konfig 选项:
config DEFAULT_HUNG_TASK_TIMEOUT
int "Default timeout for hung task detection (in seconds)"
depends on DETECT_HUNG_TASK
default 120
help
This option controls the default timeout (in seconds) used
to determine when a task has become non-responsive and should
be considered hung.
It can be adjusted at runtime via the kernel.hung_task_timeout_secs
sysctl or by writing a value to
/proc/sys/kernel/hung_task_timeout_secs.
A timeout of 0 disables the check. The default is two minutes.
Keeping the default should be fine in most cases.
这也适用于内核线程:例如:为 fuse 文件系统上的文件创建循环设备。然后让控制 fuse 文件系统的用户空间程序崩溃!
你应该得到一个 Ktread,它的名字格式为 loopX(X 通常对应于你的回送设备号)HUNGing!
网络链接:
https://unix.stackexchange.com/questions/5642/what-if-kill-9-does-not-work(看ultrasawblade写的答案)
http://www.linuxquestions.org/questions/linux-general-1/kill-a-hung-task-when-kill-9-doesn't-help-697305/
http://forums-web2.gentoo.org/viewtopic-t-811557-start-0.html
http://comments.gmane.org/gmane.linux.kernel/1189978
http://comments.gmane.org/gmane.linux.kernel.cifs/7674(这个情况和你的差不多)
在你的三个问题的情况下:你有答案:这可能是由于 vfs linux 内核层中一个众所周知的错误! (没有 CIFS 超时)