linux-stable/fs/xfs
Brian Foster 77ac8f2ad4 xfs: drop submit side trans alloc for append ioends
commit 7cd3099f49 upstream.

Per-inode ioend completion batching has a log reservation deadlock
vector between preallocated append transactions and transactions
that are acquired at completion time for other purposes (i.e.,
unwritten extent conversion or COW fork remaps). For example, if the
ioend completion workqueue task executes on a batch of ioends that
are sorted such that an append ioend sits at the tail, it's possible
for the outstanding append transaction reservation to block
allocation of transactions required to process preceding ioends in
the list.

Append ioend completion is historically the common path for on-disk
inode size updates. While file extending writes may have completed
sometime earlier, the on-disk inode size is only updated after
successful writeback completion. These transactions are preallocated
serially from writeback context to mitigate concurrency and
associated log reservation pressure across completions processed by
multi-threaded workqueue tasks.

However, now that delalloc blocks unconditionally map to unwritten
extents at physical block allocation time, size updates via append
ioends are relatively rare. This means that inode size updates most
commonly occur as part of the preexisting completion time
transaction to convert unwritten extents. As a result, there is no
longer a strong need to preallocate size update transactions.

Remove the preallocation of inode size update transactions to avoid
the ioend completion processing log reservation deadlock. Instead,
continue to send all potential size extending ioends to workqueue
context for completion and allocate the transaction from that
context. This ensures that no outstanding log reservation is owned
by the ioend completion worker task when it begins to process
ioends.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reported-by: Christian Theune <ct@flyingcircus.io>
Link: https://lore.kernel.org/linux-xfs/CAOQ4uxjj2UqA0h4Y31NbmpHksMhVrXfXjLG4Tnz3zq_UR-3gSA@mail.gmail.com/
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-26 11:27:37 +02:00
..
libxfs xfs: don't leak btree cursor when insrec fails after a split 2023-03-22 13:30:06 +01:00
scrub treewide: Change list_sort to use const pointers 2021-09-30 10:11:04 +02:00
Kconfig xfs: fix Kconfig asking about XFS_SUPPORT_V4 when XFS_FS=n 2020-10-16 15:34:28 -07:00
kmem.c xfs: remove kmem_realloc() 2020-09-06 18:05:51 -07:00
kmem.h xfs: Remove kmem_zalloc_large() 2020-09-15 20:52:41 -07:00
Makefile
mrlock.h
xfs.h
xfs_acl.c xfs: Remove kmem_zalloc_large() 2020-09-15 20:52:41 -07:00
xfs_acl.h
xfs_aops.c xfs: drop submit side trans alloc for append ioends 2023-04-26 11:27:37 +02:00
xfs_aops.h
xfs_attr_inactive.c
xfs_attr_list.c xfs: Convert xfs_attr_sf macros to inline functions 2020-09-15 20:52:42 -07:00
xfs_bio_io.c
xfs_bmap_item.c treewide: Change list_sort to use const pointers 2021-09-30 10:11:04 +02:00
xfs_bmap_item.h
xfs_bmap_util.c xfs: set prealloc flag in xfs_alloc_file_space() 2023-03-22 13:30:07 +01:00
xfs_bmap_util.h
xfs_buf.c treewide: Change list_sort to use const pointers 2021-09-30 10:11:04 +02:00
xfs_buf.h xfs: reuse _xfs_buf_read for re-reading the superblock 2020-09-15 20:52:39 -07:00
xfs_buf_item.c xfs: remove dead stale buf unpin handling code 2022-08-03 12:00:51 +02:00
xfs_buf_item.h xfs: move the buffer retry logic to xfs_buf.c 2020-09-15 20:52:38 -07:00
xfs_buf_item_recover.c xfs: Enforce attr3 buffer recovery order 2022-08-03 12:00:51 +02:00
xfs_dir2_readdir.c
xfs_discard.c
xfs_discard.h
xfs_dquot.c xfs: fix incorrect root dquot corruption error when switching group/project quota types 2022-06-09 10:21:29 +02:00
xfs_dquot.h xfs: refactor default quota grace period setting code 2020-09-15 20:52:40 -07:00
xfs_dquot_item.c xfs: xfs_log_force_lsn isn't passed a LSN 2022-08-03 12:00:50 +02:00
xfs_dquot_item.h
xfs_dquot_item_recover.c xfs: rename the ondisk dquot d_flags to d_type 2020-07-28 20:24:14 -07:00
xfs_error.c xfs: ensure xfs_errortag_random_default matches XFS_ERRTAG_MAX 2022-07-07 17:52:19 +02:00
xfs_error.h
xfs_export.c xfs: delete duplicated words + other fixes 2020-08-05 08:49:58 -07:00
xfs_export.h
xfs_extent_busy.c xfs: don't reuse busy extents on extent trim 2023-04-05 11:23:43 +02:00
xfs_extent_busy.h treewide: Change list_sort to use const pointers 2021-09-30 10:11:04 +02:00
xfs_extfree_item.c xfs: use kmem_cache_free() for kmem_cache objects 2022-07-02 16:39:23 +02:00
xfs_extfree_item.h
xfs_file.c xfs: set prealloc flag in xfs_alloc_file_space() 2023-03-22 13:30:07 +01:00
xfs_filestream.c xfs: fix soft lockup via spinning in filestream ag selection loop 2022-09-05 10:28:59 +02:00
xfs_filestream.h
xfs_fsmap.c xfs: fix deadlock and streamline xfs_getfsmap performance 2020-10-07 08:40:29 -07:00
xfs_fsmap.h xfs: fix deadlock and streamline xfs_getfsmap performance 2020-10-07 08:40:29 -07:00
xfs_fsops.c xfs: fix overfilling of reserve pool 2022-09-05 10:28:58 +02:00
xfs_fsops.h
xfs_globals.c
xfs_health.c
xfs_icache.c xfs: fix I_DONTCACHE 2022-08-21 15:15:21 +02:00
xfs_icache.h
xfs_icreate_item.c xfs: Remove kmem_zone_zalloc() usage 2020-07-28 20:24:14 -07:00
xfs_icreate_item.h
xfs_inode.c xfs: reorder iunlink remove operation in xfs_ifree 2022-09-28 11:10:28 +02:00
xfs_inode.h xfs: widen ondisk inode timestamps to deal with y2038+ 2020-09-15 20:52:41 -07:00
xfs_inode_item.c xfs: xfs_log_force_lsn isn't passed a LSN 2022-08-03 12:00:50 +02:00
xfs_inode_item.h xfs: xfs_log_force_lsn isn't passed a LSN 2022-08-03 12:00:50 +02:00
xfs_inode_item_recover.c xfs: logging the on disk inode LSN can make it go backwards 2022-08-03 12:00:51 +02:00
xfs_ioctl.c xfs: reject crazy array sizes being fed to XFS_IOC_GETBMAP* 2022-08-31 17:15:14 +02:00
xfs_ioctl.h xfs: prevent a WARN_ONCE() in xfs_ioc_attr_list() 2022-08-31 17:15:14 +02:00
xfs_ioctl32.c
xfs_ioctl32.h
xfs_iomap.c xfs: only set IOMAP_F_SHARED when providing a srcmap to a write 2022-08-21 15:15:21 +02:00
xfs_iomap.h
xfs_iops.c xfs: use setattr_copy to set vfs inode attributes 2023-03-22 13:30:07 +01:00
xfs_iops.h xfs: remove xfs_setattr_time() declaration 2023-03-22 13:30:08 +01:00
xfs_itable.c
xfs_itable.h
xfs_iwalk.c xfs: fix the forward progress assertion in xfs_iwalk_run_callbacks 2022-06-06 08:42:41 +02:00
xfs_iwalk.h
xfs_linux.h xfs: fix fallocate functions when rtextsize is larger than 1 2020-10-21 09:05:19 -07:00
xfs_log.c xfs: force the log offline when log intent item recovery fails 2022-08-03 12:00:51 +02:00
xfs_log.h xfs: xfs_log_force_lsn isn't passed a LSN 2022-08-03 12:00:50 +02:00
xfs_log_cil.c xfs: prevent UAF in xfs_log_item_in_current_chkpt 2022-08-03 12:00:51 +02:00
xfs_log_priv.h xfs: xfs_log_force_lsn isn't passed a LSN 2022-08-03 12:00:50 +02:00
xfs_log_recover.c mm: Add kvrealloc() 2022-08-21 15:15:21 +02:00
xfs_message.c
xfs_message.h treewide: Convert macro and uses of __section(foo) to __section("foo") 2020-10-25 14:51:49 -07:00
xfs_mount.c xfs: don't assert fail on perag references on teardown 2023-03-22 13:30:06 +01:00
xfs_mount.h xfs: remove infinite loop when reserving free block pool 2022-09-05 10:28:58 +02:00
xfs_mru_cache.c
xfs_mru_cache.h
xfs_ondisk.h xfs: Remove typedef xfs_attr_shortform_t 2020-09-15 20:52:42 -07:00
xfs_pnfs.c xfs: use setattr_copy to set vfs inode attributes 2023-03-22 13:30:07 +01:00
xfs_pnfs.h
xfs_pwork.c
xfs_pwork.h
xfs_qm.c xfs: purge dquots after inode walk fails during quotacheck 2023-03-22 13:30:06 +01:00
xfs_qm.h xfs: refactor quota expiration timer modification 2020-09-15 20:52:40 -07:00
xfs_qm_bhv.c xfs: rename XFS_DQ_{USER,GROUP,PROJ} to XFS_DQTYPE_* 2020-07-28 20:24:14 -07:00
xfs_qm_syscalls.c xfs: refactor default quota grace period setting code 2020-09-15 20:52:40 -07:00
xfs_quota.h xfs: move the buffer retry logic to xfs_buf.c 2020-09-15 20:52:38 -07:00
xfs_quotaops.c xfs: create xfs_dqtype_t to represent quota types 2020-07-28 20:24:14 -07:00
xfs_refcount_item.c treewide: Change list_sort to use const pointers 2021-09-30 10:11:04 +02:00
xfs_refcount_item.h
xfs_reflink.c xfs: fix xfs_reflink_unshare usage of filemap_write_and_wait_range 2022-07-07 17:52:20 +02:00
xfs_reflink.h
xfs_rmap_item.c treewide: Change list_sort to use const pointers 2021-09-30 10:11:04 +02:00
xfs_rmap_item.h
xfs_rtalloc.c xfs: annotate grabbing the realtime bitmap/summary locks in growfs 2020-10-13 08:41:31 -07:00
xfs_rtalloc.h
xfs_stats.c xfs: periodically relog deferred intent items 2020-10-07 08:40:28 -07:00
xfs_stats.h xfs: periodically relog deferred intent items 2020-10-07 08:40:28 -07:00
xfs_super.c xfs: only bother with sync_filesystem during readonly remount 2022-08-31 17:15:14 +02:00
xfs_super.h
xfs_symlink.c xfs: set inode size after creating symlink 2022-06-09 10:21:29 +02:00
xfs_symlink.h
xfs_sysctl.c xfs: remove deprecated sysctl options 2020-09-25 11:34:08 -07:00
xfs_sysctl.h
xfs_sysfs.c
xfs_sysfs.h xfs: Fix UBSAN null-ptr-deref in xfs_sysfs_init 2020-08-07 11:50:17 -07:00
xfs_trace.c
xfs_trace.h xfs: periodically relog deferred intent items 2020-10-07 08:40:28 -07:00
xfs_trans.c xfs: xfs_log_force_lsn isn't passed a LSN 2022-08-03 12:00:50 +02:00
xfs_trans.h xfs: xfs_log_force_lsn isn't passed a LSN 2022-08-03 12:00:50 +02:00
xfs_trans_ail.c xfs: delete duplicated words + other fixes 2020-08-05 08:49:58 -07:00
xfs_trans_buf.c xfs: simplify xfs_trans_getsb 2020-09-15 20:52:39 -07:00
xfs_trans_dquot.c xfs: shut down the filesystem if we screw up quota reservation 2023-04-05 11:23:43 +02:00
xfs_trans_priv.h
xfs_xattr.c