From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: aalbersh@kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 4/6] mkfs: fix hardlink detection in directory import code
Date: Tue, 30 Jun 2026 09:28:59 -0700 [thread overview]
Message-ID: <20260630162859.GD6526@frogsfrogsfrogs> (raw)
In-Reply-To: <20260630053852.GD21007@lst.de>
On Tue, Jun 30, 2026 at 07:38:52AM +0200, Christoph Hellwig wrote:
> On Mon, Jun 29, 2026 at 06:03:41PM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> >
> > There's a serious problem in the hardlink detection code in the new mkfs
> > protofile functionality that copies a directory tree into the new
> > filesystem. It's been long established that hardlinks can only be
> > detected by comparing st_ino *and* st_dev, but the new code doesn't do
> > that.
>
> Yes.
>
> > Fix the detector, and stop passing struct stat objects by
> > value(!) since they are quite large.
>
> Without looking at the code I suspect the compiler silently passes
> them by references as long as the functions are static, but it's
> still good to fix this up.
>
> > static void
> > writetimestamps(
> > struct xfs_inode *ip,
> > - struct stat *statbuf)
> > + const struct stat *statbuf)
>
> It also seems to constify a few things :)
Yeah, I'll modify the commit message to state that we pass around const
statbuf pointers because none of the protofile code needs to modify them
once we've sampled the open fd.
> > - hardlink_tracker.entries[hardlink_tracker.count].src_ino = src_ino;
> > + hardlink_tracker.entries[hardlink_tracker.count].src_dev = filestat->st_dev;
> > + hardlink_tracker.entries[hardlink_tracker.count].src_ino = filestat->st_ino;
> > hardlink_tracker.entries[hardlink_tracker.count].dst_ino = dst_ino;
>
> A bunch of overly long lines. This would probably benefit from
> a local variable for the tracker entry.
and add a convenience variable here to reduce the long lines.
> Otherwise looks good, although I would have split it into a few patches.
<nod> I'll go fix the statbuf pointers separately then.
--D
next prev parent reply other threads:[~2026-06-30 16:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 1:02 [PATCHSET 2/4] mkfs.xfs: codex-inspired bug fixes Darrick J. Wong
2026-06-30 1:02 ` [PATCH 1/6] mkfs: don't redefine DIRT for protofiles Darrick J. Wong
2026-06-30 5:31 ` Christoph Hellwig
2026-06-30 1:03 ` [PATCH 2/6] mkfs: fix PATH_MAX check Darrick J. Wong
2026-06-30 5:31 ` Christoph Hellwig
2026-06-30 1:03 ` [PATCH 3/6] mkfs: fix symlink target length check in create_nondir_inode Darrick J. Wong
2026-06-30 5:34 ` Christoph Hellwig
2026-06-30 1:03 ` [PATCH 4/6] mkfs: fix hardlink detection in directory import code Darrick J. Wong
2026-06-30 5:38 ` Christoph Hellwig
2026-06-30 16:28 ` Darrick J. Wong [this message]
2026-06-30 1:03 ` [PATCH 5/6] mkfs: PQUOTA shouldn't conflict with GQNOENFORCE Darrick J. Wong
2026-06-30 5:41 ` Christoph Hellwig
2026-06-30 16:27 ` Darrick J. Wong
2026-06-30 1:04 ` [PATCH 6/6] xfs_protofile: make nondirectory arguments actually work Darrick J. Wong
2026-06-30 5:45 ` Christoph Hellwig
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=20260630162859.GD6526@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=aalbersh@kernel.org \
--cc=hch@lst.de \
--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