Commit 729a6872 authored by Ye Bin's avatar Ye Bin Committed by Long Li
Browse files

xfs: fix dead loop when do mount with IO fault injection

Offering: HULK
hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I76JSK



--------------------------------

When do IO fault injection, mount maybe hung:
blk_update_request: I/O error, dev dm-4, sector 2128216 op 0x0:(READ) flags 0x1000 phys_seg 1 prio class 0
XFS (dm-4): metadata I/O error in "xfs_btree_read_buf_block.constprop.0+0x190/0x200 [xfs]" at daddr 0x207958 len 8 error 5
blk_update_request: I/O error, dev dm-4, sector 2108042 op 0x1:(WRITE) flags 0x29800 phys_seg 1 prio class 0
XFS (dm-4): log I/O error -5
XFS (dm-4): Metadata I/O Error (0x1) detected at xfs_trans_read_buf_map+0x2b6/0x510 [xfs] (fs/xfs/xfs_trans_buf.c:296).  Shutting down filesystem.
sd 6:0:0:3: [sdh] Synchronizing SCSI cache
XFS (dm-4): Please unmount the filesystem and rectify the problem(s)
XFS (dm-4): Failed to recover intents
XFS (dm-4): Ending recovery (logdev: internal)

PID: 2489297  TASK: ffff8880355c1b00  CPU: 0   COMMAND: "mount"
__schedule at ffffffff93aa03c1
schedule at ffffffff93aa0c6f
schedule_timeout at ffffffff93aa63c0
xfs_wait_buftarg at ffffffffc1170ff0 [xfs]
xfs_log_mount_finish at ffffffffc11bddc4 [xfs]
xfs_mountfs at ffffffffc11a4492 [xfs]
xfs_fc_fill_super at ffffffffc11ae01c [xfs]
get_tree_bdev at ffffffff92c62a79
vfs_get_tree at ffffffff92c60fe0
do_new_mount at ffffffff92caaca0
path_mount at ffffffff92cabf83
__se_sys_mount at ffffffff92cac352
do_syscall_64 at ffffffff93a8b153
entry_SYSCALL_64_after_hwframe at ffffffff93c00099

Ftrace log:
mount-2489297 [002] .... 337330.575879: xfs_buf_wait_buftarg: dev 253:4 bno 0x3220 nblks 0x8 hold 2 pincount 0 lock 1 flags DONE|PAGES caller __list_l0

Above issue hapnens as xfs_buf log item is in AIL list, but xlog is already
shutdown, so xfs_log_worker() will not wakeup xfsaild to submit AIL list.
Then the last 'b_hold' will no chance to be decreased. Then xfs_wait_buftarg()
will dead loop to free xfs_buf.
To solve above issue there is need to push AIL list before call xfs_wait_buftarg().
As xfs_log_mount_finish() return error, xfs_mountfs() will call xfs_log_mount_cancel()
to clean AIL list, and call xfs_wait_buftarg() to make sure all xfs_buf has been
reclaimed. So what we need to do is call xfs_wait_buftarg() when 'error == 0' in
xfs_log_mount_finish().

Signed-off-by: default avatarYe Bin <yebin@huawei.com>
Signed-off-by: default avatarLong Li <leo.lilong@huawei.com>
parent 2b06545e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment