]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/log
thirdparty/xfsprogs-dev.git
12 days agoxfsprogs: Release v6.18.0 for-next master v6.18.0
Andrey Albershteyn [Wed, 24 Dec 2025 15:34:39 +0000 (16:34 +0100)] 
xfsprogs: Release v6.18.0

Update all the necessary files for a v6.18.0 release.

Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
2 weeks agomkfs: adjust_nr_zones for zoned file system on conventional devices
Christoph Hellwig [Thu, 18 Dec 2025 16:09:32 +0000 (17:09 +0100)] 
mkfs: adjust_nr_zones for zoned file system on conventional devices

When creating zoned file systems on conventional devices, mkfs doesn't
currently align the RT device size to the zone size, which can create
unmountable file systems.  Fix this by moving the rgcount modification
to account for reserved zoned and then calling adjust_nr_zones
unconditionally, and thus ensuring that the rtblocks and rtextents values
are guaranteed to always be a multiple of the zone size.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
2 weeks agoxfs_logprint: fix pointer bug
Darrick J. Wong [Tue, 9 Dec 2025 20:57:38 +0000 (12:57 -0800)] 
xfs_logprint: fix pointer bug

generic/055 captures a crash in xfs_logprint due to an incorrect
refactoring trying to increment a pointer-to-pointer whereas before it
incremented a pointer.

Fixes: 5a9b7e95140893 ("logprint: factor out a xlog_print_op helper")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
3 weeks agomdrestore: fix restore_v2() superblock length check
Pavel Reichl [Tue, 9 Dec 2025 22:58:52 +0000 (23:58 +0100)] 
mdrestore: fix restore_v2() superblock length check

On big-endian architectures (e.g. s390x), restoring a filesystem from a
v2 metadump fails with "Invalid superblock disk address/length". This is
caused by restore_v2() treating a superblock extent length of 1 as an
error, even though a length of 1 is expected because the superblock fits
within a 512-byte sector.

On little-endian systems, the same raw extent length bytes that represent
a value of 1 on big-endian are misinterpreted as 16777216 due to byte
ordering, so the faulty check never triggers there and the bug is hidden.

Fix the issue by using an endian-correct comparison of xme_len so that
the superblock extent length is validated properly and consistently on
all architectures.

Signed-off-by: Pavel Reichl <preichl@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chandan Babu R <chandanbabu@kernel.org>
3 weeks agorepair: enhance process_dinode_metafile
Christoph Hellwig [Wed, 10 Dec 2025 05:54:41 +0000 (06:54 +0100)] 
repair: enhance process_dinode_metafile

Explicitly list the destiny of each metafile inode type, and warn about
unexpected types instead of just silently zapping them.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
3 weeks agorepair: factor out a process_dinode_metafile helper
Christoph Hellwig [Wed, 10 Dec 2025 05:54:40 +0000 (06:54 +0100)] 
repair: factor out a process_dinode_metafile helper

Split the metafile logic from process_dinode_int into a separate
helper.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
3 weeks agorepair: add canonical names for the XR_INO_ constants
Christoph Hellwig [Wed, 10 Dec 2025 05:54:39 +0000 (06:54 +0100)] 
repair: add canonical names for the XR_INO_ constants

Add an array with the canonical name for each inode type so that code
doesn't have to implement switch statements for that, and remove the now
trivial process_misc_ino_types and process_misc_ino_types_blocks
functions.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
3 weeks agorepair: add a enum for the XR_INO_* values
Christoph Hellwig [Wed, 10 Dec 2025 05:54:38 +0000 (06:54 +0100)] 
repair: add a enum for the XR_INO_* values

Move the XR_INO_ definitions into dinode.c as they aren't used anywhere
else, and turn them into an enum to improve type safety.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
3 weeks agomkfs: add 2025 LTS config file
Darrick J. Wong [Tue, 9 Dec 2025 16:16:24 +0000 (08:16 -0800)] 
mkfs: add 2025 LTS config file

Add a new configuration file with the defaults as of 6.18 LTS.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
3 weeks agomkfs: enable new features by default
Darrick J. Wong [Tue, 9 Dec 2025 16:16:08 +0000 (08:16 -0800)] 
mkfs: enable new features by default

Since the LTS is coming up, enable parent pointers and exchange-range by
default for all users.  Also fix up an out of date comment.

I created a really stupid benchmarking script that does:

#!/bin/bash

# pptr overhead benchmark

umount /opt /mnt
rmmod xfs
for i in 1 0; do
umount /opt
mkfs.xfs -f /dev/sdb -n parent=$i | grep -i parent=
mount /dev/sdb /opt
mkdir -p /opt/foo
for ((i=0;i<5;i++)); do
time fsstress -n 100000 -p 4 -z -f creat=1 -d /opt/foo -s 1
done
done

This is the result of creating an enormous number of empty files in a
single directory:

# ./dumb.sh
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1, parent=0
real    0m18.807s
user    0m2.169s
sys     0m54.013s

naming   =version 2              bsize=4096   ascii-ci=0, ftype=1, parent=1
real    0m20.654s
user    0m2.374s
sys     1m4.441s

As you can see, there's a 10% increase in runtime here.  If I make the
workload a bit more representative by changing the -f argument to
include a directory tree workout:

-f creat=1,mkdir=1,mknod=1,rmdir=1,unlink=1,link=1,rename=1

naming   =version 2              bsize=4096   ascii-ci=0, ftype=1, parent=1
real    0m12.742s
user    0m28.074s
sys     0m10.839s

naming   =version 2              bsize=4096   ascii-ci=0, ftype=1, parent=0
real    0m12.782s
user    0m28.892s
sys     0m8.897s

Almost no difference here.  If I then actually write to the regular
files by adding:

-f write=1

naming   =version 2              bsize=4096   ascii-ci=0, ftype=1, parent=1
real    0m16.668s
user    0m21.709s
sys     0m15.425s

naming   =version 2              bsize=4096   ascii-ci=0, ftype=1, parent=0
real    0m15.562s
user    0m21.740s
sys     0m12.927s

So that's about a 2% difference.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
3 weeks agolibfrog: fix incorrect FS_IOC_FSSETXATTR argument to ioctl()
Arkadiusz Miśkiewicz [Fri, 5 Dec 2025 14:31:48 +0000 (15:31 +0100)] 
libfrog: fix incorrect FS_IOC_FSSETXATTR argument to ioctl()

xfsprogs 6.17.0 has broken project quota due to incorrect argument
passed to FS_IOC_FSSETXATTR ioctl(). Instead of passing struct fsxattr,
struct file_attr was passed.

# LC_ALL=C /usr/sbin/xfs_quota -x -c "project -s -p /home/xxx 389701" /home
Setting up project 389701 (path /home/xxx)...
xfs_quota: cannot set project on /home/xxx: Invalid argument
Processed 1 (/etc/projects and cmdline) paths for project 389701 with
recursion depth infinite (-1).

ioctl(5, FS_IOC_FSSETXATTR, {fsx_xflags=FS_XFLAG_PROJINHERIT|FS_XFLAG_HASATTR, fsx_extsize=0, fsx_projid=0, fsx_cowextsize=389701}) = -1 EINVAL (Invalid argument)

There seems to be a double mistake which hides the original ioctl()
argument bug on old kernel with xfsprogs built against it. The size of
fa_xflags was also wrong in xfsprogs's linux.h header. This way when
xfsprogs is compiled on newer kernel but used with older kernel this bug
uncovers.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Arkadiusz Miśkiewicz <arekm@maven.pl>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: prevent gc from picking the same zone twice
Christoph Hellwig [Fri, 5 Dec 2025 15:04:33 +0000 (16:04 +0100)] 
xfs: prevent gc from picking the same zone twice

Source kernel commit: 83bac569c762651ac6dff9a86f54ecc13d911f7d

When we are picking a zone for gc it might already be in the pipeline
which can lead to us moving the same data twice resulting in in write
amplification and a very unfortunate case where we keep on garbage
collecting the zone we just filled with migrated data stopping all
forward progress.

Fix this by introducing a count of on-going GC operations on a zone, and
skip any zone with ongoing GC when picking a new victim.

Fixes: 080d01c41 ("xfs: implement zoned garbage collection")
Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
Co-developed-by: Hans Holmberg <hans.holmberg@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Tested-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: improve default maximum number of open zones
Damien Le Moal [Fri, 5 Dec 2025 15:04:24 +0000 (16:04 +0100)] 
xfs: improve default maximum number of open zones

Source kernel commit: ff3d90903f8f525eedb26efe6fea03c39476cb69

For regular block devices using the zoned allocator, the default
maximum number of open zones is set to 1/4 of the number of realtime
groups. For a large capacity device, this leads to a very large limit.
E.g. with a 26 TB HDD:

mount /dev/sdb /mnt
...
XFS (sdb): 95836 zones of 65536 blocks size (23959 max open)

In turn such large limit on the number of open zones can lead, depending
on the workload, on a very large number of concurrent write streams
which devices generally do not handle well, leading to poor performance.

Introduce the default limit XFS_DEFAULT_MAX_OPEN_ZONES, defined as 128
to match the hardware limit of most SMR HDDs available today, and use
this limit to set mp->m_max_open_zones in xfs_calc_open_zones() instead
of calling xfs_max_open_zones(), when the user did not specify a limit
with the max_open_zones mount option.

For the 26 TB HDD example, we now get:

mount /dev/sdb /mnt
...
XFS (sdb): 95836 zones of 65536 blocks (128 max open zones)

This change does not prevent the user from specifying a lareger number
for the open zones limit. E.g.

mount -o max_open_zones=4096 /dev/sdb /mnt
...
XFS (sdb): 95836 zones of 65536 blocks (4096 max open zones)

Finally, since xfs_calc_open_zones() checks and caps the
mp->m_max_open_zones limit against the value calculated by
xfs_max_open_zones() for any type of device, this new default limit does
not increase m_max_open_zones for small capacity devices.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: remove the expr argument to XFS_TEST_ERROR
Christoph Hellwig [Fri, 5 Dec 2025 15:04:17 +0000 (16:04 +0100)] 
xfs: remove the expr argument to XFS_TEST_ERROR

Source kernel commit: 807df3227d7674d7957c576551d552acf15bb96f

Don't pass expr to XFS_TEST_ERROR.  Most calls pass a constant false,
and the places that do pass an expression become cleaner by moving it
out.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
[aalbersh: remove argument from a macro and fix call in defer_item.c]
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: move the XLOG_REG_ constants out of xfs_log_format.h
Christoph Hellwig [Fri, 5 Dec 2025 15:04:11 +0000 (16:04 +0100)] 
xfs: move the XLOG_REG_ constants out of xfs_log_format.h

Source kernel commit: 42c21838708c20dd8ba605e4099bf6a7156c3362

These are purely in-memory values and not used at all in xfsprogs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: fix log CRC mismatches between i386 and other architectures
Christoph Hellwig [Fri, 5 Dec 2025 15:03:59 +0000 (16:03 +0100)] 
xfs: fix log CRC mismatches between i386 and other architectures

Source kernel commit: e747883c7d7306acb4d683038d881528fbfbe749

When mounting file systems with a log that was dirtied on i386 on
other architectures or vice versa, log recovery is unhappy:

[   11.068052] XFS (vdb): Torn write (CRC failure) detected at log block 0x2. Truncating head block from 0xc.

This is because the CRCs generated by i386 and other architectures
always diff.  The reason for that is that sizeof(struct xlog_rec_header)
returns different values for i386 vs the rest (324 vs 328), because the
struct is not sizeof(uint64_t) aligned, and i386 has odd struct size
alignment rules.

