diff options
author | Darrick J. Wong <djwong@kernel.org> | 2021-06-06 10:40:39 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2021-07-23 18:21:43 -0700 |
commit | a3bdb20d2bb1228d180b87d5a4f9103f02a5523f (patch) | |
tree | 449d5be90702bb626e5e5c0cee44e6e7975a640d | |
parent | c8c9cd1a5e06366b261e5226adb385b0931cf42d (diff) |
xfs: cancel enospc inode flush work before unmountingrandom-fixes_2021-07-23
In commit f0f7a674d4df, we moved the code that flushes inodes to disk on
ENOSPC into a workqueue so that we could reduce unnecessary load on the
system by having the writer threads wait on a workqueue item instead of
calling sync_inodes_sb individually.
While this work item should never be running at unmount time, I see
sporadic warnings from the workqueue code while running fstests:
WARNING: CPU: 1 PID: 292913 at kernel/workqueue.c:4407 destroy_workqueue.cold+0x0/0x4b
Modules linked in: xfs libcrc32c ip6t_REJECT nf_reject_ipv6 ipt_REJECT nf_reject_ipv4 xt_tcpudp xt_REDIRECT iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip_set_hash_ip ip_set_hash_net xt_set ip_set_hash_mac bfq ip_set nfnetlink ip6table_filter ip6_tables iptable_filter pvpanic_mmio pvpanic dax_pmem_compat device_dax dax_pmem_core nd_pmem sch_fq_codel ip_tables x_tables overlay nfsv4 af_packet
CPU: 1 PID: 292913 Comm: umount Not tainted 5.13.0-rc4-djwx #rc4
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-1ubuntu1.1 04/01/2014
RIP: 0010:destroy_workqueue.cold+0x0/0x4b
Code: 8b 14 24 4c 89 ef 48 29 d7 e8 3a 77 9f ff b9 e8 03 00 00 31 d2 48 c7 c7 5e 52 e2 81 f7 f1 89 c6 e8 c3 2d 00 00 e9 4f 64 99 ff <0f> 0b 48 c7 c6 00 4e c1 81 48 c7 c7 e0 56 e2 81 48 8d 95 d0 00 00
RSP: 0000:ffffc90006877e18 EFLAGS: 00010002
RAX: ffff88801dd9d000 RBX: ffff888003c51100 RCX: 0000000000000000
RDX: ffff888003c51158 RSI: 0000000000000119 RDI: ffff888002c52c00
RBP: ffff88801dd9d000 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000000 R11: 0000000000000000 R12: ffff88801dd9d020
R13: 0000000000000000 R14: 0000000000000004 R15: 0000000000000003
FS: 00007ff9903df840(0000) GS:ffff88803ed00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000055cfaceb3eb8 CR3: 000000003496d001 CR4: 00000000001706a0
Call Trace:
xfs_destroy_mount_workqueues+0x39/0x60 [xfs]
xfs_fs_put_super+0x59/0xa0 [xfs]
generic_shutdown_super+0x69/0x100
kill_block_super+0x21/0x50
deactivate_locked_super+0x2c/0xa0
cleanup_mnt+0x144/0x1b0
task_work_run+0x59/0xa0
exit_to_user_mode_prepare+0x122/0x130
syscall_exit_to_user_mode+0x1d/0x40
do_syscall_64+0x47/0x70
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7ff9906412cb
Code: 8b 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 90 f3 0f 1e fa 31 f6 e9 05 00 00 00 0f 1f 44 00 00 f3 0f 1e fa b8 a6 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 95 8b 0c 00 f7 d8 64 89 01 48
RSP: 002b:00007fff50271768 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
RAX: 0000000000000000 RBX: 00007ff990770204 RCX: 00007ff9906412cb
RDX: 0000000000000005 RSI: 0000000000000000 RDI: 0000562d6a7c55f0
RBP: 0000562d6a7b9960 R08: 0000000000000000 R09: 00007ff99070af30
R10: 0000562d6a7b9010 R11: 0000000000000246 R12: 0000562d6a7c55f0
R13: 0000000000000000 R14: 0000562d6a7b9a58 R15: 0000562d6a7c57a0
---[ end trace 74eeb0e77c95e165 ]---
destroy_workqueue: xfs-cil/pmem1 has the following busy pwq
pwq 9: cpus=0-1 node=0 flags=0x4 nice=0 active=0/256 refcnt=2
in-flight: 550:wq_barrier_func
The report singles out the workqueue barrier item that gets put on the
workqueue whenever a flush_work call happens. For whatever reason, the
barrier stalls on the workqueue and trips up the destroy_workqueue code
even though there can't be any writers left in the filesystem.
Fix these sporadic warnings by cancelling the work item explicitly at
unmount time. This shouldn't be necessary since it shouldn't be
running, but explicitly cancelling the work item follows the usage
pattern of other work items.
Fixes: f0f7a674d4df ("xfs: move inode flush to the sync workqueue")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
-rw-r--r-- | fs/xfs/xfs_mount.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 79b43af550ed..84b52a6d8e81 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -552,6 +552,7 @@ xfs_unmount_flush_inodes( mp->m_flags |= XFS_MOUNT_UNMOUNTING; xfs_ail_push_all_sync(mp->m_ail); + cancel_work_sync(&mp->m_flush_inodes_work); xfs_inodegc_stop(mp); cancel_delayed_work_sync(&mp->m_reclaim_work); xfs_reclaim_inodes(mp); |