From: Ye Bin <yebin@huaweicloud.com>
To: djwong@kernel.org, linux-xfs@vger.kernel.org,
chandan.babu@oracle.com, dchinner@redhat.com
Cc: linux-kernel@vger.kernel.org, yebin10@huawei.com,
zhangxiaoxu5@huawei.com
Subject: [PATCH] xfs: fix dead loop when do mount with IO fault injection
Date: Thu, 10 Oct 2024 17:38:35 +0800 [thread overview]
Message-ID: <20241010093835.1506926-1-yebin@huaweicloud.com> (raw)
From: Ye Bin <yebin10@huawei.com>
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)
xfs_buftarg_drain+0x53a/0x740
xfs_log_mount_finish+0x2be/0x550
xfs_mountfs+0x16ba/0x2220
xfs_fs_fill_super+0x1376/0x1f10
get_tree_bdev+0x44a/0x770
vfs_get_tree+0x8d/0x350
path_mount+0x1228/0x1cc0
do_mount+0xf7/0x110
__x64_sys_mount+0x193/0x230
do_syscall_64+0x39/0xb0
entry_SYSCALL_64_after_hwframe+0x63/0xcd
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_buftarg_drain() will dead loop to free xfs_buf.
To solve above issue there is need to push AIL list before call
xfs_buftarg_drain(). As xfs_log_mount_finish() return error, xfs_mountfs()
will call xfs_log_mount_cancel() to clean AIL list, and call
xfs_buftarg_drain() 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: Ye Bin <yebin10@huawei.com>
---
fs/xfs/xfs_log.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 817ea7e0a8ab..b91892733b78 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -765,7 +765,9 @@ xfs_log_mount_finish(
} else {
xfs_info(mp, "Ending clean mount");
}
- xfs_buftarg_drain(mp->m_ddev_targp);
+
+ if (!error)
+ xfs_buftarg_drain(mp->m_ddev_targp);
clear_bit(XLOG_RECOVERY_NEEDED, &log->l_opstate);
--
2.31.1
reply other threads:[~2024-10-10 9:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241010093835.1506926-1-yebin@huaweicloud.com \
--to=yebin@huaweicloud.com \
--cc=chandan.babu@oracle.com \
--cc=dchinner@redhat.com \
--cc=djwong@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=yebin10@huawei.com \
--cc=zhangxiaoxu5@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®