Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Dave Chinner <dgc@kernel.org>
To: Ran Hongyun <ranhongyun1@huawei.com>
Cc: cem@kernel.org, djwong@kernel.org, linux-xfs@vger.kernel.org,
	chengzhihao1@huawei.com, yangerkun@huawei.com,
	yi.zhang@huawei.com, wozizhi@huawei.com
Subject: Re: [PATCH 0/2] xfs: fix zero-link inode link count handling
Date: Wed, 25 Nov 2026 06:49:53 +1100	[thread overview]
Message-ID: <awXqYTBgUOMmWCzW@dread> (raw)
In-Reply-To: <20261124115337.2297318-1-ranhongyun1@huawei.com>

On Tue, Nov 24, 2026 at 07:53:37PM +0800, Ran Hongyun wrote:
> This series fixes two paths that hand a zero-link inode to the VFS link
> count helpers.
> 
> Patch 1 makes the metadir repair code set the link count directly when
> reconnecting an inode that was found on the unlinked list, instead of
> calling inc_nlink() on a zero-link inode.
> 
> Patch 2 makes xfs_bumplink() reject the abnormal zero link count with
> -EFSCORRUPTED.  A crafted image can contain a reachable directory with
> di_nlink == 0; mkdir() or rename() into it then reaches inc_nlink() and
> trips the VFS warning.

With your changes, it shuts down the filesystem instead of issuing a
warning and allowing things to keep working, yes? i.e. it turns a
warning in a production system into a guaranteed denial of service.

AFAICT, the link count being wrong doesn't immediately result in
anything worse than the link count being wrong. The warning is there
to tell us the link count is wrong, but I'm not convinced that
turning a warning into a shutdown is the right thing to be doing
here.

If we are going to abort modification operations on inodes with
incorrect zero link counts, then the link count needs to be checked
-before- we start modifying anything in the transaction, not deep in
the guts where we cannot sanely back out with an error. i.e.
xfs_bumplink() is the wrong place to be doing these sorts of
corruption checks.

-Dave.
-- 
Dave Chinner
dgc@kernel.org

      reply	other threads:[~2026-11-24 19:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 11:53 [PATCH 0/2] xfs: fix zero-link inode link count handling Ran Hongyun
2026-11-24 19:49 ` Dave Chinner [this message]

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=awXqYTBgUOMmWCzW@dread \
    --to=dgc@kernel.org \
    --cc=cem@kernel.org \
    --cc=chengzhihao1@huawei.com \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=ranhongyun1@huawei.com \
    --cc=wozizhi@huawei.com \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    /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