磁盘在活动 I/O 期间挂起

磁盘在活动 I/O 期间挂起

我有 XenServer 客户操作系统 (Ubuntu 10.10 lts),在将大量文件从 nfs 复制到本地磁盘 (cp -rp nfs:/dir /local/dir) 时遇到问题。一段时间后,本地磁盘挂起,我无法执行任何 IO 操作。在日志文件中我看到以下内容:

Oct 28 19:13:21 ls0 kernel: [1947885.457070] INFO: task cp:3904 blocked for more than 120 seconds.
Oct 28 19:13:21 ls0 kernel: [1947885.457075] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
Oct 28 19:13:21 ls0 kernel: [1947885.457081] cp            D ffff88002804dbc0     0  3904   2052 0x00000000
Oct 28 19:13:21 ls0 kernel: [1947885.457085]  ffff880273a91ae8 0000000000000286 0000000000015bc0 0000000000015bc0
Oct 28 19:13:21 ls0 kernel: [1947885.457090]  ffff880141bf4890 ffff880273a91fd8 0000000000015bc0 ffff880141bf44d0
Oct 28 19:13:21 ls0 kernel: [1947885.457095]  0000000000015bc0 ffff880273a91fd8 0000000000015bc0 ffff880141bf4890
Oct 28 19:13:21 ls0 kernel: [1947885.457099] Call Trace:
Oct 28 19:13:21 ls0 kernel: [1947885.457103]  [<ffffffff8121adcd>] do_get_write_access+0x31d/0x5e0
Oct 28 19:13:21 ls0 kernel: [1947885.457107]  [<ffffffff8100eb6d>] ? xen_force_evtchn_callback+0xd/0x10
Oct 28 19:13:21 ls0 kernel: [1947885.457110]  [<ffffffff8100f302>] ? check_events+0x12/0x20
Oct 28 19:13:21 ls0 kernel: [1947885.457113]  [<ffffffff810845c0>] ? wake_bit_function+0x0/0x40
Oct 28 19:13:21 ls0 kernel: [1947885.457117]  [<ffffffff8121b221>] jbd2_journal_get_write_access+0x31/0x50
Oct 28 19:13:21 ls0 kernel: [1947885.457121]  [<ffffffff81202388>] __ext4_journal_get_write_access+0x38/0x70
Oct 28 19:13:21 ls0 kernel: [1947885.457125]  [<ffffffff811d9004>] ext4_new_inode+0x234/0xb40
Oct 28 19:13:21 ls0 kernel: [1947885.457128]  [<ffffffff811f7908>] ? ext4_journal_start_sb+0xf8/0x130
Oct 28 19:13:21 ls0 kernel: [1947885.457132]  [<ffffffff811e6e40>] ext4_create+0xc0/0x150
Oct 28 19:13:21 ls0 kernel: [1947885.457137]  [<ffffffff8114ca63>] ? generic_permission+0x23/0xc0
Oct 28 19:13:21 ls0 kernel: [1947885.457141]  [<ffffffff8114e4f4>] vfs_create+0xb4/0xe0
Oct 28 19:13:21 ls0 kernel: [1947885.457144]  [<ffffffff8114e5e4>] __open_namei_create+0xc4/0x110
Oct 28 19:13:21 ls0 kernel: [1947885.457148]  [<ffffffff81151d8b>] do_filp_open+0xa6b/0xba0
Oct 28 19:13:21 ls0 kernel: [1947885.457162]  [<ffffffffa0084b3b>] ? nfs_attribute_timeout+0x1b/0x70 [nfs]
Oct 28 19:13:21 ls0 kernel: [1947885.457170]  [<ffffffffa0085fe6>] ? nfs_revalidate_inode+0x26/0x60 [nfs]
Oct 28 19:13:21 ls0 kernel: [1947885.457174]  [<ffffffff8114d80b>] ? getname+0x3b/0x240
Oct 28 19:13:21 ls0 kernel: [1947885.457178]  [<ffffffff8115d17a>] ? alloc_fd+0x10a/0x150
Oct 28 19:13:21 ls0 kernel: [1947885.457182]  [<ffffffff81140d99>] do_sys_open+0x69/0x170
Oct 28 19:13:21 ls0 kernel: [1947885.457185]  [<ffffffff81140ee0>] sys_open+0x20/0x30
Oct 28 19:13:21 ls0 kernel: [1947885.457189]  [<ffffffff810121b2>] system_call_fastpath+0x16/0x1b

任务可以是“flush-202”“jbd2/xvdc1-8”......此复制操作中涉及的任何内容

我尝试更改 IO 调度程序(至截止时间)、vm.dirty_ratio 和 vm.dirty_background_ratio。但无济于事

现在我的服务器磁盘挂起了,我可以进行一些调查:

~# grep -A 1 dirty /proc/vmstat 
nr_dirty 9598
nr_writeback 0

# vmstat 1
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa
 0  1      0 3221016 301536 5558968    0    0     0    26   25   19  0  0 88 12
 0  1      0 3221008 301536 5558968    0    0     0     0   47   22  0  0 85 15
 0  1      0 3221008 301536 5558968    0    0     0     0   17   13  0  0 63 37
 0  1      0 3221008 301536 5558968    0    0     0     0   16   17  0  0 100  0
 0  1      0 3221008 301536 5558968    0    0     0     0   34   28  0  0 100  0
 0  1      0 3221008 301536 5558968    0    0     0     0   15   12  0  0 100  0
 0  1      0 3221008 301536 5558968    0    0     0     0   14   14  0  0 39 61
 0  1      0 3221008 301536 5558968    0    0     0     0   21   22  0  0 100  0
 0  1      0 3221008 301536 5558968    0    0     0     0   15   16  0  0 100  0




~# iostat -xm 1| grep xvdc
xvdc              0.02   519.33    0.03   53.36     0.00     0.40    15.21    28.55    8.22  17.60  93.98
xvdc              0.00     0.00    0.00    0.00     0.00     0.00     0.00    30.00    0.00   0.00 100.00
xvdc              0.00     0.00    0.00    0.00     0.00     0.00     0.00    30.00    0.00   0.00 100.00
xvdc              0.00     0.00    0.00    0.00     0.00     0.00     0.00    30.00    0.00   0.00 100.00
xvdc              0.00     0.00    0.00    0.00     0.00     0.00     0.00    30.00    0.00   0.00 100.00
xvdc              0.00     0.00    0.00    0.00     0.00     0.00     0.00    30.00    0.00   0.00 100.00
xvdc              0.00     0.00    0.00    0.00     0.00     0.00     0.00    30.00    0.00   0.00 100.00
xvdc              0.00     0.00    0.00    0.00     0.00     0.00     0.00    30.00    0.00   0.00 100.00

还有记忆图 https://i.stack.imgur.com/zZaaI.png

答案1

复制操作每次都会围绕同一个文件/目录吗?

您是否尝试过使用rsync而不是cp?这可能听起来很愚蠢,但有几次我设法在类似情况下使用它复制文件。我不知道为什么 cp 会让一切停滞不前……

另一个罪魁祸首可能是 ext4 + nfs 组合。

答案2

可以您的硬件是否出现故障。您检查过驱动器的 SMART 值吗?执行本地 bonnie++ 测试或仅执行dd磁盘测试/dev/null

相关内容