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>
This commit is contained in:
@@ -3895,6 +3895,7 @@ ext4_mb_discard_group_preallocations(struct super_block *sb,
|
||||
bitmap_bh = ext4_read_block_bitmap(sb, group);
|
||||
if (IS_ERR(bitmap_bh)) {
|
||||
err = PTR_ERR(bitmap_bh);
|
||||
ext4_set_errno(sb, -err);
|
||||
ext4_error(sb, "Error %d reading block bitmap for %u",
|
||||
err, group);
|
||||
return 0;
|
||||
@@ -4063,6 +4064,7 @@ repeat:
|
||||
err = ext4_mb_load_buddy_gfp(sb, group, &e4b,
|
||||
GFP_NOFS|__GFP_NOFAIL);
|
||||
if (err) {
|
||||
ext4_set_errno(sb, -err);
|
||||
ext4_error(sb, "Error %d loading buddy information for %u",
|
||||
err, group);
|
||||
continue;
|
||||
@@ -4071,6 +4073,7 @@ repeat:
|
||||
bitmap_bh = ext4_read_block_bitmap(sb, group);
|
||||
if (IS_ERR(bitmap_bh)) {
|
||||
err = PTR_ERR(bitmap_bh);
|
||||
ext4_set_errno(sb, -err);
|
||||
ext4_error(sb, "Error %d reading block bitmap for %u",
|
||||
err, group);
|
||||
ext4_mb_unload_buddy(&e4b);
|
||||
@@ -4325,6 +4328,7 @@ ext4_mb_discard_lg_preallocations(struct super_block *sb,
|
||||
err = ext4_mb_load_buddy_gfp(sb, group, &e4b,
|
||||
GFP_NOFS|__GFP_NOFAIL);
|
||||
if (err) {
|
||||
ext4_set_errno(sb, -err);
|
||||
ext4_error(sb, "Error %d loading buddy information for %u",
|
||||
err, group);
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user