Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Dave Chinner <dgc@kernel.org>
To: "Steinar H. Gunderson" <steinar+kernel@gunderson.no>
Cc: linux-xfs@vger.kernel.org
Subject: Re: Hung I/O
Date: Thu, 26 Nov 2026 07:02:06 +1100	[thread overview]
Message-ID: <awc-vvNFH3vfYLWv@dread> (raw)
In-Reply-To: <sh2gykmlybrlf77d6mp76pddecwl47pxoookx2sbo74y6ffme4@gcu2kqu7q4o2>

On Wed, Nov 25, 2026 at 05:42:50PM +0100, Steinar H. Gunderson wrote:
> Hi,
> 
> I'm seeing a problem I haven't seen before; I first saw it with 7.4.0-rc4
> but it looks exactly the same on 7.3.6, so it may be something related to
> changing workload.
> 
> I have a process that mmaps a fairly large file (~500GB) for read/write;
> this is more than my amount of RAM (256GB) but the working set is generally
> less (I work on only parts of the file at any given time, and MADV_DISCARD
> things when I'm done with them). I'm not sure if this is directly related,
> but it seems so.
> 
> At some point, all XFS filesystem I/O on my machine becomes really slow
> and hangs for several minutes, before it recovers. (Stopping the process
> does not cause immediate recovery.) The ext4 filesystems seem to be mostly
> OK, but I haven't tested this thoroughly. The file is backed by XFS on an
> mdadm RAID-6 against SATA 7200rpm drives (on a SAS controller), but even the
> SSD-backed volumes seem to get large problems; various daemons hang and/or
> time out since everything takes forever, SSH-ing into the machine times out,
> etc..
> 
> dmesg outputs a few of these:

can you post the entire dmesg output from 'echo w >
/proc/sysrq-trigger' and 'echo l > /proc/sysrq-trigger' to capture
all the currently blocked and running processes when the hang
happens.

> 
>   [ 3263.529187] INFO: task sponge:111219 blocked in I/O wait for more than 120 seconds.
>   [ 3263.534641]       Not tainted 7.3.6 #1
>   [ 3263.540028] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
>   [ 3263.545487] task:sponge          state:D stack:0     pid:111219 tgid:111219 ppid:111216 task_flags:0x400100 flags:0x00080000
>   [ 3263.551029] Call Trace:
>   [ 3263.556397]  <TASK>
>   [ 3263.561662]  __schedule+0x581/0x10b0
>   [ 3263.566883]  schedule+0x28/0xa0
>   [ 3263.572011]  io_schedule+0x46/0x70
>   [ 3263.577103]  folio_wait_bit_common+0x13b/0x370
>   [ 3263.582194]  ? __pfx_wake_page_function+0x10/0x10
>   [ 3263.587227]  folio_wait_writeback+0x2c/0x80
>   [ 3263.592201]  truncate_inode_partial_folio+0x68/0x200
>   [ 3263.597161]  truncate_inode_pages_range+0x1e0/0x440
>   [ 3263.602094]  xfs_fs_evict_inode+0x1f/0x70 [xfs]

Waiting on data (page cache) writeback to complete....

> A simpler one:
> 
>   [14380.178852] INFO: task prometheus:14307 blocked in I/O wait for more than 120 seconds.
>   [14380.183922]       Not tainted 7.3.6 #1
>   [14380.188970] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
>   [14380.194138] task:prometheus      state:D stack:0     pid:14307 tgid:11079 ppid:1      task_flags:0x400040 flags:0x00080000
>   [14380.199474] Call Trace:
>   [14380.204758]  <TASK>
>   [14380.210031]  __schedule+0x581/0x10b0
>   [14380.215328]  schedule+0x28/0xa0
>   [14380.220571]  io_schedule+0x46/0x70
>   [14380.225767]  folio_wait_bit_common+0x13b/0x370
>   [14380.230958]  ? __pfx_wake_page_function+0x10/0x10
>   [14380.236131]  folio_wait_writeback+0x2c/0x80
>   [14380.241323]  __filemap_fdatawait_range+0x87/0xe0
>   [14380.246530]  file_write_and_wait_range+0x88/0xb0
>   [14380.251730]  xfs_file_fsync+0x4a/0x1b0 [xfs]

Same.

> The stuck processes are typically stuck in xfs_buf_lock. Here's one from
> kworker/u513:1+flush-253:37:
> 
>   pannekake:~> sudo cat /proc/737609/stack
>   [<0>] xfs_buf_lock+0x32/0xd0 [xfs]
>   [<0>] xfs_buf_find_lock+0x51/0x100 [xfs]
>   [<0>] xfs_buf_read_map+0x94/0x2b0 [xfs]
>   [<0>] xfs_trans_read_buf_map+0x12d/0x270 [xfs]
>   [<0>] xfs_btree_read_buf_block+0xa0/0x120 [xfs]
>   [<0>] xfs_btree_lookup_get_block+0xa3/0x1f0 [xfs]
>   [<0>] xfs_btree_lookup+0xf2/0x550 [xfs]
>   [<0>] xfs_alloc_cntbt_iter+0x9e/0x1b0 [xfs]

Somewhere in a freespace btree lookup. Likely waiting on metadata
writeback, because this path needs to hold the AGF and that
serialises access to the btree.

> and here's one from a userspace process:
> 
>   pannekake:~> sudo cat /proc/770769/stack
>   [<0>] xfs_buf_lock+0x32/0xd0 [xfs]
>   [<0>] xfs_buf_find_lock+0x51/0x100 [xfs]
>   [<0>] xfs_buf_read_map+0x94/0x2b0 [xfs]
>   [<0>] xfs_trans_read_buf_map+0x12d/0x270 [xfs]
>   [<0>] xfs_read_agi+0xa2/0x170 [xfs]
>   [<0>] xfs_ialloc_read_agi+0x4e/0x120 [xfs]
>   [<0>] xfs_dialloc+0x1e1/0x8a0 [xfs]
>   [<0>] xfs_create+0x297/0x460 [xfs]

And that's waiting the AGI lock, which is needed to serialise inode
allocation from that AG. Implies there is either another inode
allocation/free in progress, or that it is waiting on metadata
writeback...

> Any ideas? It appears to be fairly easily reproducible, so I can do more
> debugging if need be (although it's a production machine, so not too much
> rebooting would be fine).

Start with getting all the blocked tasks and building a dependency
map of which tasks are stuck behind others. That will narrow down
whether this is some internal deadlock in the filesystem or whether
the lower layers of the stack have lost a bunch of IO completions...

Cheers,

Dave.

-- 
Dave Chinner
dgc@kernel.org

  reply	other threads:[~2026-11-25 20:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 16:42 Hung I/O Steinar H. Gunderson
2026-11-25 20:02 ` Dave Chinner [this message]
2026-11-25 20:06   ` Steinar H. Gunderson
2026-11-25 21:02   ` Steinar H. Gunderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=awc-vvNFH3vfYLWv@dread \
    --to=dgc@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=steinar+kernel@gunderson.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox