linux/fs/ext4
Theodore Ts'o 80fa46d6b9 ext4: limit the number of retries after discarding preallocations blocks
This patch avoids threads live-locking for hours when a large number
threads are competing over the last few free extents as they blocks
getting added and removed from preallocation pools.  From our bug
reporter:

   A reliable way for triggering this has multiple writers
   continuously write() to files when the filesystem is full, while
   small amounts of space are freed (e.g. by truncating a large file
   -1MiB at a time). In the local filesystem, this can be done by
   simply not checking the return code of write (0) and/or the error
   (ENOSPACE) that is set. Over NFS with an async mount, even clients
   with proper error checking will behave this way since the linux NFS
   client implementation will not propagate the server errors [the
   write syscalls immediately return success] until the file handle is
   closed. This leads to a situation where NFS clients send a
   continuous stream of WRITE rpcs which result in ERRNOSPACE -- but
   since the client isn't seeing this, the stream of writes continues
   at maximum network speed.

   When some space does appear, multiple writers will all attempt to
   claim it for their current write. For NFS, we may see dozens to
   hundreds of threads that do this.

   The real-world scenario of this is database backup tooling (in
   particular, github.com/mdkent/percona-xtrabackup) which may write
   large files (>1TiB) to NFS for safe keeping. Some temporary files
   are written, rewound, and read back -- all before closing the file
   handle (the temp file is actually unlinked, to trigger automatic
   deletion on close/crash.) An application like this operating on an
   async NFS mount will not see an error code until TiB have been
   written/read.

   The lockup was observed when running this database backup on large
   filesystems (64 TiB in this case) with a high number of block
   groups and no free space. Fragmentation is generally not a factor
   in this filesystem (~thousands of large files, mostly contiguous
   except for the parts written while the filesystem is at capacity.)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@kernel.org
2022-09-22 10:51:19 -04:00
..
.kunitconfig
acl.c
acl.h
balloc.c ext4: use ext4_debug() instead of jbd_debug() 2022-08-02 23:52:19 -04:00
bitmap.c
block_validity.c
crypto.c
dir.c
ext4_extents.h
ext4_jbd2.c ext4: use ext4_debug() instead of jbd_debug() 2022-08-02 23:52:19 -04:00
ext4_jbd2.h
ext4.h ext4: use buckets for cr 1 block scan instead of rbtree 2022-09-21 22:12:03 -04:00
extents_status.c
extents_status.h
extents.c ext4: fix bug in extents parsing when eh_entries == 0 and eh_depth > 0 2022-09-22 10:50:54 -04:00
fast_commit.c Add new ioctls to set and get the file system UUID in the ext4 2022-08-04 20:13:46 -07:00
fast_commit.h
file.c
fsmap.c
fsmap.h
fsync.c
hash.c
ialloc.c ext4: make directory inode spreading reflect flexbg size 2022-09-21 22:11:55 -04:00
indirect.c ext4: use ext4_debug() instead of jbd_debug() 2022-08-02 23:52:19 -04:00
inline.c ext4: correct max_inline_xattr_value_size computing 2022-08-02 23:52:44 -04:00
inode-test.c
inode.c Add new ioctls to set and get the file system UUID in the ext4 2022-08-04 20:13:46 -07:00
ioctl.c ext4: add ioctls to get/set the ext4 superblock uuid 2022-08-02 23:56:26 -04:00
Kconfig
Makefile
mballoc.c ext4: limit the number of retries after discarding preallocations blocks 2022-09-22 10:51:19 -04:00
mballoc.h ext4: use buckets for cr 1 block scan instead of rbtree 2022-09-21 22:12:03 -04:00
migrate.c ext4: recover csum seed of tmp_inode after migrating to extents 2022-08-02 23:56:02 -04:00
mmp.c
move_extent.c
namei.c ext4: make sure ext4_append() always allocates new block 2022-08-02 23:56:17 -04:00
orphan.c ext4: use ext4_debug() instead of jbd_debug() 2022-08-02 23:52:19 -04:00
page-io.c
readpage.c
resize.c ext4: avoid resizing to a partial cluster size 2022-08-02 23:56:26 -04:00
super.c - The usual batches of cleanups from Baoquan He, Muchun Song, Miaohe 2022-08-05 16:32:45 -07:00
symlink.c ext4: fix reading leftover inlined symlinks 2022-08-02 23:37:50 -04:00
sysfs.c
truncate.h
verity.c
xattr_hurd.c
xattr_security.c
xattr_trusted.c
xattr_user.c
xattr.c ext4: fix race when reusing xattr blocks 2022-08-02 23:56:25 -04:00
xattr.h ext4: remove EA inode entry from mbcache on inode eviction 2022-08-02 23:56:25 -04:00