[home]# mount /dev/sda test
EXT4-fs (sda): warning: mounting fs with errors, running e2fsck is recommended
[home]# dmesg
EXT4-fs (sda): warning: mounting fs with errors, running e2fsck is recommended
EXT4-fs (sda): Errors on filesystem, clearing orphan list.
EXT4-fs (sda): recovery complete
EXT4-fs (sda): mounted filesystem with ordered data mode. Quota mode: none.
[home]# debugfs /dev/sda
debugfs 1.46.5 (30-Dec-2021)
Checksum errors in superblock! Retrying...
checksum正常
Hi cool-water, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here.
If you have any questions, please contact the SIG: Kernel, and any of the maintainers: @Xie XiuQi , @YangYingliang , @成坚 (CHENG Jian) , @jiaoff , @AlexGuo , @hanjun-guo , @woqidaideshi , @zhengzengkai , @Jackie Liu , @Zhang Yi , @colyli , @ThunderTown , @htforge , @Chiqijun , @冷嘲啊 , @zhujianwei001 , @kylin-mayukun , @wangxiongfeng , @Kefeng , @SuperSix173 , @WangShaoBo , @Zheng Zucheng , @lujialin , @陈结松 , @刘恺 , @whoisxxx , @wuxu_buque , @koulihong , @柳歆 , @朱科潜 , @Xu Kuohai , @Lingmingqiang , @juntian , @OSSIM , @郑振鹏 , @刘勇强 , @yuzenghui , @Qiuuuuu , @xiehaocheng , @chen wei , @CTC-Xibo.Wang , @Jason Zeng , @Yuehaibing , @guzitao , @zhanghongchen
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
ext4_orphan_cleanup:
2721 if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) {
2722 /* don't clear list on RO mount w/ errors */
2723 if (es->s_last_orphan && !(s_flags & SB_RDONLY)) {
2724 ext4_msg(sb, KERN_INFO, "Errors on filesystem, "
2725 "clearing orphan list.\n");
2726 es->s_last_orphan = 0;
--> 这里会修改超级块的数据但是不会更新checksum最终可能挂载之后也不会有机会更新checksum
这就导致内存中一直残留着的超级块checksum是错误的
2727 }
2728 jbd_debug(1, "Skipping orphan recovery on fs with errors.\n");
2729 return;
2730 }
复现方式:
一、构造一个有孤儿链表并且有错的镜像
/sdat@localhost home]# mkfs.ext4 -F -E lazy_itable_init=0 -O metadata_csum /dev/sda
mke2fs 1.46.5 (30-Dec-2021)
/dev/sda contains a ext4 file system
last mounted on /home/test on Thu Jun 9 14:21:22 2022
Discarding device blocks: done
Creating filesystem with 262144 4k blocks and 65536 inodes
Filesystem UUID: 8ad7fb1e-4c44-4959-93b0-3653c75f3cdd
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
[root@localhost home]# mount /dev/sda test
[root@localhost home]# mkdir test/orphan
[root@localhost home]# cd test/orphan/
[root@localhost orphan]# rmdir ../orphan/
[root@localhost orphan]# echo 1 > /sys/fs/ext4/sda/trigger_fs_error
[ 383.550331] EXT4-fs error (device sda): trigger_test_error:125: comm bash: 1
[root@localhost orphan]# sync
[root@localhost orphan]# QEMU: Terminated
构造好之后可以把这个镜像备份一份,后面复现和回归可以一直使用该镜像
二、复现问题
[root@localhost home]# mount /dev/sda test
[ 209.355600] EXT4-fs (sda): warning: mounting fs with errors, running e2fsck is recommended
[root@localhost home]# tune2fs -l /dev/sda
tune2fs 1.46.5 (30-Dec-2021)
tune2fs: Superblock checksum does not match superblock while trying to open /dev/sda
Couldn't find valid filesystem superblock.
登录 后才可以发表评论