在使用 Arch Linux 4.20.2 卸载远程文件系统fusermount -u ~/sshfs_mount/
然后调用systemctl suspend
我的 Arch Linux 4.20.2 后冻结了大约 20 秒。
在这 20 秒之后,系统再次响应(它没有挂起)。然后我再次尝试暂停,这次成功了。
检查出来journalctl
,我发现了很多这样的消息:
Jan 21 10:10:45 me systemd-logind[510]: Power key pressed.
Jan 21 10:10:45 me kernel: PM: suspend exit
Jan 21 10:10:45 me kernel: PM: suspend entry (s2idle)
Jan 21 10:11:05 me kernel: PM: Syncing filesystems ... done.
Jan 21 10:11:05 me kernel: Freezing user space processes ...
Jan 21 10:11:05 me kernel: Freezing of tasks failed after 20.002 seconds (15 tasks refusing to freeze, wq_busy=0):
Jan 21 10:11:05 me kernel: pool D 0 10812 5584 0x00000084
Jan 21 10:11:05 me kernel: Call Trace:
Jan 21 10:11:05 me kernel: ? __schedule+0x29b/0x8b0
Jan 21 10:11:05 me kernel: ? __wake_up_common+0x77/0x140
Jan 21 10:11:05 me kernel: ? preempt_count_add+0x79/0xb0
Jan 21 10:11:05 me kernel: schedule+0x32/0x90
Jan 21 10:11:05 me kernel: request_wait_answer+0xaa/0x1f0 [fuse]
Jan 21 10:11:05 me kernel: ? wait_woken+0x80/0x80
Jan 21 10:11:05 me kernel: __fuse_request_send+0x61/0x80 [fuse]
Jan 21 10:11:05 me kernel: fuse_simple_request+0xcd/0x190 [fuse]
Jan 21 10:11:05 me kernel: fuse_statfs+0xde/0x140 [fuse]
Jan 21 10:11:05 me kernel: statfs_by_dentry+0x67/0x90
Jan 21 10:11:05 me kernel: vfs_statfs+0x16/0xc0
Jan 21 10:11:05 me kernel: user_statfs+0x54/0xa0
Jan 21 10:11:05 me kernel: __se_sys_statfs+0x25/0x60
Jan 21 10:11:05 me kernel: do_syscall_64+0x5b/0x170
Jan 21 10:11:05 me kernel: entry_SYSCALL_64_after_hwframe+0x44/0xa9
Jan 21 10:11:05 me kernel: RIP: 0033:0x7fe2aa8571ab
Jan 21 10:11:05 me kernel: Code: Bad RIP value.
Jan 21 10:11:05 me kernel: RSP: 002b:00007fe221efecf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000089
Jan 21 10:11:05 me kernel: RAX: ffffffffffffffda RBX: 00007fe27258e3a0 RCX: 00007fe2aa8571ab
Jan 21 10:11:05 me kernel: RDX: 00007fe2725869b0 RSI: 00007fe221efed20 RDI: 00007fe2689573a0
Jan 21 10:11:05 me kernel: RBP: 00007fe221efee80 R08: 00007fe29713ee58 R09: 00007fe29713ee60
Jan 21 10:11:05 me kernel: R10: 00007fe29714e078 R11: 0000000000000246 R12: 00007fe268957040
Jan 21 10:11:05 me kernel: R13: 00007ffc0f96f75f R14: 00007fe221eff700 R15: 000000000000001e
Jan 21 10:11:05 me kernel: pool D 0 10813 5584 0x00000084
还有这个:
Jan 21 10:11:05 me kernel: OOM killer enabled.
Jan 21 10:11:05 me kernel: Restarting tasks ... done.
Jan 21 10:11:05 me systemd-sleep[23193]: Failed to suspend system. System resumed again: Device or resource busy
Jan 21 10:11:05 me kernel: PM: suspend exit
Jan 21 10:11:05 me systemd[1]: systemd-suspend.service: Main process exited, code=exited, status=1/FAILURE
Jan 21 10:11:05 me systemd[1]: systemd-suspend.service: Failed with result 'exit-code'.
Jan 21 10:11:05 me systemd[1]: Failed to start Suspend.
Jan 21 10:11:05 me systemd[1]: Dependency failed for Suspend.
Jan 21 10:11:05 me systemd[1]: suspend.target: Job suspend.target/start failed with result 'dependency'.
Jan 21 10:11:05 me audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-suspend comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
Jan 21 10:11:05 me systemd[1]: Stopped target Sleep.
Jan 21 10:11:05 me kernel: audit: type=1130 audit(1548061865.860:643): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-suspend comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
Jan 21 10:11:05 me systemd-logind[510]: Operation 'sleep' finished.
根据pacman -Qi systemd
,我得到了 240.34-3 版本。
我不知道fusermount
和症状之间是否存在因果关系,但我认为存在因果关系,因为journalctl
.
这里提到了这个问题,2012 年最新的非自动回复建议在挂起之前卸载远程文件系统;但这就是我在机器冻结之前所做的。
这是该问题的另一份报告,不包含解决方法或解决方案。
这个问题的答案虽然被接受和赞成,但不包含对我未来如何避免该问题的可行建议。
我对此的直觉是 sshfs 中有一些缓存在您卸载后仍在刷新(很多)秒。
内核线程在尝试刷新缓存时拒绝休眠是合法的,尤其是在需要网络连接的情况下。
我找不到有关是否
sync
会刷新文件系统缓存的fusermount
文档,但请先尝试一下。IE:您也可以尝试使用
-o cache=no
此处提到的安装 sshfs:https://superuser.com/questions/542444/ubuntu-sshfs-doesnt-sync
不过,这可能会损害 sshfs 的性能。