402 Star 1.4K Fork 1.3K

GVPopenEuler / kernel

 / 详情

WARNING in ext4_file_write_iter

已完成
缺陷
创建于  
2022-05-19 15:47

【标题描述】WARNING in ext4_file_write_iter
【环境信息】
硬件信息:不涉及
软件信息:5.10-OLK、openEuler-22.03-LTS
【问题复现步骤】
假设:

inode.i_size=4096
EXT4_I(inode)->i_disksize=4096
第一步把文件大小变成8192
ext4_setattr
  if (attr->ia_size != inode->i_size)
    EXT4_I(inode)->i_disksize = attr->ia_size;
    rc = ext4_mark_inode_dirty
       ext4_reserve_inode_write
          ext4_get_inode_loc
            __ext4_get_inode_loc
              sb_getblk --> return -ENOMEM
   ... 
   if (!error)  ->will not update i_size
     i_size_write(inode, attr->ia_size); 

经过上面的操作后:

inode.i_size=4096
EXT4_I(inode)->i_disksize=8192

ext4_file_write_iter
 ext4_dio_write_iter
   iomap_dio_rw ->return error
 if (extend)
   ext4_handle_inode_extension
     WARN_ON_ONCE(i_size_read(inode) < EXT4_I(inode)->i_disksize);

->此时inode.i_size=4096 EXT4_I(inode)->i_disksize=8192 那么触发告警

出现概率(是否必现,概率性错误)大概率
【预期结果】
内核error
【实际结果】

EXT4-fs error (device loop0) in ext4_setattr:5519: Out of memory
EXT4-fs error (device loop0): ext4_ind_map_blocks:595: inode #13: comm syz-executor.0: Can't allocate blocks for non-extent mapped inodes with bigalloc

【附件信息】
错误信息:

WARNING: CPU: 1 PID: 4361 at fs/ext4/file.c:301 ext4_handle_inode_extension fs/ext4/file.c:301 [inline]
WARNING: CPU: 1 PID: 4361 at fs/ext4/file.c:301 ext4_dio_write_iter fs/ext4/file.c:575 [inline]
WARNING: CPU: 1 PID: 4361 at fs/ext4/file.c:301 ext4_file_write_iter+0x11c9/0x1220 fs/ext4/file.c:679
Modules linked in:
CPU: 1 PID: 4361 Comm: syz-executor.0 Not tainted 5.10.0+ #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
RIP: 0010:ext4_handle_inode_extension fs/ext4/file.c:301 [inline]
RIP: 0010:ext4_dio_write_iter fs/ext4/file.c:575 [inline]
RIP: 0010:ext4_file_write_iter+0x11c9/0x1220 fs/ext4/file.c:679
Code: ff e8 eb 47 ca ff 49 c7 c5 ff ff ff ff e9 9e f6 ff ff e8 da 47 ca ff 49 c7 c5 ff ff ff ff 31 ed e9 61 f6 ff ff e8 c7 47 ca ff <0f> 0b 48 8b 5c 24 18 48 89 df e8 d8 23 d2 ff 48 8b 2b e9 e9 f8 ff
RSP: 0018:ffff924d80b27c00 EFLAGS: 00010282
RAX: ffffffff815a3379 RBX: 0000000000000000 RCX: 000000003b000000
RDX: ffff924d81601000 RSI: 00000000000009cc RDI: 00000000000009cd
RBP: 000000000000000d R08: ffffffffbc5a2c6b R09: 0000902e0e52a96f
R10: ffff902e2b7c1b40 R11: ffff902e2b7c1b40 R12: 000000000000000a
R13: 0000000000000001 R14: ffff902e0e52aa10 R15: ffffffffffffff8b
FS:  00007f81a7f65700(0000) GS:ffff902e3bc80000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffffffffff600400 CR3: 000000012db88001 CR4: 00000000003706e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 do_iter_readv_writev+0x2e5/0x360 fs/read_write.c:732
 do_iter_write+0x112/0x4c0 fs/read_write.c:861
 vfs_writev fs/read_write.c:934 [inline]
 do_pwritev+0x1e5/0x390 fs/read_write.c:1031
 __do_sys_pwritev2 fs/read_write.c:1090 [inline]
 __se_sys_pwritev2 fs/read_write.c:1081 [inline]
 __x64_sys_pwritev2+0x7e/0xa0 fs/read_write.c:1081
 do_syscall_64+0x37/0x50 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x46b5e9
Code: 5d db fa ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 2b db fa ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f81a7f64c68 EFLAGS: 00000246 ORIG_RAX: 0000000000000148
RAX: ffffffffffffffda RBX: 000000000077bf60 RCX: 000000000046b5e9
RDX: 0000000000000001 RSI: 0000000020000a40 RDI: 0000000000000003
RBP: 000000000077bf60 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffe2d25b08f R14: 00007f81a7f659c0 R15: 000000000077bf6c
---[ end trace 76ee148b904e722c ]---
EXT4-fs error (device loop0) in ext4_reserve_inode_write:5741: Out of memory
EXT4-fs error (device loop0): ext4_setattr:5462: inode #13: comm syz-executor.0: mark_inode_dirty error
EXT4-fs error (device loop0) in ext4_setattr:5519: Out of memory
EXT4-fs error (device loop0): ext4_ind_map_blocks:595: inode #13: comm syz-executor.0: Can't allocate blocks for non-extent mapped inodes with bigalloc
serio: Serial port tty23
EXT4-fs (loop0): warning: mounting unchecked fs, running e2fsck is recommended
FAT-fs (loop2): bogus number of reserved sectors
FAT-fs (loop2): Can't find a valid FAT filesystem
EXT4-fs (loop0): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs (loop1): warning: mounting unchecked fs, running e2fsck is recommended
EXT4-fs (loop1): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop0) in ext4_reserve_inode_write:5741: Out of memory
EXT4-fs error (device loop0): ext4_setattr:5462: inode #13: comm syz-executor.0: mark_inode_dirty error
FAT-fs (loop2): bogus number of reserved sectors
FAT-fs (loop2): Can't find a valid FAT filesystem
EXT4-fs error (device loop0) in ext4_setattr:5519: Out of memory
EXT4-fs error (device loop0): ext4_ind_map_blocks:595: inode #13: comm syz-executor.0: Can't allocate blocks for non-extent mapped inodes with bigalloc
EXT4-fs (loop1): 1 orphan inode deleted
EXT4-fs (loop1): mounted filesystem without journal. Opts: ,errors=continue

评论 (1)

Li Nan 创建了缺陷

Hi linan888, 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 , @pi3orama , @成坚 (CHENG Jian) , @jiaoff , @zhengzengkai , @Qiuuuuu , @刘勇强 , @Xie XiuQi

openeuler-ci-bot 添加了
 
sig/Kernel
标签
Li Nan 修改了描述
Li Nan 修改了描述
Li Nan 修改了描述
Li Nan 修改了描述
Li Nan 修改了描述
zhengzengkai 通过src-openeuler/kernel Pull Request !629任务状态待办的 修改为已完成

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(2)
5329419 openeuler ci bot 1632792936
C
1
https://gitee.com/openeuler/kernel.git
git@gitee.com:openeuler/kernel.git
openeuler
kernel
kernel

搜索帮助