【标题描述】ubifs在提交异常后umount触发断言失败UBIFS assert failed: freed == n
【环境信息】
硬件信息:
NA
软件信息:
OLK-5.10
【问题复现步骤】
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
index 488f3da7a6c6..f081aaffe9d8 100644
--- a/fs/ubifs/tnc.c
+++ b/fs/ubifs/tnc.c
@@ -3068,6 +3068,7 @@ void ubifs_tnc_close(struct ubifs_info *c)
n = atomic_long_read(&c->clean_zn_cnt);
freed = ubifs_destroy_tnc_subtree(c, c->zroot.znode);
+ pr_err("free %ld n %ld\n", freed, n);
ubifs_assert(c, freed == n);
atomic_long_sub(n, &ubifs_clean_zn_cnt);
}
diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c
index 01362ad5f804..9d9d379efb0e 100644
--- a/fs/ubifs/tnc_commit.c
+++ b/fs/ubifs/tnc_commit.c
@@ -989,7 +989,7 @@ static int write_index(struct ubifs_info *c)
}
/* The buffer is full or there are no more znodes to do */
- err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs, blen);
+ err = -EIO;
if (err)
return err;
buf_offs += blen;
setup.sh
#!/bin/bash
set -e
TMP=/root/temp
umount $TMP 2>/dev/null || true
mkdir -p $TMP
modprobe -r ubifs 2>/dev/null || true
for i in $(seq 0 1)
do
ubidetach -p /dev/mtd$i 2>/dev/null || true
done
modprobe -r ubi 2>/dev/null || true
modprobe -r nandsim 2>/dev/null || true
mtd=/dev/mtd0
ubi=/dev/ubi0
ID="0xec,0xa1,0x00,0x15" # 128M 128KB 2KB
#ID="0x20,0xa5,0x00,0x15" # 2GB 128KB PEB, 2KB page
#ID="0x20,0xa5,0x00,0x26" # 4G 256KB 4KB 1KB-sub-page
#ID="0x20,0xa7,0x00,0x26" # 4G 256KB 4KB 2KB-sub-page
#ID="0x20,0x33,0x00,0x00" # 16M 16KB PEB, 512 page
modprobe nandsim id_bytes=$ID
# https://github.com/google/fscryptctl
encryption()
{
head -c 64 /dev/urandom > /tmp/key
key=$(/root/fscryptctl/fscryptctl add_key $TMP < /tmp/key)
/root/fscryptctl/fscryptctl set_policy $key $TMP
/root/fscryptctl/fscryptctl get_policy $TMP
}
authentication()
{
keyctl clear @s
keyctl add logon ubifs:foo 12345678901234567890123456789012 @s
}
flash_eraseall /dev/mtd0
if [ "$1" == "1" ]
then
modprobe ubi mtd="0,2048" fm_autoconvert
ubimkvol -N vol_a -m -n 0 /dev/ubi0
modprobe ubifs
# mkfs.ubifs -j 6221824 -R 0 /dev/ubi0_0
if [ "$2" == "a" ]
then
authentication
mount -t ubifs /dev/ubi0_0 -o auth_key=ubifs:foo,auth_hash_name=sha256 $TMP
else
mount -t ubifs /dev/ubi0_0 $TMP
fi
if [ "$2" == "e" ]
then
encryption
fi
else
nandwrite /dev/mtd0 disk > /dev/null
modprobe ubi mtd="0,2048" fm_autoconvert
modprobe ubifs
#echo 1 > /sys/kernel/debug/ubifs/chk_fs
mount -t ubifs /dev/ubi0_0 $TMP
fi
Hi czh549642238, 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: @YangYingliang , @成坚 (CHENG Jian) , @jiaoff , @zhengzengkai , @刘勇强 , @wangxiongfeng , @朱科潜 , @WangShaoBo , @lujialin , @wuxu_buque , @Xu Kuohai , @冷嘲啊 , @Lingmingqiang , @yuzenghui , @juntian , @OSSIM , @陈结松 , @whoisxxx , @koulihong , @刘恺 , @hanjun-guo , @woqidaideshi , @Chiqijun , @Kefeng , @ThunderTown , @AlexGuo , @kylin-mayukun , @Zheng Zucheng , @柳歆 , @Jackie Liu , @zhujianwei001 , @郑振鹏 , @SuperSix173 , @colyli , @Zhang Yi , @htforge , @Qiuuuuu , @Yuehaibing , @xiehaocheng , @guzitao , @CTC-Xibo.Wang , @zhanghongchen , @chen wei , @Jason Zeng , @苟浩 , @DuanqiangWen , @georgeguo , @毛泓博 , @AllenShi , @zhangjialin , @Xie XiuQi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
登录 后才可以发表评论