]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/log
xfsprogs-dev.git
4 months 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 months 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 months 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>
4 months 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>
4 months 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>
4 months 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>
4 months 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>
4 months 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>
4 months 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>
4 months 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>