Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH 0/2 V2] xfs_repair: improve caching in the face of ENOMEM
Date: Thu,  3 Sep 2026 13:42:42 -0500	[thread overview]
Message-ID: <20260903203638.1094907-1-sandeen@redhat.com> (raw)

V2:
- Flip the order of the patches; put the bugfix first and the
  cache expansion guard second, at which point it's just defensive.

- Be more explicit about an enomem return due to a real allocation
  failure; don't try to figure that out indirectly as before.

- Actually care about the return values as pointed out by djwong.

There are problems with how we react to cache allocation failures that
are more apparent before:
6b6239689e36 ("libxfs: unmap xmbuf pages to avoid disaster")
landed, but with enough pressure they show up again.

Two problems: cache_expand has no bounds checking, so call it enough
and c_maxcount will overflow, which typically results in an infinite
loop.

That can be triggered by the fact that today, an underlying ENOMEM
can look like a "cache too small" return, so we double when that
won't help at all. Do that enough times and kaboom.

I can trigger this with something like:

mkfs.xfs -d file,name=testfile.img,agcount=10000,size=1t
echo 1000 > /proc/sys/vm/max_map_count
xfs_repair -n -P -m 1280 testfile.img

to force an ENOMEM from the max map count, though the actual
max_map_count value needed varies depending on the machine I'm on,
for some reason.

These were quickly tested with ./check -g quick


             reply	other threads:[~2026-09-03 20:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03 18:42 Eric Sandeen [this message]
2026-09-03 18:42 ` [PATCH 1/2] xfs_repair: distinguish true ENOMEM from "not found" in cache_node_get Eric Sandeen
2026-09-04 16:20   ` Darrick J. Wong
2026-09-04 16:29     ` Eric Sandeen
2026-09-03 18:42 ` [PATCH 2/2] xfs_repair: do not allow cache growth to overflow Eric Sandeen

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=20260903203638.1094907-1-sandeen@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-xfs@vger.kernel.org \
    /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