Commit de01f48
ext4: prevent getting empty inode buffer
In ext4_get_inode_loc(), we may skip IO and get an zero && uptodate
inode buffer when the inode monopolize an inode block for performance
reason. For most cases, ext4_mark_iloc_dirty() will fill the inode
buffer to make it fine, but we could miss this call if something bad
happened. Finally, __ext4_get_inode_loc_noinmem() may probably get an
empty inode buffer and trigger ext4 error.
For example, if we remove a nonexistent xattr on inode A,
ext4_xattr_set_handle() will return ENODATA before invoking
ext4_mark_iloc_dirty(), it will left an uptodate but zero buffer. We
will get checksum error message in ext4_iget() when getting inode again.
EXT4-fs error (device sda): ext4_lookup:1784: inode #131074: comm cat: iget: checksum invalid
Even worse, if we allocate another inode B at the same inode block, it
will corrupt the inode A on disk when write back inode B.
So this patch initialize the inode buffer by filling the in-mem inode
contents if we skip read I/O, ensure that the buffer is really uptodate.
Signed-off-by: Zhang Yi <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Theodore Ts'o <[email protected]>1 parent 9a1bf32 commit de01f48
1 file changed
+14
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4380 | 4380 | | |
4381 | 4381 | | |
4382 | 4382 | | |
4383 | | - | |
4384 | | - | |
4385 | | - | |
| 4383 | + | |
| 4384 | + | |
| 4385 | + | |
4386 | 4386 | | |
4387 | 4387 | | |
4388 | | - | |
| 4388 | + | |
4389 | 4389 | | |
4390 | 4390 | | |
4391 | 4391 | | |
| |||
4431 | 4431 | | |
4432 | 4432 | | |
4433 | 4433 | | |
4434 | | - | |
| 4434 | + | |
4435 | 4435 | | |
4436 | 4436 | | |
4437 | 4437 | | |
| |||
4459 | 4459 | | |
4460 | 4460 | | |
4461 | 4461 | | |
| 4462 | + | |
| 4463 | + | |
| 4464 | + | |
4462 | 4465 | | |
4463 | 4466 | | |
| 4467 | + | |
| 4468 | + | |
4464 | 4469 | | |
4465 | 4470 | | |
4466 | 4471 | | |
| |||
4521 | 4526 | | |
4522 | 4527 | | |
4523 | 4528 | | |
4524 | | - | |
| 4529 | + | |
4525 | 4530 | | |
4526 | 4531 | | |
4527 | 4532 | | |
| |||
4536 | 4541 | | |
4537 | 4542 | | |
4538 | 4543 | | |
4539 | | - | |
4540 | | - | |
4541 | | - | |
| 4544 | + | |
| 4545 | + | |
4542 | 4546 | | |
4543 | 4547 | | |
4544 | 4548 | | |
| |||
4551 | 4555 | | |
4552 | 4556 | | |
4553 | 4557 | | |
4554 | | - | |
| 4558 | + | |
4555 | 4559 | | |
4556 | 4560 | | |
4557 | 4561 | | |
| |||
0 commit comments