diff options
author | Theodore Ts'o <tytso@mit.edu> | 2019-11-19 21:54:15 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2019-12-26 11:28:23 -0500 |
commit | 878520ac45f9f698432d4276db3d9144b83931b6 (patch) | |
tree | 4d2eb8c8fd49bd852ca2be77e53798fa4b19dbdd /fs/ext4/ialloc.c | |
parent | a562c687d115fe5a90be1e27745cc771c1e6cbd9 (diff) | |
download | linux-878520ac45f9f698432d4276db3d9144b83931b6.tar.gz linux-878520ac45f9f698432d4276db3d9144b83931b6.tar.bz2 linux-878520ac45f9f698432d4276db3d9144b83931b6.zip |
ext4: save the error code which triggered an ext4_error() in the superblock
This allows the cause of an ext4_error() report to be categorized
based on whether it was triggered due to an I/O error, or an memory
allocation error, or other possible causes. Most errors are caused by
a detected file system inconsistency, so the default code stored in
the superblock will be EXT4_ERR_EFSCORRUPTED.
Link: https://lore.kernel.org/r/20191204032335.7683-1-tytso@mit.edu
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ialloc.c')
-rw-r--r-- | fs/ext4/ialloc.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 8ca4a23129aa..0151ba8ea439 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c @@ -194,6 +194,7 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) wait_on_buffer(bh); if (!buffer_uptodate(bh)) { put_bh(bh); + ext4_set_errno(sb, EIO); ext4_error(sb, "Cannot read inode bitmap - " "block_group = %u, inode_bitmap = %llu", block_group, bitmap_blk); @@ -1223,6 +1224,7 @@ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino) inode = ext4_iget(sb, ino, EXT4_IGET_NORMAL); if (IS_ERR(inode)) { err = PTR_ERR(inode); + ext4_set_errno(sb, -err); ext4_error(sb, "couldn't read orphan inode %lu (err %d)", ino, err); return inode; |