linux-stable/fs/xfs
Brian Foster 45a841719f xfs: drain the buf delwri queue before xfsaild idles
commit f376b45e86 upstream.

xfsaild is racy with respect to transaction abort and shutdown in
that the task can idle or exit with an empty AIL but buffers still
on the delwri queue. This was partly addressed by cancelling the
delwri queue before the task exits to prevent memory leaks, but it's
also possible for xfsaild to empty and idle with buffers on the
delwri queue. For example, a transaction that pins a buffer that
also happens to sit on the AIL delwri queue will explicitly remove
the associated log item from the AIL if the transaction aborts. The
side effect of this is an unmount hang in xfs_wait_buftarg() as the
associated buffers remain held by the delwri queue indefinitely.
This is reproduced on repeated runs of generic/531 with an fs format
(-mrmapbt=1 -bsize=1k) that happens to also reproduce transaction
aborts.

Update xfsaild to not idle until both the AIL and associated delwri
queue are empty and update the push code to continue delwri queue
submission attempts even when the AIL is empty. This allows the AIL
to eventually release aborted buffers stranded on the delwri queue
when they are unlocked by the associated transaction. This should
have no significant effect on normal runtime behavior because the
xfsaild currently idles only when the AIL is empty and in practice
the AIL is rarely empty with a populated delwri queue. The items
must be AIL resident to land in the queue in the first place and
generally aren't removed until writeback completes.

