diff options
author | Theodore Ts'o <tytso@mit.edu> | 2019-11-21 13:09:43 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2019-12-26 11:28:31 -0500 |
commit | 46f870d690fecc792a66730dcbbf0aa109f5f9ab (patch) | |
tree | 0e517f47ca1c5073481e0d8bfc8631f24388dbca /fs/ext4/balloc.c | |
parent | 878520ac45f9f698432d4276db3d9144b83931b6 (diff) |
ext4: simulate various I/O and checksum errors when reading metadata
This allows us to test various error handling code paths
Link: https://lore.kernel.org/r/20191209012317.59398-1-tytso@mit.edu
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/balloc.c')
-rw-r--r-- | fs/ext4/balloc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 102c38527a10..5f993a411251 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c @@ -371,7 +371,8 @@ static int ext4_validate_block_bitmap(struct super_block *sb, if (buffer_verified(bh)) goto verified; if (unlikely(!ext4_block_bitmap_csum_verify(sb, block_group, - desc, bh))) { + desc, bh) || + ext4_simulate_fail(sb, EXT4_SIM_BBITMAP_CRC))) { ext4_unlock_group(sb, block_group); ext4_error(sb, "bg %u: bad block bitmap checksum", block_group); ext4_mark_group_bitmap_corrupted(sb, block_group, @@ -505,6 +506,7 @@ int ext4_wait_block_bitmap(struct super_block *sb, ext4_group_t block_group, if (!desc) return -EFSCORRUPTED; wait_on_buffer(bh); + ext4_simulate_fail_bh(sb, bh, EXT4_SIM_BBITMAP_EIO); if (!buffer_uptodate(bh)) { ext4_set_errno(sb, EIO); ext4_error(sb, "Cannot read block bitmap - " |