mbox series

[00/11] fix hungtask due to repeated traversal of inodes list

Message ID 20241118114508.1405494-1-yebin@huaweicloud.com (mailing list archive)
Headers show
Series fix hungtask due to repeated traversal of inodes list | expand

Message

Ye Bin Nov. 18, 2024, 11:44 a.m. UTC
From: Ye Bin <yebin10@huawei.com>

As commit 04646aebd30b ("fs: avoid softlockups in s_inodes iterators")
introduces the retry logic. In the problem environment, the 'i_count'
of millions of files is not zero. As a result, the time slice for each
traversal to the matching inode process is almost used up, and then the
traversal is started from scratch. The worst-case scenario is that only
one inode can be processed after each wakeup. Because this process holds
a lock, other processes will be stuck for a long time, causing a series
of problems.
To solve the problem of repeated traversal from the beginning, each time
the CPU needs to be freed, a cursor is inserted into the linked list, and
the traversal continues from the cursor next time.

Ye Bin (11):
  fs: introduce I_CURSOR flag for inode
  block: use sb_for_each_inodes API
  fs: use sb_for_each_inodes API
  gfs2: use sb_for_each_inodes API
  fs: use sb_for_each_inodes_safe API
  fsnotify: use sb_for_each_inodes API
  quota: use sb_for_each_inodes API
  fs/super.c: use sb_for_each_inodes API
  landlock: use sb_for_each_inodes API
  fs: fix hungtask due to repeated traversal of inodes list
  fs: fix potential soft lockup when 'sb->s_inodes' has large number of
    inodes

 block/bdev.c           |  4 +--
 fs/drop_caches.c       |  2 +-
 fs/gfs2/ops_fstype.c   |  2 +-
 fs/inode.c             | 59 ++++++++++++++++++++++++++++--------------
 fs/notify/fsnotify.c   |  2 +-
 fs/quota/dquot.c       |  4 +--
 fs/super.c             |  2 +-
 include/linux/fs.h     | 45 ++++++++++++++++++++++++++++++++
 security/landlock/fs.c |  2 +-
 9 files changed, 93 insertions(+), 29 deletions(-)