Note that the pre-existing delwri queue cancel logic in the exit
path is retained because task stop is external, could technically
come at any point, and xfsaild is still responsible to release its
buffer references before it exits.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-11-25 17:42:03 +01:00
..
libxfs xfs: redesign the reflink remap loop to fix blkres depletion crash 2022-11-25 17:42:03 +01:00
scrub xfs: strengthen rmap record flags checking 2020-11-24 13:29:18 +01:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
kmem.c xfs: add kmem_alloc_io() 2019-08-26 17:43:15 -07:00
kmem.h xfs: add kmem_alloc_io() 2019-08-26 17:43:15 -07:00
Makefile xfs: move xfs_trans_inode.c to libxfs/ 2019-07-15 08:10:18 -07:00
mrlock.h
xfs.h xfs: remove b_last_holder & associated macros 2018-08-12 08:37:31 -07:00
xfs_acl.c xfs: always log corruption errors 2022-09-28 11:04:10 +02:00
xfs_acl.h
xfs_aops.c for-linus-20190715 2019-07-15 21:20:52 -07:00
xfs_aops.h xfs: remove the unused xfs_count_page_state declaration 2019-06-30 09:05:17 -07:00
xfs_attr_inactive.c xfs: add a function to deal with corrupt buffers post-verifiers 2022-10-29 10:20:33 +02:00
xfs_attr_list.c xfs: add a function to deal with corrupt buffers post-verifiers 2022-10-29 10:20:33 +02:00
xfs_bio_io.c xfs: chain bios the right way around in xfs_rw_bdev 2019-07-10 10:04:16 -07:00
xfs_bmap_item.c xfs: always log corruption errors 2022-09-28 11:04:10 +02:00
xfs_bmap_item.h xfs: merge xfs_bud_init into xfs_trans_get_bud 2019-06-28 19:27:36 -07:00
xfs_bmap_util.c xfs: preserve rmapbt swapext block reservation from freed blocks 2022-11-25 17:42:03 +01:00
xfs_bmap_util.h xfs: flush removing page cache in xfs_reflink_remap_prep 2018-11-21 10:10:53 -08:00
xfs_buf.c xfs: xfs_buf_corruption_error should take __this_address 2022-10-29 10:20:33 +02:00
xfs_buf.h xfs: add a function to deal with corrupt buffers post-verifiers 2022-10-29 10:20:33 +02:00
xfs_buf_item.c xfs: use bitops interface for buf log item AIL flag check 2022-09-28 11:04:11 +02:00
xfs_buf_item.h xfs: remove the xfs_log_item_t typedef 2019-06-28 19:27:33 -07:00
xfs_dir2_readdir.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_discard.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_discard.h
xfs_dquot.c xfs: use ordered buffers to initialize dquot buffers during quotacheck 2022-11-10 17:57:53 +01:00
xfs_dquot.h xfs: remove the xfs_dq_logitem_t typedef 2022-10-29 10:20:33 +02:00
xfs_dquot_item.c xfs: trylock underlying buffer on dquot flush 2022-10-29 10:20:34 +02:00
xfs_dquot_item.h xfs: factor out quotaoff intent AIL removal and memory free 2022-10-29 10:20:33 +02:00
xfs_error.c xfs: xfs_buf_corruption_error should take __this_address 2022-10-29 10:20:33 +02:00
xfs_error.h xfs: xfs_buf_corruption_error should take __this_address 2022-10-29 10:20:33 +02:00
xfs_export.c xfs: factor out a new xfs_log_force_inode helper 2022-10-29 10:20:34 +02:00
xfs_export.h
xfs_extent_busy.c fs: xfs: Remove KM_NOSLEEP and KM_SLEEP. 2019-08-26 12:06:22 -07:00
xfs_extent_busy.h
xfs_extfree_item.c xfs: always log corruption errors 2022-09-28 11:04:10 +02:00
xfs_extfree_item.h xfs: merge xfs_efd_init into xfs_trans_get_efd 2019-06-28 19:27:35 -07:00
xfs_file.c xfs: use MMAPLOCK around filemap_map_pages() 2022-11-25 17:42:03 +01:00
xfs_filestream.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_filestream.h
xfs_fsmap.c xfs: add missing assert in xfs_fsmap_owner_from_rmap 2022-09-28 11:04:09 +02:00
xfs_fsmap.h xfs: fix deadlock and streamline xfs_getfsmap performance 2020-10-29 09:57:48 +01:00
xfs_fsops.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_fsops.h xfs: change some error-less functions to void types 2019-05-01 20:26:30 -07:00
xfs_globals.c xfs: multithreaded iwalk implementation 2019-07-03 07:33:26 -07:00
xfs_health.c xfs: introduce new v5 bulkstat structure 2019-07-03 20:36:26 -07:00
xfs_icache.c xfs: Don't allow logging of XFS_ISTALE inodes 2020-09-03 11:26:44 +02:00
xfs_icache.h xfs: rename the speculative block allocation reclaim toggle functions 2019-04-26 12:28:55 -07:00
xfs_icreate_item.c fs: xfs: Remove KM_NOSLEEP and KM_SLEEP. 2019-08-26 12:06:22 -07:00
xfs_icreate_item.h
xfs_inode.c xfs: Add the missed xfs_perag_put() for xfs_ifree_cluster() 2022-11-10 17:57:54 +01:00
xfs_inode.h xfs: factor out a new xfs_log_force_inode helper 2022-10-29 10:20:34 +02:00
xfs_inode_item.c xfs: tail updates only need to occur when LSN changes 2022-10-29 10:20:34 +02:00
xfs_inode_item.h xfs: remove the xfs_log_item_t typedef 2019-06-28 19:27:33 -07:00
xfs_ioctl.c xfs: map unwritten blocks in XFS_IOC_{ALLOC,FREE}SP just like fallocate 2022-01-11 15:23:32 +01:00
xfs_ioctl.h xfs: introduce v5 inode group structure 2019-07-03 20:36:27 -07:00
xfs_ioctl32.c xfs: clear kernel only flags in XFS_IOC_ATTRMULTI_BY_HANDLE 2020-03-05 16:43:51 +01:00
xfs_ioctl32.h xfs: remove various bulk request typedef usage 2019-07-03 20:36:25 -07:00
xfs_iomap.c xfs: don't fail unwritten extent conversion on writeback due to edquot 2022-11-10 17:57:54 +01:00
xfs_iomap.h xfs: fix SEEK_DATA for speculative COW fork preallocation 2019-02-21 07:55:07 -08:00
xfs_iops.c xfs: always log corruption errors 2022-09-28 11:04:10 +02:00
xfs_iops.h
xfs_itable.c xfs: remove all *_ITER_ABORT values 2019-08-29 21:22:41 -07:00
xfs_itable.h xfs: remove all *_ITER_ABORT values 2019-08-29 21:22:41 -07:00
xfs_iwalk.c xfs: remove all *_ITER_ABORT values 2019-08-29 21:22:41 -07:00
xfs_iwalk.h xfs: remove all *_ITER_CONTINUE values 2019-08-30 22:43:56 -07:00
xfs_linux.h xfs: use bios directly to read and write the log recovery buffers 2019-06-28 19:27:26 -07:00
xfs_log.c xfs: don't write a corrupt unmount record to force summary counter recalc 2022-10-29 10:20:34 +02:00
xfs_log.h fs: xfs: xfs_log: Change return type from int to void 2019-07-03 08:21:58 -07:00
xfs_log_cil.c xfs: fix use-after-free on CIL context on shutdown 2022-10-29 10:20:34 +02:00
xfs_log_priv.h xfs: fix use-after-free on CIL context on shutdown 2022-10-29 10:20:34 +02:00
xfs_log_recover.c xfs: remove the xfs_disk_dquot_t and xfs_dquot_t 2022-10-29 10:20:33 +02:00
xfs_message.c xfs: constify the buffer pointer arguments to error functions 2022-09-28 11:04:10 +02:00
xfs_message.h xfs: constify the buffer pointer arguments to error functions 2022-09-28 11:04:10 +02:00
xfs_mount.c xfs: don't commit sunit/swidth updates to disk if that would cause repair failures 2022-09-28 11:04:11 +02:00
xfs_mount.h xfs: move inode flush to the sync workqueue 2022-10-29 10:20:34 +02:00
xfs_mru_cache.c fs: xfs: Remove KM_NOSLEEP and KM_SLEEP. 2019-08-26 12:06:22 -07:00
xfs_mru_cache.h
xfs_ondisk.h xfs: wire up the v5 inumbers ioctl 2019-07-03 20:36:28 -07:00
xfs_pnfs.c xfs: slightly tweak an assert in xfs_fs_map_blocks 2022-09-28 11:04:09 +02:00
xfs_pnfs.h
xfs_pwork.c xfs: poll waiting for quotacheck 2019-07-03 08:21:58 -07:00
xfs_pwork.h xfs: poll waiting for quotacheck 2019-07-03 08:21:58 -07:00
xfs_qm.c xfs: clear XFS_DQ_FREEING if we can't lock the dquot buffer to flush 2022-11-03 23:56:54 +09:00
xfs_qm.h xfs: widen quota block counters to 64-bit integers 2019-04-23 08:36:23 -07:00
xfs_qm_bhv.c xfs: remove the xfs_disk_dquot_t and xfs_dquot_t 2022-10-29 10:20:33 +02:00
xfs_qm_syscalls.c xfs: fix unmount hang and memory leak on shutdown during quotaoff 2022-10-29 10:20:33 +02:00
xfs_quota.h xfs: kill the xfs_dqtrx_t typedef 2019-04-23 08:36:23 -07:00
xfs_quotaops.c xfs: Sanity check flags of Q_XQUOTARM call 2020-01-26 10:00:59 +01:00
xfs_refcount_item.c xfs: always log corruption errors 2022-09-28 11:04:10 +02:00
xfs_refcount_item.h xfs: merge xfs_cud_init into xfs_trans_get_cud 2019-06-28 19:27:35 -07:00
xfs_reflink.c xfs: redesign the reflink remap loop to fix blkres depletion crash 2022-11-25 17:42:03 +01:00
xfs_reflink.h xfs: don't pass iomap flags to xfs_reflink_allocate_cow 2019-02-25 09:04:31 -08:00
xfs_rmap_item.c xfs: always log corruption errors 2022-09-28 11:04:10 +02:00
xfs_rmap_item.h xfs: merge xfs_rud_init into xfs_trans_get_rud 2019-06-28 19:27:36 -07:00
xfs_rtalloc.c xfs: fix realtime bitmap/summary file truncation when growing rt volume 2020-11-05 11:43:14 +01:00
xfs_rtalloc.h
xfs_stats.c xfs: Use scnprintf() for avoiding potential buffer overflow 2022-10-29 10:20:33 +02:00
xfs_stats.h xfs: use offsetof() in place of offset macros for __xfsstats 2018-10-18 17:21:39 +11:00
xfs_super.c xfs: preserve inode versioning across remounts 2022-11-25 17:42:03 +01:00
xfs_super.h xfs: include WARN, REPAIR build options in XFS_BUILD_OPTIONS 2019-06-12 08:37:40 -07:00
xfs_symlink.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_symlink.h
xfs_sysctl.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_sysctl.h xfs: multithreaded iwalk implementation 2019-07-03 07:33:26 -07:00
xfs_sysfs.c xfs: avoid unused to_mp() function warning 2019-09-24 09:40:19 -07:00
xfs_sysfs.h xfs: Fix UBSAN null-ptr-deref in xfs_sysfs_init 2020-08-26 10:40:58 +02:00
xfs_trace.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_trace.h xfs: redesign the reflink remap loop to fix blkres depletion crash 2022-11-25 17:42:03 +01:00
xfs_trans.c xfs: preserve rmapbt swapext block reservation from freed blocks 2022-11-25 17:42:03 +01:00
xfs_trans.h xfs: merge xfs_trans_bmap.c into xfs_bmap_item.c 2019-06-28 19:29:42 -07:00
xfs_trans_ail.c xfs: drain the buf delwri queue before xfsaild idles 2022-11-25 17:42:03 +01:00
xfs_trans_buf.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_trans_dquot.c xfs: group quota should return EDQUOT when prj quota enabled 2022-11-10 17:57:54 +01:00
xfs_trans_priv.h xfs: tail updates only need to occur when LSN changes 2022-10-29 10:20:34 +02:00
xfs_xattr.c xfs: allocate xattr buffer on demand 2019-08-30 22:43:57 -07:00