linux-stable/fs/ext4
Ye Bin d8116743ef ext4: fix bug on in ext4_es_cache_extent as ext4_split_extent_at failed
commit 082cd4ec24 upstream.

We got follow bug_on when run fsstress with injecting IO fault:
[130747.323114] kernel BUG at fs/ext4/extents_status.c:762!
[130747.323117] Internal error: Oops - BUG: 0 [#1] SMP
......
[130747.334329] Call trace:
[130747.334553]  ext4_es_cache_extent+0x150/0x168 [ext4]
[130747.334975]  ext4_cache_extents+0x64/0xe8 [ext4]
[130747.335368]  ext4_find_extent+0x300/0x330 [ext4]
[130747.335759]  ext4_ext_map_blocks+0x74/0x1178 [ext4]
[130747.336179]  ext4_map_blocks+0x2f4/0x5f0 [ext4]
[130747.336567]  ext4_mpage_readpages+0x4a8/0x7a8 [ext4]
[130747.336995]  ext4_readpage+0x54/0x100 [ext4]
[130747.337359]  generic_file_buffered_read+0x410/0xae8
[130747.337767]  generic_file_read_iter+0x114/0x190
[130747.338152]  ext4_file_read_iter+0x5c/0x140 [ext4]
[130747.338556]  __vfs_read+0x11c/0x188
[130747.338851]  vfs_read+0x94/0x150
[130747.339110]  ksys_read+0x74/0xf0

This patch's modification is according to Jan Kara's suggestion in:
https://patchwork.ozlabs.org/project/linux-ext4/patch/20210428085158.3728201-1-yebin10@huawei.com/
"I see. Now I understand your patch. Honestly, seeing how fragile is trying
to fix extent tree after split has failed in the middle, I would probably
go even further and make sure we fix the tree properly in case of ENOSPC
and EDQUOT (those are easily user triggerable).  Anything else indicates a
HW problem or fs corruption so I'd rather leave the extent tree as is and
don't try to fix it (which also means we will not create overlapping
extents)."

Cc: stable@kernel.org
Signed-off-by: Ye Bin <yebin10@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20210506141042.3298679-1-yebin10@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-10 12:43:51 +02:00
..
acl.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
acl.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
balloc.c ext4: fix potential race between online resizing and write operations 2020-03-11 18:02:42 +01:00
bitmap.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
block_validity.c ext4: check journal inode extents more carefully 2021-03-24 11:04:54 +01:00
dir.c ext4: fix checksum errors with indexed dirs 2020-02-28 16:35:52 +01:00
ext4.h ext4: check journal inode extents more carefully 2021-03-24 11:04:54 +01:00
ext4_extents.h ext4: fix EXT_MAX_EXTENT/INDEX to check for zeroed eh_max 2020-06-20 10:25:15 +02:00
ext4_jbd2.c ext4: shutdown should not prevent get_write_access 2018-04-24 09:36:30 +02:00
ext4_jbd2.h ext4: use jbd2_inode dirty range scoping 2019-07-31 07:28:47 +02:00
extents.c ext4: fix bug on in ext4_es_cache_extent as ext4_split_extent_at failed 2021-06-10 12:43:51 +02:00
extents_status.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
extents_status.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
file.c ext4: fix ext4_dax_read/write inode locking sequence for IOCB_NOWAIT 2020-02-28 16:35:55 +01:00
fsmap.c ext4: limit entries returned when counting fsmap records 2020-10-29 09:07:11 +01:00
fsmap.h ext4: support GETFSMAP ioctls 2017-04-30 00:36:53 -04:00
fsync.c ext4: fix race between ext4_sync_parent() and rename() 2020-06-20 10:25:15 +02:00
hash.c ext4: remove useless test and assignment in strtohash functions 2017-08-24 15:11:34 -04:00
ialloc.c ext4: fix check to prevent false positive report of incorrect used inodes 2021-05-22 10:57:22 +02:00
indirect.c ext4: check journal inode extents more carefully 2021-03-24 11:04:54 +01:00
inline.c ext4: unlock xattr_sem properly in ext4_inline_data_truncate() 2020-11-18 18:27:57 +01:00
inode.c ext4: fix bh ref count on error paths 2021-04-07 12:47:00 +02:00
ioctl.c ext4: fix superblock checksum failure when setting password salt 2021-01-23 15:48:44 +01:00
Kconfig dax: fix build warnings with FS_DAX and !FS_IOMAP 2017-01-24 16:26:14 -08:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mballoc.c ext4: check journal inode extents more carefully 2021-03-24 11:04:54 +01:00
mballoc.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
migrate.c ext4: fix race between writepages and enabling EXT4_EXTENTS_FL 2020-02-28 16:36:13 +01:00
mmp.c ext4: don't assume that mmp_nodename/bdevname have NUL 2020-02-28 16:35:52 +01:00
move_extent.c ext4: use jbd2_inode dirty range scoping 2019-07-31 07:28:47 +02:00
namei.c ext4: correct error label in ext4_rename() 2021-04-28 12:08:43 +02:00
page-io.c ext4: fix deadlock allocating crypto bounce page from mempool 2020-02-14 16:32:19 -05:00
readpage.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
resize.c ext4: fix error handling code in add_new_gdb 2020-11-05 11:07:04 +01:00
super.c ext4: fix error code in ext4_commit_super 2021-05-22 10:57:22 +02:00
symlink.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sysfs.c ext4: sysfs: print ext4_super_block fields as little-endian 2018-09-05 09:26:36 +02:00
truncate.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
xattr.c ext4: add reclaim checks to xattr code 2021-03-30 14:40:12 +02:00
xattr.h ext4: add extra checks to ext4_xattr_block_get() 2018-04-24 09:36:31 +02:00
xattr_security.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
xattr_trusted.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
xattr_user.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00