Commit 9e45cbd2 authored by yangerkun's avatar yangerkun Committed by Long Li
Browse files

xfs: keep growfs sb log item active until ail flush success

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8LHTR


CVE: NA

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

Our growfs test trigger mount error show as below:

[   40.100164] ------------[ cut here ]------------
[   40.101808] WARNING: CPU: 5 PID: 769 at fs/xfs/xfs_buf.c:615 xfs_buf_find+0x40d/0x510
...
[   40.127061] Call Trace:
[   40.127502]  xfs_buf_get_map+0x45/0x240
[   40.128205]  xfs_buf_read_map+0x54/0x230
[   40.129854]  xlog_recover_buf_commit_pass2+0x14e/0x490
[   40.131743]  xlog_recover_items_pass2+0x4d/0xa0
[   40.132605]  xlog_recover_commit_trans+0x325/0x350
[   40.133496]  xlog_recovery_process_trans+0xa7/0xe0
[   40.134408]  xlog_recover_process_data+0x8e/0x130
[   40.135288]  xlog_do_recovery_pass+0x3a4/0x730
[   40.136874]  xlog_do_log_recovery+0x62/0xb0
[   40.137672]  xlog_do_recover+0x34/0x1b0
[   40.138392]  xlog_recover+0xd9/0x170
[   40.139072]  xfs_log_mount+0x17f/0x2e0
[   40.139790]  xfs_mountfs+0x3de/0x8a0
[   40.140473]  xfs_fc_fill_super+0x485/0x7f0
[   40.142095]  get_tree_bdev+0x169/0x260
[   40.142771]  vfs_get_tree+0x1f/0xb0
[   40.143438]  do_new_mount+0x15e/0x2d0
[   40.144141]  __x64_sys_mount+0x101/0x140
[   40.144900]  do_syscall_64+0x2d/0x40
[   40.145591]  entry_SYSCALL_64_after_hwframe+0x61/0xc6
...
[   40.158456] ---[ end trace 0fa38b12a77950ba ]---
[   40.159354] XFS (loop0): log mount/recovery failed: error -117
[   40.160956] XFS (loop0): log mount failed

---------------------------> time line
   +-------------------+----------------+------------------+
   | growfs sb item ...|new agi item ...|growfs sb item ...| SHUTDOWN
   +-------------------+----------------+------------------+
           CTX1               CTX2              CTX3

The testcase do multi growfs and then fail the IO which shutdown the
xfs. Like the upper order, CTX1 add a new ag, CTX2 may log the agi, CTX3
will do another gorwfs. The sb item may still exist in ail after CTX3
iclog bio success, then the item lsn will change, which may change the
tail_lsn.

Then, when we mount the img, and when we recover CTX2, the read for new
agi will fail since the ag number still keep invalid.

Fix it by pin the sb lsn as CTX1, and then mount will first replay CTX1.

Signed-off-by: default avataryangerkun <yangerkun@huawei.com>
Signed-off-by: default avatarLong Li <leo.lilong@huawei.com>
parent 79b4e616
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment