linux-stable/fs/xfs
Darrick J. Wong 5d1116d4c6 xfs: periodically yield scrub threads to the scheduler
Christoph Hellwig complained about the following soft lockup warning
when running scrub after generic/175 when preemption is disabled and
slub debugging is enabled:

watchdog: BUG: soft lockup - CPU#3 stuck for 22s! [xfs_scrub:161]
Modules linked in:
irq event stamp: 41692326
hardirqs last  enabled at (41692325): [<ffffffff8232c3b7>] _raw_0
hardirqs last disabled at (41692326): [<ffffffff81001c5a>] trace0
softirqs last  enabled at (41684994): [<ffffffff8260031f>] __do_e
softirqs last disabled at (41684987): [<ffffffff81127d8c>] irq_e0
CPU: 3 PID: 16189 Comm: xfs_scrub Not tainted 5.4.0-rc3+ #30
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.124
RIP: 0010:_raw_spin_unlock_irqrestore+0x39/0x40
Code: 89 f3 be 01 00 00 00 e8 d5 3a e5 fe 48 89 ef e8 ed 87 e5 f2
RSP: 0018:ffffc9000233f970 EFLAGS: 00000286 ORIG_RAX: ffffffffff3
RAX: ffff88813b398040 RBX: 0000000000000286 RCX: 0000000000000006
RDX: 0000000000000006 RSI: ffff88813b3988c0 RDI: ffff88813b398040
RBP: ffff888137958640 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffffea00042b0c00
R13: 0000000000000001 R14: ffff88810ac32308 R15: ffff8881376fc040
FS:  00007f6113dea700(0000) GS:ffff88813bb80000(0000) knlGS:00000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f6113de8ff8 CR3: 000000012f290000 CR4: 00000000000006e0
Call Trace:
 free_debug_processing+0x1dd/0x240
 __slab_free+0x231/0x410
 kmem_cache_free+0x30e/0x360
 xchk_ag_btcur_free+0x76/0xb0
 xchk_ag_free+0x10/0x80
 xchk_bmap_iextent_xref.isra.14+0xd9/0x120
 xchk_bmap_iextent+0x187/0x210
 xchk_bmap+0x2e0/0x3b0
 xfs_scrub_metadata+0x2e7/0x500
 xfs_ioc_scrub_metadata+0x4a/0xa0
 xfs_file_ioctl+0x58a/0xcd0
 do_vfs_ioctl+0xa0/0x6f0
 ksys_ioctl+0x5b/0x90
 __x64_sys_ioctl+0x11/0x20
 do_syscall_64+0x4b/0x1a0
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

If preemption is disabled, all metadata buffers needed to perform the
scrub are already in memory, and there are a lot of records to check,
it's possible that the scrub thread will run for an extended period of
time without sleeping for IO or any other reason.  Then the watchdog
timer or the RCU stall timeout can trigger, producing the backtrace
above.

To fix this problem, call cond_resched() from the scrub thread so that
we back out to the scheduler whenever necessary.

Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
2019-11-07 13:00:53 -08:00
..
libxfs xfs: decrease indenting problems in xfs_dabuf_map 2019-11-05 08:28:27 -08:00
scrub xfs: periodically yield scrub threads to the scheduler 2019-11-07 13:00:53 -08: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: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
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 2019-11-04 13:55:54 -08:00
xfs_acl.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_aops.c xfs: add a xfs_inode_buftarg helper 2019-10-28 08:37:54 -07:00
xfs_aops.h xfs: add a xfs_inode_buftarg helper 2019-10-28 08:37:54 -07:00
xfs_attr_inactive.c xfs: always log corruption errors 2019-11-04 13:55:54 -08:00
xfs_attr_list.c xfs: always log corruption errors 2019-11-04 13:55:54 -08: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 2019-11-04 13:55:54 -08: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: move extent zeroing to xfs_bmapi_allocate 2019-11-03 10:22:30 -08:00
xfs_bmap_util.h xfs: simplify xfs_iomap_eof_align_last_fsb 2019-11-03 10:22:30 -08:00
xfs_buf.c xfs: simplify setting bio flags 2019-10-29 09:50:12 -07:00
xfs_buf.h xfs: mark xfs_buf_free static 2019-10-28 08:37:54 -07:00
xfs_buf_item.c fs: xfs: Remove KM_NOSLEEP and KM_SLEEP. 2019-08-26 12:06:22 -07: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: namecheck directory entry names before listing them 2019-10-29 09:50:11 -07:00
xfs_discard.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_discard.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
xfs_dquot.c xfs: replace -EIO with -EFSCORRUPTED for corrupt metadata 2019-10-29 09:50:11 -07:00
xfs_dquot.h xfs: remove the debug-only q_transp field from struct xfs_dquot 2019-06-12 08:59:59 -07:00
xfs_dquot_item.c fs: xfs: Remove KM_NOSLEEP and KM_SLEEP. 2019-08-26 12:06:22 -07:00
xfs_dquot_item.h xfs: remove the xfs_log_item_t typedef 2019-06-28 19:27:33 -07:00
xfs_error.c xfs: use super s_id instead of struct xfs_mount m_fsname 2019-11-05 08:28:25 -08:00
xfs_error.h xfs: always log corruption errors 2019-11-04 13:55:54 -08:00
xfs_export.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_export.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_extent_busy.c xfs: cleanup use of the XFS_ALLOC_ flags 2019-11-03 10:22:31 -08:00
xfs_extent_busy.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_extfree_item.c xfs: always log corruption errors 2019-11-04 13:55:54 -08: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: properly serialise fallocate against AIO+DIO 2019-10-31 09:17:55 -07:00
xfs_filestream.c xfs: cleanup use of the XFS_ALLOC_ flags 2019-11-03 10:22:31 -08:00
xfs_filestream.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_fsmap.c xfs: add missing assert in xfs_fsmap_owner_from_rmap 2019-11-05 08:28:27 -08:00
xfs_fsmap.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07: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 fs: xfs: Remove KM_NOSLEEP and KM_SLEEP. 2019-08-26 12:06:22 -07: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: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_inode.c xfs: always log corruption errors 2019-11-04 13:55:54 -08:00
xfs_inode.h xfs: add a xfs_inode_buftarg helper 2019-10-28 08:37:54 -07:00
xfs_inode_item.c xfs: always log corruption errors 2019-11-04 13:55:54 -08: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: properly serialise fallocate against AIO+DIO 2019-10-31 09:17:55 -07:00
xfs_ioctl.h fs: add generic UNRESVSP and ZERO_RANGE ioctl handlers 2019-10-28 08:37:55 -07:00
xfs_ioctl32.c fs: add generic UNRESVSP and ZERO_RANGE ioctl handlers 2019-10-28 08:37:55 -07:00
xfs_ioctl32.h xfs: remove various bulk request typedef usage 2019-07-03 20:36:25 -07:00
xfs_iomap.c xfs: simplify the xfs_iomap_write_direct calling 2019-11-03 10:22:30 -08:00
xfs_iomap.h xfs: simplify the xfs_iomap_write_direct calling 2019-11-03 10:22:30 -08:00
xfs_iops.c xfs: always log corruption errors 2019-11-04 13:55:54 -08:00
xfs_iops.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
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: make the assertion message functions take a mount parameter 2019-11-05 08:28:27 -08:00
xfs_log.c xfs: use super s_id instead of struct xfs_mount m_fsname 2019-11-05 08:28:25 -08: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: turn ic_state into an enum 2019-10-21 09:04:58 -07:00
xfs_log_priv.h xfs: remove the XLOG_STATE_DO_CALLBACK state 2019-10-21 09:04:58 -07:00
xfs_log_recover.c xfs: always log corruption errors 2019-11-04 13:55:54 -08:00
xfs_message.c xfs: make the assertion message functions take a mount parameter 2019-11-05 08:28:27 -08:00
xfs_message.h xfs: make the assertion message functions take a mount parameter 2019-11-05 08:28:27 -08:00
xfs_mount.c xfs: use super s_id instead of struct xfs_mount m_fsname 2019-11-05 08:28:25 -08:00
xfs_mount.h xfs: use super s_id instead of struct xfs_mount m_fsname 2019-11-05 08:28:25 -08: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: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_ondisk.h xfs: wire up the v5 inumbers ioctl 2019-07-03 20:36:28 -07:00
xfs_pnfs.c xfs: use super s_id instead of struct xfs_mount m_fsname 2019-11-05 08:28:25 -08:00
xfs_pnfs.h xfs: prepare xfs_break_layouts() for another layout type 2018-05-22 07:19:08 -07:00
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: always log corruption errors 2019-11-04 13:55:54 -08: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 unused header files 2019-06-28 19:30:43 -07:00
xfs_qm_syscalls.c xfs: remove unused header files 2019-06-28 19:30:43 -07: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 2019-10-24 08:05:24 -07:00
xfs_refcount_item.c xfs: always log corruption errors 2019-11-04 13:55:54 -08: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: don't set bmapi total block req where minleft is 2019-10-23 17:01:08 -07:00
xfs_reflink.h xfs: pass two imaps to xfs_reflink_allocate_cow 2019-10-21 09:04:58 -07:00
xfs_rmap_item.c xfs: always log corruption errors 2019-11-04 13:55:54 -08: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: don't set bmapi total block req where minleft is 2019-10-23 17:01:08 -07:00
xfs_rtalloc.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_stats.c xfs: remove unused header files 2019-06-28 19:30:43 -07: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: remove redundant assignment to variable error 2019-11-06 08:07:46 -08:00
xfs_super.h xfs: include QUOTA, FATAL ASSERT build options in XFS_BUILD_OPTIONS 2019-10-21 09:04:57 -07:00
xfs_symlink.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_symlink.h xfs: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
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: convert to SPDX license tags 2018-06-06 14:17:53 -07:00
xfs_trace.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_trace.h xfs: rename the m_writeio_* fields in struct xfs_mount 2019-10-29 09:50:12 -07:00
xfs_trans.c fs: xfs: Remove KM_NOSLEEP and KM_SLEEP. 2019-08-26 12:06:22 -07: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: use super s_id instead of struct xfs_mount m_fsname 2019-11-05 08:28:25 -08:00
xfs_trans_buf.c xfs: remove unused header files 2019-06-28 19:30:43 -07:00
xfs_trans_dquot.c fs: xfs: Remove KM_NOSLEEP and KM_SLEEP. 2019-08-26 12:06:22 -07:00
xfs_trans_priv.h xfs: don't use xfs_trans_free_items in the commit path 2019-06-28 19:27:31 -07:00
xfs_xattr.c xfs: allocate xattr buffer on demand 2019-08-30 22:43:57 -07:00