linux-stable/fs/ext4
Shijie Luo 9424ef56e1 ext4: add cond_resched() to __ext4_find_entry()
We tested a soft lockup problem in linux 4.19 which could also
be found in linux 5.x.

When dir inode takes up a large number of blocks, and if the
directory is growing when we are searching, it's possible the
restart branch could be called many times, and the do while loop
could hold cpu a long time.

Here is the call trace in linux 4.19.

[  473.756186] Call trace:
[  473.756196]  dump_backtrace+0x0/0x198
[  473.756199]  show_stack+0x24/0x30
[  473.756205]  dump_stack+0xa4/0xcc
[  473.756210]  watchdog_timer_fn+0x300/0x3e8
[  473.756215]  __hrtimer_run_queues+0x114/0x358
[  473.756217]  hrtimer_interrupt+0x104/0x2d8
[  473.756222]  arch_timer_handler_virt+0x38/0x58
[  473.756226]  handle_percpu_devid_irq+0x90/0x248
[  473.756231]  generic_handle_irq+0x34/0x50
[  473.756234]  __handle_domain_irq+0x68/0xc0
[  473.756236]  gic_handle_irq+0x6c/0x150
[  473.756238]  el1_irq+0xb8/0x140
[  473.756286]  ext4_es_lookup_extent+0xdc/0x258 [ext4]
[  473.756310]  ext4_map_blocks+0x64/0x5c0 [ext4]
[  473.756333]  ext4_getblk+0x6c/0x1d0 [ext4]
[  473.756356]  ext4_bread_batch+0x7c/0x1f8 [ext4]
[  473.756379]  ext4_find_entry+0x124/0x3f8 [ext4]
[  473.756402]  ext4_lookup+0x8c/0x258 [ext4]
[  473.756407]  __lookup_hash+0x8c/0xe8
[  473.756411]  filename_create+0xa0/0x170
[  473.756413]  do_mkdirat+0x6c/0x140
[  473.756415]  __arm64_sys_mkdirat+0x28/0x38
[  473.756419]  el0_svc_common+0x78/0x130
[  473.756421]  el0_svc_handler+0x38/0x78
[  473.756423]  el0_svc+0x8/0xc
[  485.755156] watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [tmp:5149]

Add cond_resched() to avoid soft lockup and to provide a better
system responding.

Link: https://lore.kernel.org/r/20200215080206.13293-1-luoshijie1@huawei.com
Signed-off-by: Shijie Luo <luoshijie1@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: stable@kernel.org
2020-02-19 23:53:52 -05:00
..
acl.c ext4: compare old and new mode before setting update_mode flag 2018-12-10 00:22:38 -05:00
acl.h ext4: fix up remaining files with SPDX cleanups 2017-12-17 22:00:59 -05:00
balloc.c ext4: simulate various I/O and checksum errors when reading metadata 2019-12-26 11:28:31 -05: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: add cond_resched() to ext4_protect_reserved_inode 2020-02-13 11:56:26 -05:00
dir.c ext4: fix checksum errors with indexed dirs 2020-02-13 11:56:19 -05:00
ext4.h ext4: fix a data race in EXT4_I(inode)->i_disksize 2020-02-19 23:17:02 -05:00
ext4_extents.h ext4: make some functions static in extents.c 2020-01-17 16:24:54 -05:00
ext4_jbd2.c ext4: uninline ext4_inode_journal_mode() 2020-01-17 16:24:52 -05:00
ext4_jbd2.h ext4: uninline ext4_inode_journal_mode() 2020-01-17 16:24:52 -05:00
extents.c ext4: fix extent_status fragmentation for plain files 2020-01-23 12:02:15 -05:00
extents_status.c ext4: use percpu_counters for extent_status cache hits/misses 2019-08-28 11:19:23 -04:00
extents_status.h ext4: fix extent_status trace points 2020-01-25 02:03:03 -05:00
file.c ext4: Optimize ext4 DIO overwrites 2019-12-26 11:57:18 -05:00
fsmap.c ext4: fix miscellaneous sparse warnings 2019-05-12 04:49:47 -04:00
fsmap.h ext4: fix up remaining files with SPDX cleanups 2017-12-17 22:00:59 -05:00
fsync.c ext4: update ext4_sync_file() to not use __generic_file_fsync() 2019-11-05 11:31:40 -05:00
hash.c ext4: fix kernel oops caused by spurious casefold flag 2019-09-03 01:43:17 -04:00
ialloc.c ext4: simulate various I/O and checksum errors when reading metadata 2019-12-26 11:28:31 -05:00
indirect.c ext4: remove ext4_{ind,ext}_calc_metadata_amount() 2020-01-17 16:24:54 -05:00
inline.c ext4,jbd2: fix comment and code style 2020-01-25 02:24:53 -05:00
inode-test.c kunit: allow kunit tests to be loaded as a module 2020-01-09 16:42:29 -07:00
inode.c ext4: fix a data race in EXT4_I(inode)->i_disksize 2020-02-19 23:17:02 -05:00
ioctl.c ext4: Add EXT4_IOC_FSGETXATTR/EXT4_IOC_FSSETXATTR to compat_ioctl 2020-01-17 16:24:55 -05:00
Kconfig This merge window, we've added some performance improvements in how we 2020-01-30 15:17:05 -08:00
Makefile kunit: allow kunit tests to be loaded as a module 2020-01-09 16:42:29 -07:00
mballoc.c ext4: save the error code which triggered an ext4_error() in the superblock 2019-12-26 11:28:23 -05:00
mballoc.h ext4: fix up remaining files with SPDX cleanups 2017-12-17 22:00:59 -05:00
migrate.c ext4: Reserve revoke credits for freed blocks 2019-11-05 16:00:49 -05:00
mmp.c ext4: don't assume that mmp_nodename/bdevname have NUL 2020-02-13 11:53:10 -05:00
move_extent.c ext4: use jbd2_inode dirty range scoping 2019-06-20 17:26:26 -04:00
namei.c ext4: add cond_resched() to __ext4_find_entry() 2020-02-19 23:53:52 -05:00
page-io.c ext4: fix deadlock allocating crypto bounce page from mempool 2020-01-17 16:24:54 -05:00
readpage.c ext4: remove unneeded check for error allocating bio_post_read_ctx 2020-01-17 16:24:54 -05:00
resize.c ext4: drop ext4_kvmalloc() 2020-01-17 16:24:55 -05:00
super.c Miscellaneous ext4 bug fixes (all stable fodder) 2020-02-16 11:12:06 -08:00
symlink.c ext4: switch to fscrypt_get_symlink() 2018-01-11 22:10:40 -05:00
sysfs.c ext4: export information about first/last errors via /sys/fs/ext4/<dev> 2019-12-26 11:29:10 -05:00
truncate.h ext4: handle layout changes to pinned DAX mappings 2018-07-29 17:00:22 -04:00
verity.c fs-verity: implement readahead of Merkle tree pages 2020-01-14 13:27:32 -08:00
xattr.c ext4: drop ext4_kvmalloc() 2020-01-17 16:24:55 -05:00
xattr.h ext4: add extra checks to ext4_xattr_block_get() 2018-03-30 20:04:11 -04:00
xattr_security.c ext4: use XATTR_CREATE in ext4_initxattrs() 2018-05-10 11:52:14 -04: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