This issue goes back to commit 13cdc853c519 ("Add log versioning, and new
super block field for the log stripe") in the xfs-import tree, which
adds log v2 support and the h_size field that causes the unaligned size.
At that time it only mattered for the crude debug only log header
checksum, but with commit 0e446be44806 ("xfs: add CRC checks to the log")
it became a real issue for v5 file system, because now there is a proper
CRC, and regular builds actually expect it match.

Fix this by allowing checksums with and without the padding.

Fixes: 0e446be44806 ("xfs: add CRC checks to the log")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: remove the unused xfs_log_iovec_t typedef
Christoph Hellwig [Fri, 5 Dec 2025 15:03:46 +0000 (16:03 +0100)] 
xfs: remove the unused xfs_log_iovec_t typedef

Source kernel commit: 3e5bdfe48e1f159de7ca3b23a6afa6c10f2a9ad2

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: remove the unused xfs_qoff_logformat_t typedef
Christoph Hellwig [Fri, 5 Dec 2025 15:03:42 +0000 (16:03 +0100)] 
xfs: remove the unused xfs_qoff_logformat_t typedef

Source kernel commit: bf0013f59ccdb283083f0451f6edc50ff98e68c0

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: remove the unused xfs_dq_logformat_t typedef
Christoph Hellwig [Fri, 5 Dec 2025 15:03:38 +0000 (16:03 +0100)] 
xfs: remove the unused xfs_dq_logformat_t typedef

Source kernel commit: ae1ef3272b31e6bccd9f2014e8e8c41887a5137b

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: remove the unused xfs_buf_log_format_t typedef
Christoph Hellwig [Fri, 5 Dec 2025 15:03:32 +0000 (16:03 +0100)] 
xfs: remove the unused xfs_buf_log_format_t typedef

Source kernel commit: 1b5c7cc8f8c54858f69311290d5ade12627ff233

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: remove the unused xfs_efd_log_format_64_t typedef
Christoph Hellwig [Fri, 5 Dec 2025 15:03:28 +0000 (16:03 +0100)] 
xfs: remove the unused xfs_efd_log_format_64_t typedef

Source kernel commit: 3dde08b64c98cf76b2e2378ecf36351464e2972a

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: remove the unused xfs_efd_log_format_32_t typedef
Christoph Hellwig [Fri, 5 Dec 2025 15:03:24 +0000 (16:03 +0100)] 
xfs: remove the unused xfs_efd_log_format_32_t typedef

Source kernel commit: a0cb349672f9ac2dcd80afa3dd25e2df2842db7a

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: remove the xfs_efd_log_format_t typedef
Christoph Hellwig [Fri, 5 Dec 2025 15:03:19 +0000 (16:03 +0100)] 
xfs: remove the xfs_efd_log_format_t typedef

Source kernel commit: 0a33d5ad8a46d1f63174d2684b1d743bd6090554

There are almost no users of the typedef left, kill it and switch the
remaining users to use the underlying struct.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: remove the xfs_efi_log_format_64_t typedef
Christoph Hellwig [Fri, 5 Dec 2025 15:03:15 +0000 (16:03 +0100)] 
xfs: remove the xfs_efi_log_format_64_t typedef

Source kernel commit: 3fe5abc2bf4db88c7c9c99e8a1f5b3d1336d528f

There are almost no users of the typedef left, kill it and switch the
remaining users to use the underlying struct.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: remove the xfs_efi_log_format_32_t typedef
Christoph Hellwig [Fri, 5 Dec 2025 15:03:10 +0000 (16:03 +0100)] 
xfs: remove the xfs_efi_log_format_32_t typedef

Source kernel commit: 68c9f8444ae930343a2c900cb909825bc8f7304a

There are almost no users of the typedef left, kill it and switch the
remaining users to use the underlying struct.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: remove the xfs_efi_log_format_t typedef
Christoph Hellwig [Fri, 5 Dec 2025 15:03:06 +0000 (16:03 +0100)] 
xfs: remove the xfs_efi_log_format_t typedef

Source kernel commit: 655d9ec7bd9e38735ae36dbc635a9161a046f7b9

There are almost no users of the typedef left, kill it and switch the
remaining users to use the underlying struct.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: remove the xfs_extent64_t typedef
Christoph Hellwig [Fri, 5 Dec 2025 15:03:01 +0000 (16:03 +0100)] 
xfs: remove the xfs_extent64_t typedef

Source kernel commit: 72628b6f459ea4fed3003db8161b52ee746442d0

There are almost no users of the typedef left, kill it and switch the
remaining users to use the underlying struct.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: remove the xfs_extent32_t typedef
Christoph Hellwig [Fri, 5 Dec 2025 15:02:56 +0000 (16:02 +0100)] 
xfs: remove the xfs_extent32_t typedef

Source kernel commit: 7eaf684bc48923b5584fc119e8c477be2cdb3eb2

There are almost no users of the typedef left, kill it and switch the
remaining users to use the underlying struct.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: remove the xfs_extent_t typedef
Christoph Hellwig [Fri, 5 Dec 2025 15:02:51 +0000 (16:02 +0100)] 
xfs: remove the xfs_extent_t typedef

Source kernel commit: 476688c8ac60da9bfcb3ce7f5a2d30a145ef7f76

There are almost no users of the typedef left, kill it and switch the
remaining users to use the underlying struct.

Also fix up the comment about the struct xfs_extent definition to be
correct and read more easily.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: remove the xfs_trans_header_t typedef
Christoph Hellwig [Fri, 5 Dec 2025 15:02:46 +0000 (16:02 +0100)] 
xfs: remove the xfs_trans_header_t typedef

Source kernel commit: 05f17dcbfd5dbe309af310508d8830ac4e0c5d4c

There are almost no users of the typedef left, kill it and switch the
remaining users to use the underlying struct.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: remove the xlog_op_header_t typedef
Christoph Hellwig [Fri, 5 Dec 2025 15:02:42 +0000 (16:02 +0100)] 
xfs: remove the xlog_op_header_t typedef

Source kernel commit: eff8668607888988cad7b31528ff08d8883c5d7e

There are almost no users of the typedef left, kill it and switch the
remaining users to use the underlying struct.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: convert xfs_efi_log_format_64_t typedef to struct
Andrey Albershteyn [Fri, 5 Dec 2025 15:02:37 +0000 (16:02 +0100)] 
xfs: convert xfs_efi_log_format_64_t typedef to struct

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: convert xfs_extent_t typedef to struct
Andrey Albershteyn [Fri, 5 Dec 2025 15:02:32 +0000 (16:02 +0100)] 
xfs: convert xfs_extent_t typedef to struct

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: convert xfs_efi_log_format_32_t typedef to struct
Andrey Albershteyn [Fri, 5 Dec 2025 15:02:27 +0000 (16:02 +0100)] 
xfs: convert xfs_efi_log_format_32_t typedef to struct

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: convert xfs_efd_log_format_t typedef to struct
Andrey Albershteyn [Fri, 5 Dec 2025 15:02:21 +0000 (16:02 +0100)] 
xfs: convert xfs_efd_log_format_t typedef to struct

Align function arguments to new longer variable type and fix comment in
xlog_print_trans_rud() with wrong xfs_efd_log_format mention.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: convert xfs_efi_log_format typedef to struct
Andrey Albershteyn [Fri, 5 Dec 2025 15:02:15 +0000 (16:02 +0100)] 
xfs: convert xfs_efi_log_format typedef to struct

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: convert xfs_dq_logformat_t typedef to struct
Andrey Albershteyn [Fri, 5 Dec 2025 15:02:06 +0000 (16:02 +0100)] 
xfs: convert xfs_dq_logformat_t typedef to struct

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: convert xfs_qoff_logformat_t typedef to struct
Andrey Albershteyn [Fri, 5 Dec 2025 15:02:01 +0000 (16:02 +0100)] 
xfs: convert xfs_qoff_logformat_t typedef to struct

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: convert xfs_log_iovec_t typedef to struct
Andrey Albershteyn [Fri, 5 Dec 2025 15:01:55 +0000 (16:01 +0100)] 
xfs: convert xfs_log_iovec_t typedef to struct

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: convert xfs_trans_header_t typdef to struct
Andrey Albershteyn [Fri, 5 Dec 2025 15:01:50 +0000 (16:01 +0100)] 
xfs: convert xfs_trans_header_t typdef to struct

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: convert xlog_op_header_t typedef to struct
Andrey Albershteyn [Fri, 5 Dec 2025 15:01:45 +0000 (16:01 +0100)] 
xfs: convert xlog_op_header_t typedef to struct

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: convert xfs_buf_log_format_t typedef to struct
Andrey Albershteyn [Fri, 5 Dec 2025 15:01:40 +0000 (16:01 +0100)] 
xfs: convert xfs_buf_log_format_t typedef to struct

Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
4 weeks agoxfs: remove deprecated sysctl knobs
Darrick J. Wong [Fri, 5 Dec 2025 15:01:35 +0000 (16:01 +0100)] 
xfs: remove deprecated sysctl knobs

Source kernel commit: 21d59d00221e4ecbcb597eec0021c667477d3335

These sysctl knobs were scheduled for removal in September 2025.  That
time has come, so remove them.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoxfs: remove deprecated mount options
Darrick J. Wong [Fri, 5 Dec 2025 15:01:30 +0000 (16:01 +0100)] 
xfs: remove deprecated mount options

Source kernel commit: b9a176e54162f890aaf50ac8a467d725ed2f00df

These four mount options were scheduled for removal in September 2025,
so remove them now.

Cc: preichl@redhat.com
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoman2: fix getparents ioctl manpage
Darrick J. Wong [Tue, 2 Dec 2025 01:28:00 +0000 (17:28 -0800)] 
man2: fix getparents ioctl manpage

Fix a silly typo in the manual page for the GETPARENTS ioctl.

Cc: linux-xfs@vger.kernel.org # v6.10.0
Fixes: a24294c252d4a6 ("man: document the XFS_IOC_GETPARENTS ioctl")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
4 weeks agoxfs_db: document the rtsb command
Darrick J. Wong [Tue, 2 Dec 2025 01:27:44 +0000 (17:27 -0800)] 
xfs_db: document the rtsb command

Document the rtsb command, which positions the debugger at the
superblock for the realtime volume, if there is one.

Found by xfs/514.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
4 weeks agolibxfs: fix build warnings
Darrick J. Wong [Tue, 2 Dec 2025 01:27:29 +0000 (17:27 -0800)] 
libxfs: fix build warnings

gcc 14.2 with all the warnings turn on complains about missing
prototypes for these two functions:

 util.c:147:1: error: no previous prototype for 'current_fixed_time' [-Werror=missing-prototypes]
   147 | current_fixed_time(
       | ^~~~~~~~~~~~~~~~~~
 util.c:590:1: error: no previous prototype for 'get_deterministic_seed' [-Werror=missing-prototypes]
   590 | get_deterministic_seed(
       | ^~~~~~~~~~~~~~~~~~~~~~

Since they're not used outside of util.c, just make them static.

Fixes: 4a54700b4385bb ("libxfs: support reproducible filesystems using deterministic time/seed")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
4 weeks agologprint: cleanup xfs_log_print
Christoph Hellwig [Fri, 28 Nov 2025 06:30:02 +0000 (07:30 +0100)] 
logprint: cleanup xfs_log_print

Re-indent and drop typedefs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: cleanup xlog_print_extended_headers
Christoph Hellwig [Fri, 28 Nov 2025 06:30:01 +0000 (07:30 +0100)] 
logprint: cleanup xlog_print_extended_headers

Re-indent and drop typedefs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: factor out a xlog_print_ext_header helper
Christoph Hellwig [Fri, 28 Nov 2025 06:30:00 +0000 (07:30 +0100)] 
logprint: factor out a xlog_print_ext_header helper

Split the inner extheader printing loop into a separate helper.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: cleanup xlog_reallocate_xhdrs
Christoph Hellwig [Fri, 28 Nov 2025 06:29:59 +0000 (07:29 +0100)] 
logprint: cleanup xlog_reallocate_xhdrs

Re-indent and drop typedefs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: re-indent print_xlog_bad_*
Christoph Hellwig [Fri, 28 Nov 2025 06:29:58 +0000 (07:29 +0100)] 
logprint: re-indent print_xlog_bad_*

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: cleanup xlog_print_rec_xhead
Christoph Hellwig [Fri, 28 Nov 2025 06:29:57 +0000 (07:29 +0100)] 
logprint: cleanup xlog_print_rec_xhead

Re-indent and drop typedefs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: cleanup xlog_print_rec_head
Christoph Hellwig [Fri, 28 Nov 2025 06:29:56 +0000 (07:29 +0100)] 
logprint: cleanup xlog_print_rec_head

Re-indent and drop typedefs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: cleanup xlog_print_record
Christoph Hellwig [Fri, 28 Nov 2025 06:29:55 +0000 (07:29 +0100)] 
logprint: cleanup xlog_print_record

Indent to the normal style, use structs instead of typedefs, and move
assignments out of conditionals.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: factor out a xlog_unpack_rec_header
Christoph Hellwig [Fri, 28 Nov 2025 06:29:54 +0000 (07:29 +0100)] 
logprint: factor out a xlog_unpack_rec_header

Split the log record validation and unpacking logic into a separate
helper.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: factor out a xlog_print_op helper
Christoph Hellwig [Fri, 28 Nov 2025 06:29:53 +0000 (07:29 +0100)] 
logprint: factor out a xlog_print_op helper

Split the inner printing loop from xlog_print_record into a separate
helper.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: factor out a xlog_print_process_region helper
Christoph Hellwig [Fri, 28 Nov 2025 06:29:52 +0000 (07:29 +0100)] 
logprint: factor out a xlog_print_process_region helper

Start splitting up xlog_print_record by moving the switch on the item
types inside the inner loop into a self-contained helper.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: re-indent print_lseek / print_lsn
Christoph Hellwig [Fri, 28 Nov 2025 06:29:51 +0000 (07:29 +0100)] 
logprint: re-indent print_lseek / print_lsn

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: cleanup xlog_print_trans_dquot
Christoph Hellwig [Fri, 28 Nov 2025 06:29:50 +0000 (07:29 +0100)] 
logprint: cleanup xlog_print_trans_dquot

Re-indent, drop typedefs and invert a conditional to allow for an early
return.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: cleanup xlog_print_trans_inode
Christoph Hellwig [Fri, 28 Nov 2025 06:29:49 +0000 (07:29 +0100)] 
logprint: cleanup xlog_print_trans_inode

Re-indent, drop typedefs and invert a conditional to allow for an early
return.

Signed-off-by: Christoph Hellwig <hch@lst.de>
[aalbersh: add one column of tabs to arguments and vars definitions]
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: move xfs_inode_item_format_convert up
Christoph Hellwig [Fri, 28 Nov 2025 06:29:48 +0000 (07:29 +0100)] 
logprint: move xfs_inode_item_format_convert up

Toward the caller.  And reindent it while we're at it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
[aalbersh: add one tab column to arguments to make it align with in_f32]
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: cleanup xlog_print_trans_inode_core
Christoph Hellwig [Fri, 28 Nov 2025 06:29:47 +0000 (07:29 +0100)] 
logprint: cleanup xlog_print_trans_inode_core

Re-indent and drop typedefs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: cleanup xlog_print_trans_qoff
Christoph Hellwig [Fri, 28 Nov 2025 06:29:46 +0000 (07:29 +0100)] 
logprint: cleanup xlog_print_trans_qoff

Re-indent, drop typedefs and invert a conditional to allow for an early
return.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: cleanup xlog_print_trans_buffer
Christoph Hellwig [Fri, 28 Nov 2025 06:29:45 +0000 (07:29 +0100)] 
logprint: cleanup xlog_print_trans_buffer

Re-indent, drop typedefs and invert a conditional to allow for an early
return.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: split per-type helpers out of xlog_print_trans_buffer
Christoph Hellwig [Fri, 28 Nov 2025 06:29:44 +0000 (07:29 +0100)] 
logprint: split per-type helpers out of xlog_print_trans_buffer

Add a new helper for each special cased buffer type.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: cleanup xlog_print_trans_header
Christoph Hellwig [Fri, 28 Nov 2025 06:29:43 +0000 (07:29 +0100)] 
logprint: cleanup xlog_print_trans_header

Re-indent and drop typedef use.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: cleanup struct xlog_split_item handling
Christoph Hellwig [Fri, 28 Nov 2025 06:29:42 +0000 (07:29 +0100)] 
logprint: cleanup struct xlog_split_item handling

Drop the typedef and re-indent the helpers for it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: cleanup xlog_print_op_header
Christoph Hellwig [Fri, 28 Nov 2025 06:29:41 +0000 (07:29 +0100)] 
logprint: cleanup xlog_print_op_header

Re-indent and drop typedef use.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: re-indent printing helpers
Christoph Hellwig [Fri, 28 Nov 2025 06:29:40 +0000 (07:29 +0100)] 
logprint: re-indent printing helpers

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agologprint: remove xlog_print_dir2_sf
Christoph Hellwig [Fri, 28 Nov 2025 06:29:39 +0000 (07:29 +0100)] 
logprint: remove xlog_print_dir2_sf

The code has been stubbed out since the initial creation of the
xfsprogs repository.  Open code the single-line printf in the
data fork caller (attr forks can't contain directories) and remove
the dead code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
4 weeks agoinclude: remove struct xfs_qoff_logitem
Christoph Hellwig [Fri, 28 Nov 2025 06:29:38 +0000 (07:29 +0100)] 
include: remove struct xfs_qoff_logitem

Not used anywhere, so remove it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
6 weeks agoxfs_scrub: fix null pointer crash in scrub_render_ino_descr
Darrick J. Wong [Fri, 21 Nov 2025 16:39:37 +0000 (08:39 -0800)] 
xfs_scrub: fix null pointer crash in scrub_render_ino_descr

Starting in Debian 13's libc6, passing a NULL format string to vsnprintf
causes the program to segfault.  Prior to this, the null format string
would be ignored.  Because @format is optional, let's explicitly steer
around the vsnprintf if there is no format string.  Also tidy whitespace
in the comment.

Found by generic/45[34] on Debian 13.

Cc: linux-xfs@vger.kernel.org # v6.10.0
Fixes: 9a8b09762f9a52 ("xfs_scrub: use parent pointers when possible to report file operations")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
6 weeks agometadump: catch used extent array overflow
Carlos Maiolino [Thu, 13 Nov 2025 13:57:11 +0000 (14:57 +0100)] 
metadump: catch used extent array overflow

An user reported a SIGSEGV when attempting to create a metadump image of
a filesystem.
The reason is because we fail to catch a possible overflow in the
used extents array in process_exinode() which may happen if the extent
count is corrupted.
This leads process_bmbt_reclist() to attempt to index into the array
using the bogus extent count with:

convert_extent(&rp[numrecs - 1], &o, &s, &c, &f);

Fix this by extending the used counter to uint64_t and
checking for the overflow possibility.

Reported-by: hubert . <hubjin657@outlook.com>
Suggested-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
6 weeks agomkfs: fix zone capacity check for sequential zones
Carlos Maiolino [Thu, 13 Nov 2025 13:46:13 +0000 (14:46 +0100)] 
mkfs: fix zone capacity check for sequential zones

Sequential zones can have a different, smaller capacity than
conventional zones.

Currently mkfs assumes both sequential and conventional zones will have
the same capacity and and set the zone_info to the capacity of the first
found zone and use that value to validate all the remaining zones's
capacity.

Because conventional zones can't have a different capacity than its
size, the first zone always have the largest possible capacity, so, mkfs
will fail to validate any consecutive sequential zone if its capacity is
smaller than the conventional zones.

What we should do instead, is set the zone info capacity accordingly to
the settings of first zone found of the respective type and validate
the capacity based on that instead of assuming all zones will have the
same capacity.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
6 weeks agolibxfs: support reproducible filesystems using deterministic time/seed
Luca Di Maio [Sat, 8 Nov 2025 14:39:53 +0000 (15:39 +0100)] 
libxfs: support reproducible filesystems using deterministic time/seed

Add support for reproducible filesystem creation through two environment
variables that enable deterministic behavior when building XFS filesystems.

SOURCE_DATE_EPOCH support:
When SOURCE_DATE_EPOCH is set, use its value for all filesystem timestamps
instead of the current time. This follows the reproducible builds
specification (https://reproducible-builds.org/specs/source-date-epoch/)
and ensures consistent inode timestamps across builds.

DETERMINISTIC_SEED support:
When DETERMINISTIC_SEED=1 is set, return a fixed seed value (0x53454544 =
"SEED") from get_random_u32() instead of reading from /dev/urandom.

get_random_u32() seems to be used mostly to set inode generation number, being
fixed should not be create collision issues at mkfs time.

The implementation introduces two helper functions to minimize changes
to existing code:

- current_fixed_time(): Parses and caches SOURCE_DATE_EPOCH on first
  call. Returns fixed timestamp when set, falls back to gettimeofday() on
  parse errors or when unset.
- get_deterministic_seed(): Checks for DETERMINISTIC_SEED=1 environment
  variable on first call, and returns a fixed seed value (0x53454544).
  Falls back to getrandom() when unset.
- Both helpers use one-time initialization to avoid repeated getenv() calls.
- Both quickly exit and noop if environment is not set or has invalid
  variables, falling back to original behaviour.

Example usage:
  SOURCE_DATE_EPOCH=1234567890 \
  DETERMINISTIC_SEED=1 \
  mkfs.xfs \
-m uuid=$EXAMPLE_UUID \
-p file=./rootfs \
disk1.img

This enables distributions and build systems to create bit-for-bit
identical XFS filesystems when needed for verification and debugging.

v1 -> v2:
- simplify deterministic seed by returning a fixed value instead
  of using Middle Square Weyl Sequence PRNG
- fix timestamp type time_t -> time64_t
- fix timestamp initialization flag to allow negative epochs
- fix timestamp conversion type using strtoll
- fix timestamp conversion check to be sure the whole string was parsed
- print warning message when SOURCE_DATE_EPOCH is invalid

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
6 weeks agoFix alloc/free of cache item
Torsten Rupp [Sun, 12 Oct 2025 07:23:58 +0000 (09:23 +0200)] 
Fix alloc/free of cache item

xfs_extfree_item_cache is allocated and freed twice. Remove the
obsolete alloc/free.

Signed-off-by: Torsten Rupp <torsten.rupp@gmx.net>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
6 weeks agoxfs_io: use the XFS_ERRTAG macro to generate injection targets
Christoph Hellwig [Mon, 15 Sep 2025 13:33:17 +0000 (06:33 -0700)] 
xfs_io: use the XFS_ERRTAG macro to generate injection targets

Use the new magic macro table provided by libxfs to autogenerate
the list of valid error injection targets.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
6 weeks agoxfs: centralize error tag definitions
Andrey Albershteyn [Mon, 24 Nov 2025 14:24:27 +0000 (15:24 +0100)] 
xfs: centralize error tag definitions

From: Christoph Hellwig <hch@lst.de>

Source kernel commit: 71fa062196ae3abab790c91f1bdf09dcdc6fb1fe

Right now 5 places in the kernel and one in xfsprogs need to be updated
for each new error tag.  Add a bit of macro magic so that only the
error tag definition and a single table, which reside next to each
other, need to be updated.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
8 weeks agorepair/prefetch.c: Create one workqueue with multiple workers
Chandan Babu R [Tue, 4 Nov 2025 09:14:37 +0000 (14:44 +0530)] 
repair/prefetch.c: Create one workqueue with multiple workers

When xfs_repair is executed with a non-zero value for ag_stride,
do_inode_prefetch() create multiple workqueues with each of them having just
one worker thread.

Since commit 12838bda12e669 ("libfrog: fix overly sleep workqueues"), a
workqueue can process multiple work items concurrently. Hence, this commit
replaces the above logic with just one workqueue having multiple workers.

Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
8 weeks agolibfrog: Prevent unnecessary waking of worker thread when using bounded workqueues
Chandan Babu R [Tue, 4 Nov 2025 09:14:36 +0000 (14:44 +0530)] 
libfrog: Prevent unnecessary waking of worker thread when using bounded workqueues

When woken up, a worker will pick a work item from the workqueue and wake up
another worker when the current workqueue is a bounded workqueue and if there
is atleast one more work item remains to be processed.

The commit 12838bda12e669 ("libfrog: fix overly sleep workqueues") prevented
single-threaded processing of work items by waking up sleeping workers when a
work item is added to the workqueue. Hence the earlier described mechanism of
waking workers is no longer required.

Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
8 weeks agoproto: fix file descriptor leak
Luca Di Maio [Fri, 24 Oct 2025 19:36:48 +0000 (21:36 +0200)] 
proto: fix file descriptor leak

fix leak of pathfd introduced in commit 8a4ea72724930cfe262ccda03028264e1a81b145

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Fixes: 8a4ea72724930c ("proto: add ability to populate a filesystem from a directory")
8 weeks agomkfs: split zone reset from discard
Christoph Hellwig [Wed, 29 Oct 2025 09:07:32 +0000 (10:07 +0100)] 
mkfs: split zone reset from discard

Zone reset is a mandatory part of creating a file system on a zoned
device, unlike discard, which can be skipped.  It also is implemented
a bit different, so just split the handling.  This also means that we
can now support the -K option to skip discard on the data section for
zoned file systems.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
8 weeks agomkfs: remove duplicate struct libxfs_init arguments
Christoph Hellwig [Wed, 29 Oct 2025 09:07:31 +0000 (10:07 +0100)] 
mkfs: remove duplicate struct libxfs_init arguments

The libxfs_init structure instance is pointed to by cli_params, so use
that were it already exists instead of passing an additional argument.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
8 weeks agolibxfs: cleanup get_topology
Christoph Hellwig [Wed, 29 Oct 2025 09:07:30 +0000 (10:07 +0100)] 
libxfs: cleanup get_topology

Add a libxfs_ prefix to the name, clear the structure in the helper
instead of in the callers, and use a bool to pass a boolean argument.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
8 weeks agomkfs: move clearing LIBXFS_DIRECT into check_device_type
Christoph Hellwig [Wed, 29 Oct 2025 09:07:29 +0000 (10:07 +0100)] 
mkfs: move clearing LIBXFS_DIRECT into check_device_type

Keep it close to the block device vs regular file logic and remove
the checks for each device in the caller.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
8 weeks agomkfs: improve the error message in adjust_nr_zones
Christoph Hellwig [Wed, 22 Oct 2025 08:52:05 +0000 (10:52 +0200)] 
mkfs: improve the error message in adjust_nr_zones

Print the zone counts to help the user to understand the problem.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
8 weeks agomkfs: improve the error message from check_device_type
Christoph Hellwig [Wed, 22 Oct 2025 08:52:04 +0000 (10:52 +0200)] 
mkfs: improve the error message from check_device_type

Tell the user what device is missing.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
8 weeks agoxfs_copy: improve the error message when mkfs is in progress
Christoph Hellwig [Wed, 22 Oct 2025 08:52:03 +0000 (10:52 +0200)] 
xfs_copy: improve the error message when mkfs is in progress

Indicate the correct reason for the failure instead of the same
message as for the generic error condition just above.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
2 months agoxfsprogs: Release v6.17.0 v6.17.0
Andrey Albershteyn [Mon, 20 Oct 2025 14:49:00 +0000 (16:49 +0200)] 
xfsprogs: Release v6.17.0

Update all the necessary files for a v6.17.0 release.

Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
2 months agoxfs_scrub_fail: reduce security lockdowns to avoid postfix problems
Darrick J. Wong [Mon, 13 Oct 2025 23:34:24 +0000 (16:34 -0700)] 
xfs_scrub_fail: reduce security lockdowns to avoid postfix problems

Iustin Pop reports that the xfs_scrub_fail service fails to email
problem reports on Debian when postfix is installed.  This is apparently
due to several factors:

1. postfix's sendmail wrapper calling postdrop directly,
2. postdrop requiring the ability to write to the postdrop group,
3. lockdown preventing the xfs_scrub_fail@ service to have postdrop in
   the supplemental group list or the ability to run setgid programs

Item (3) could be solved by adding the whole service to the postdrop
group via SupplementalGroups=, but that will fail if postfix is not
installed and hence there is no postdrop group.

It could also be solved by forcing msmtp to be installed, bind mounting
msmtp into the service container, and injecting a config file that
instructs msmtp to connect to port 25, but that in turn isn't compatible
with systems not configured to allow an smtp server to listen on ::1.

So we'll go with the less restrictive approach that e2scrub_fail@ does,
which is to say that we just turn off all the sandboxing. :( :(

Reported-by: iustin@debian.org
Cc: linux-xfs@vger.kernel.org # v6.10.0
Fixes: 9042fcc08eed6a ("xfs_scrub_fail: tighten up the security on the background systemd service")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
2 months agoxfs: do not propagate ENODATA disk errors into xattr code
Eric Sandeen [Mon, 6 Oct 2025 12:40:19 +0000 (14:40 +0200)] 
xfs: do not propagate ENODATA disk errors into xattr code

Source kernel commit: ae668cd567a6a7622bc813ee0bb61c42bed61ba7

ENODATA (aka ENOATTR) has a very specific meaning in the xfs xattr code;
namely, that the requested attribute name could not be found.

However, a medium error from disk may also return ENODATA. At best,
this medium error may escape to userspace as "attribute not found"
when in fact it's an IO (disk) error.

At worst, we may oops in xfs_attr_leaf_get() when we do:

error = xfs_attr_leaf_hasname(args, &bp);
if (error == -ENOATTR)  {
xfs_trans_brelse(args->trans, bp);
return error;
}

because an ENODATA/ENOATTR error from disk leaves us with a null bp,
and the xfs_trans_brelse will then null-deref it.

As discussed on the list, we really need to modify the lower level
IO functions to trap all disk errors and ensure that we don't let
unique errors like this leak up into higher xfs functions - many
like this should be remapped to EIO.

However, this patch directly addresses a reported bug in the xattr
code, and should be safe to backport to stable kernels. A larger-scope
patch to handle more unique errors at lower levels can follow later.

(Note, prior to 07120f1abdff we did not oops, but we did return the
wrong error code to userspace.)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Fixes: 07120f1abdff ("xfs: Add xfs_has_attr and subroutines")
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
2 months agoxfs: don't use a xfs_log_iovec for ri_buf in log recovery
Christoph Hellwig [Mon, 6 Oct 2025 12:40:19 +0000 (14:40 +0200)] 
xfs: don't use a xfs_log_iovec for ri_buf in log recovery

Source kernel commit: ded74fddcaf685a9440c5612f7831d0c4c1473ca

ri_buf just holds a pointer/len pair and is not a log iovec used for
writing to the log.  Switch to use a kvec instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
2 months agofs/xfs: replace strncpy with memtostr_pad()
Pranav Tyagi [Mon, 6 Oct 2025 12:40:18 +0000 (14:40 +0200)] 
fs/xfs: replace strncpy with memtostr_pad()

Source kernel commit: f4a3f01e8e451fb3cb444a95a59964f4bc746902

Replace the deprecated strncpy() with memtostr_pad(). This also avoids
the need for separate zeroing using memset(). Mark sb_fname buffer with
__nonstring as its size is XFSLABEL_MAX and so no terminating NULL for
sb_fname.

Signed-off-by: Pranav Tyagi <pranav.tyagi03@gmail.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
2 months agoxfs: improve the xg_active_ref check in xfs_group_free
Christoph Hellwig [Mon, 6 Oct 2025 12:40:18 +0000 (14:40 +0200)] 
xfs: improve the xg_active_ref check in xfs_group_free

Source kernel commit: 59655147ec34fb72cc090ca4ee688ece05ffac56

Split up the XFS_IS_CORRUPT statement so that it immediately shows
if the reference counter overflowed or underflowed.

I ran into this quite a bit when developing the zoned allocator, and had
to reapply the patch for some work recently.  We might as well just apply
it upstream given that freeing group is far removed from performance
critical code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
2 months agoxfs: return the allocated transaction from xfs_trans_alloc_empty
Christoph Hellwig [Mon, 6 Oct 2025 12:40:17 +0000 (14:40 +0200)] 
xfs: return the allocated transaction from xfs_trans_alloc_empty

Source kernel commit: d8e1ea43e5a314bc01ec059ce93396639dcf9112

xfs_trans_alloc_empty can't return errors, so return the allocated
transaction directly instead of an output double pointer argument.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
2 months agoxfs: refactor xfs_btree_diff_two_ptrs() to take advantage of cmp_int()
Fedor Pchelkin [Mon, 6 Oct 2025 12:40:17 +0000 (14:40 +0200)] 
xfs: refactor xfs_btree_diff_two_ptrs() to take advantage of cmp_int()

Source kernel commit: ce6cce46aff79423f47680ee65e8f12191a50605

Use cmp_int() to yield the result of a three-way-comparison instead of
performing subtractions with extra casts. Thus also rename the function
to make its name clearer in purpose.

Found by Linux Verification Center (linuxtesting.org).

Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
2 months agoxfs: use a proper variable name and type for storing a comparison result
Fedor Pchelkin [Mon, 6 Oct 2025 12:40:16 +0000 (14:40 +0200)] 
xfs: use a proper variable name and type for storing a comparison result

Source kernel commit: 2717eb35185581988799bb0d5179409978f36a90

Perhaps that's just my silly imagination but 'diff' doesn't look good for
the name of a variable to hold a result of a three-way-comparison
(-1, 0, 1) which is what ->cmp_key_with_cur() does. It implies to contain
an actual difference between the two integer variables but that's not true
anymore after recent refactoring.

Declaring it as int64_t is also misleading now. Plain integer type is
more than enough.

Found by Linux Verification Center (linuxtesting.org).

Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
2 months agoxfs: refactor cmp_key_with_cur routines to take advantage of cmp_int()
Fedor Pchelkin [Mon, 6 Oct 2025 12:40:16 +0000 (14:40 +0200)] 
xfs: refactor cmp_key_with_cur routines to take advantage of cmp_int()

Source kernel commit: 734b871d6cf7d4f815bb1eff8c808289079701c2

The net value of these functions is to determine the result of a
three-way-comparison between operands of the same type.

Simplify the code using cmp_int() to eliminate potential errors with
opencoded casts and subtractions. This also means we can change the return
value type of cmp_key_with_cur routines from int64_t to int and make the
interface a bit clearer.

Found by Linux Verification Center (linuxtesting.org).

Suggested-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
2 months agoxfs: refactor cmp_two_keys routines to take advantage of cmp_int()
Fedor Pchelkin [Mon, 6 Oct 2025 12:40:16 +0000 (14:40 +0200)] 
xfs: refactor cmp_two_keys routines to take advantage of cmp_int()

Source kernel commit: 3b583adf55c649d5ba37bcd1ca87644b0bc10b86

The net value of these functions is to determine the result of a
three-way-comparison between operands of the same type.

Simplify the code using cmp_int() to eliminate potential errors with
opencoded casts and subtractions. This also means we can change the return
value type of cmp_two_keys routines from int64_t to int and make the
interface a bit clearer.

Found by Linux Verification Center (linuxtesting.org).

Suggested-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>