Whamcloud - gitweb
tools/e2fsprogs.git
5 weeks agofuse2fs: check the immutable flag in more places
Darrick J. Wong [Wed, 21 May 2025 22:39:52 +0000 (15:39 -0700)]
fuse2fs: check the immutable flag in more places

We need to check the immutable flag in a few more places that try to
modify files.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677887.1383760.16795876049190712906.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agofuse2fs: return EPERM for write access to EXT2_IMMUTABLE_FL files
Darrick J. Wong [Wed, 21 May 2025 22:39:36 +0000 (15:39 -0700)]
fuse2fs: return EPERM for write access to EXT2_IMMUTABLE_FL files

The kernel drivers return EPERM for attempts to write to immutable
files, so switch the error code.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677869.1383760.310634374176043971.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agofuse2fs: make bad magic numbers report a corruption error too
Darrick J. Wong [Wed, 21 May 2025 22:39:21 +0000 (15:39 -0700)]
fuse2fs: make bad magic numbers report a corruption error too

Report bad magic numbers as corruption errors too.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677853.1383760.10493605429423115597.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agofuse2fs: make internal state corruption a hard error
Darrick J. Wong [Wed, 21 May 2025 22:39:05 +0000 (15:39 -0700)]
fuse2fs: make internal state corruption a hard error

If the in-memory contents are wrong, then we want to report a corruption
error and shut down the filesystem.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677837.1383760.2730283507317571357.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agofuse2fs: make filesystem corruption a hard error
Darrick J. Wong [Wed, 21 May 2025 22:38:49 +0000 (15:38 -0700)]
fuse2fs: make filesystem corruption a hard error

Change __translate_error so that all the EXT2_*_CORRUPTED codes generate
a hard error returning EUCLEAN which is the same errno that the kernel
uses.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677819.1383760.15120011207188940205.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agofuse2fs: rearrange check_inum_access parameters a bit
Darrick J. Wong [Wed, 21 May 2025 22:38:34 +0000 (15:38 -0700)]
fuse2fs: rearrange check_inum_access parameters a bit

Pass the struct fuse2fs pointer to check_inum_access so that we can do
some more rearranging in the next patches.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677801.1383760.3807372754743381596.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agofuse2fs: implement O_TRUNC correctly
Darrick J. Wong [Wed, 21 May 2025 22:38:18 +0000 (15:38 -0700)]
fuse2fs: implement O_TRUNC correctly

Actually truncate files on open with O_TRUNC.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677783.1383760.5736479713431403960.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agofuse2fs: make removexattr work correctly
Darrick J. Wong [Wed, 21 May 2025 22:38:02 +0000 (15:38 -0700)]
fuse2fs: make removexattr work correctly

removexattr is supposed to return ENODATA if the xattr name does not
exist, so we need to check for it explicitly.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677765.1383760.11407998503450588763.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agofuse2fs: enable processing of acls in the kernel
Darrick J. Wong [Wed, 21 May 2025 22:37:47 +0000 (15:37 -0700)]
fuse2fs: enable processing of acls in the kernel

Let the kernel process ACLs.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677747.1383760.17294624757826456720.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agofuse2fs: allow some control over acls
Darrick J. Wong [Wed, 21 May 2025 22:37:31 +0000 (15:37 -0700)]
fuse2fs: allow some control over acls

Allow some control over whether or not ACLs get used, though for kernel
mode it will always be enabled.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677729.1383760.10883670792875770541.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agofuse2fs: fix CLI argument parsing leaks
Darrick J. Wong [Wed, 21 May 2025 22:37:15 +0000 (15:37 -0700)]
fuse2fs: fix CLI argument parsing leaks

Fix some memory leaks in the argument parser.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677711.1383760.4278826288377195178.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agofuse2fs: flip parameter order in __translate_error
Darrick J. Wong [Wed, 21 May 2025 22:37:00 +0000 (15:37 -0700)]
fuse2fs: flip parameter order in __translate_error

Flip the parameter order in __translate_error so that it matches
translate_error.  I wasted too much time debugging a memory corruption
that happened because I converted translate_error to __translate_error
when developing the next patch and the compiler didn't warn me about
mismatched types.

Cc: linux-ext4@vger.kernel.org # v1.43
Fixes: 81cbf1ef4f5dab ("misc: add fuse2fs, a FUSE server for e2fsprogs")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677693.1383760.5102016357729108965.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agofuse2fs: fix error return handling in op_truncate
Darrick J. Wong [Wed, 21 May 2025 22:36:44 +0000 (15:36 -0700)]
fuse2fs: fix error return handling in op_truncate

Fix a couple of bugs with the errcode/ret handling in op_truncate.
First, we need to return ESTALE for a zero inumber because there is no
inode zero in an ext* filesystem.  Second, we need to return negative
errno for failures to libfuse, not raw errcode_t.

Cc: linux-ext4@vger.kernel.org # v1.43
Fixes: 81cbf1ef4f5dab ("misc: add fuse2fs, a FUSE server for e2fsprogs")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677675.1383760.13355151028679279614.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agofuse2fs: support XATTR_CREATE/REPLACE in setxattr
Darrick J. Wong [Wed, 21 May 2025 22:36:28 +0000 (15:36 -0700)]
fuse2fs: support XATTR_CREATE/REPLACE in setxattr

Fix the setxattr implementation to support the create and replace flags
instead of performing an upsert regardless of inputs.

Cc: linux-ext4@vger.kernel.org # v1.43
Fixes: 81cbf1ef4f5dab ("misc: add fuse2fs, a FUSE server for e2fsprogs")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677657.1383760.12232239908991346763.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agofuse2fs: compact all the boolean flags in struct fuse2fs
Darrick J. Wong [Wed, 21 May 2025 22:36:13 +0000 (15:36 -0700)]
fuse2fs: compact all the boolean flags in struct fuse2fs

Compact all the booleans into u8 fields.  I'd go further and turn them
into bitfields but that breaks the fuse argument parsing macros, which
compute the offset of the structure fields, and gcc won't let us do that
to bit fields.  Still, 136 -> 112 bytes isn't bad.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677639.1383760.16546264802006958473.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agofuse2fs: fix cache size parsing
Darrick J. Wong [Wed, 21 May 2025 22:35:57 +0000 (15:35 -0700)]
fuse2fs: fix cache size parsing

Fix the cache size parsing of "cache_size=%s" -- the "%" is at position
11, not 12.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677621.1383760.4131011398253369305.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agofuse2fs: clean up error messages
Darrick J. Wong [Wed, 21 May 2025 22:35:41 +0000 (15:35 -0700)]
fuse2fs: clean up error messages

Instead of horridly line-wrapping multi-line messages that are printed
during mounting, let's just expand them to be one source code line per
printed line.  This will make it a lot easier for someone who sees the
these errors to grep the source code to find out where they came from.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677603.1383760.817536477752866097.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agolibext2fs: fix livelock in the unix io manager
Darrick J. Wong [Wed, 21 May 2025 22:35:26 +0000 (15:35 -0700)]
libext2fs: fix livelock in the unix io manager

generic/441 found a livelock in the unix IO manager.  Let's say that
write_primary_superblock decides to call io_channel_set_blksize in the
process of writing the primary super.

unix_set_blksize then takes the cache and bounce mutexes, and calls
flush_cached_blocks.  If there are dirty blocks in the cache, they will
be written with raw_write_blk.  Unfortunately, that function tries to
take the bounce mutex, which we already hold.  At that point, we
livelock fuse2fs.

Cc: linux-ext4@vger.kernel.org # v1.46.0
Fixes: f20627cc639ab6 ("libext2fs: add threading support to the I/O manager abstraction")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677584.1383760.1107858755678329558.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agolibext2fs: fix unix io manager invalidation
Darrick J. Wong [Wed, 21 May 2025 22:35:10 +0000 (15:35 -0700)]
libext2fs: fix unix io manager invalidation

flush_cached_blocks does not invalidate clean blocks from the block
cache.  From reading all the call sites, it looks like they all actually
want the cache to be empty on successful return, so adjust the
implementation to do this.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174786677566.1383760.15330012260577982100.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 weeks agofuse2fs: fix portability issues when compiling on MacOS
Theodore Ts'o [Fri, 23 May 2025 03:53:40 +0000 (23:53 -0400)]
fuse2fs: fix portability issues when compiling on MacOS

Fix a number of portability issues which resulted in fuse2fs failing
to build on MacOS.

*) MacOS doesn't have the timespec fields in struct stat; we have
   a autoconf test to check for this, so use it.

*) The portable way to print off_t values is to use
   printf("%jd", (intmax_t) d);  The cast is necessary to avoid
   type mismatch warnings.

*) Define FUSE_DARWIN_ENABLE_EXTENSIONS=0 to avoid using random
   structs such as struct fuse_darwin_attr and struct fuse_darwin_fill_dir_t
   in the fuse operation function prototypes.

With these fixes, fuse2fs successfully compiles and works with
MacFuse on macOS Sequoia.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agoe2fsck: fix int vs ssize_t warnings from Coverity
Theodore Ts'o [Thu, 22 May 2025 05:24:52 +0000 (01:24 -0400)]
e2fsck: fix int vs ssize_t warnings from Coverity

Addresses-Coverity-Bug: 1605231
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agoutil: fix potential OOB write in the symlinks build helper
Theodore Ts'o [Thu, 22 May 2025 04:53:02 +0000 (00:53 -0400)]
util: fix potential OOB write in the symlinks build helper

Addresses-Coverity-Bug: 1432089
Addresses-Coverity-Bug: 1433050
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agolibext2fs: fix error paths after alocation failures
Theodore Ts'o [Thu, 22 May 2025 00:16:08 +0000 (20:16 -0400)]
libext2fs: fix error paths after alocation failures

Addresses-Coverity-Bug: 1647960
Addresses-Coverity-Bug: 1647961
Fixes: a5a6bcfb4820 ("libext2fs: make unix_io cache size configurable")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agoFix signed/unsigned compiler warnings
Theodore Ts'o [Wed, 21 May 2025 17:44:24 +0000 (13:44 -0400)]
Fix signed/unsigned compiler warnings

Fixes: a5a6bcfb4820 ("libext2fs: make unix_io cache size configurable")
Fixes: 516805378ff5 ("fuse2fs: allow setting of the cache size")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agomisc: link filefrag with the ext2fs library
Theodore Ts'o [Wed, 21 May 2025 17:41:11 +0000 (13:41 -0400)]
misc: link filefrag with the ext2fs library

If inline functions are not enabled, filefrag needs to link with
libext2fs to be able to access the ext2fs_log_u32() function.

Fixes: be4834c29e6f ("misc: deduplicate log2/log10 functions")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agolibext2fs: add missing function prototypes for new inline functions
Theodore Ts'o [Wed, 21 May 2025 16:33:15 +0000 (12:33 -0400)]
libext2fs: add missing function prototypes for new inline functions

Fixes: be4834c29e6f ("misc: deduplicate log2/log10 functions")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agocreate_inode: fix build failure when libarchive is not present
Theodore Ts'o [Wed, 21 May 2025 16:10:30 +0000 (12:10 -0400)]
create_inode: fix build failure when libarchive is not present

Add the new flags parameter to the version of __populate_fs_from_tar()
used when libarchive is not present to fix a build failure.

Fixes: 2dc83ca9b892 ("create_inode: pass no_copy_xattr via a flag...")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agomke2fs: call create_inode's populate_fs3() requesting EXT2FS_LINK_APPEND
Theodore Ts'o [Tue, 20 May 2025 03:24:31 +0000 (23:24 -0400)]
mke2fs: call create_inode's populate_fs3() requesting EXT2FS_LINK_APPEND

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agocreate_inode: pass no_copy_xattr via a flag instead of using a global variable
Theodore Ts'o [Tue, 20 May 2025 02:33:12 +0000 (22:33 -0400)]
create_inode: pass no_copy_xattr via a flag instead of using a global variable

Add a new function, populate_fs3(), which takes a new flags parameter,
with the first flag being POPULATE_FS_NO_COPY_XATTRS.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agolibext2fs: add the EXT2FS_LINK_APPEND flag to ext2fs_link()
Theodore Ts'o [Tue, 20 May 2025 02:07:55 +0000 (22:07 -0400)]
libext2fs: add the EXT2FS_LINK_APPEND flag to ext2fs_link()

Add a flag which only tries to add the new directory entry to the last
block in the directory.  This is helpful avoids mke2fs -d offering
from an O(n**2) performance bottleneck when adding a large number of
files to a directory.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agomke2fs: don't set the raid stripe for non-rotational devices by default
Theodore Ts'o [Sun, 4 May 2025 18:07:14 +0000 (14:07 -0400)]
mke2fs: don't set the raid stripe for non-rotational devices by default

The ext4 block allocator is not at all efficient when it is asked to
enforce RAID alignment.  It is especially bad for flash-based devices,
or when the file system is highly fragmented.  For non-rotational
devices, it's fine to set the stride parameter (which controls
spreading the allocation bitmaps across the RAID component devices,
which always makessense); but for the stripe parameter (which asks the
ext4 block alocator to try _very_ hard to find RAID stripe aligned
devices) it's probably not a good idea.

Add new mke2fs.conf parameters with the defaults:

[defaults]
   set_raid_stride = always
   set_raid_stripe = disk

Even for RAID arrays based on HDD's, we can still have problems for
highly fragmented file systems.  This will need to solved in the
kernel, probably by having some kind of wall clock or CPU time
limitation for each block allocation or adding some kind of
optimization which is faster than using our current buddy bitmap
implementation, especially if the stripe size is not multiple of a
power of two.  But for SSD's, it's much less likely to make sense even
if we have an optimized block allocator, because if you've paid $$$
for a flash-based RAID array, the cost/benefit tradeoffs of doing less
optimized stripe RMW cycles versus the block allocator time and CPU
overhead is harder to justify without a lot of optimization effort.

If and when we can improve the ext4 kernel implementation (and it gets
rolled out to users using LTS kernels), we can change the defaults.
And of course, system administrators can always change
/etc/mke2fs.conf settings.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agolibext2fs: rename fls() to find_last_bit_set()
Theodore Ts'o [Wed, 21 May 2025 14:39:53 +0000 (10:39 -0400)]
libext2fs: rename fls() to find_last_bit_set()

In unix_io.c, rename fls() since some systems may already define it in
a system header file to fix a portability problem on MacOS.  The name
"find_last_bit_set" is a bit more self-descriptive anyway.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: allow setting of the cache size
Darrick J. Wong [Thu, 24 Apr 2025 21:46:49 +0000 (14:46 -0700)]
fuse2fs: allow setting of the cache size

Create a CLI option so that we can adjust the disk cache size, and set
it to 32MB by default.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065600.1161238.586822649522740605.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: allow use of direct io for disk access
Darrick J. Wong [Thu, 24 Apr 2025 21:46:33 +0000 (14:46 -0700)]
fuse2fs: allow use of direct io for disk access

Allow users to ask for O_DIRECT for disk accesses so that block device
writes won't be throttled.  This should improve latency, but will put
a lot more pressure on the disk cache.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065581.1161238.969038742323698265.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agolibext2fs: use hashing for cache lookups in unix IO manager
Darrick J. Wong [Thu, 24 Apr 2025 21:46:15 +0000 (14:46 -0700)]
libext2fs: use hashing for cache lookups in unix IO manager

Use a hash to avoid the linear scan.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065563.1161238.5896022194303080059.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agolibext2fs: make unix_io cache size configurable
Darrick J. Wong [Thu, 24 Apr 2025 21:45:59 +0000 (14:45 -0700)]
libext2fs: make unix_io cache size configurable

Make it so that we can reconfigure the unix IO manager cache size.
fuse2fs might want more than 32 blocks.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065546.1161238.2653341081512215032.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: report cache hits and misses at unmount time
Darrick J. Wong [Thu, 24 Apr 2025 21:45:43 +0000 (14:45 -0700)]
fuse2fs: report cache hits and misses at unmount time

Log the IO cache's hit and miss quantities at unmount time.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065528.1161238.4178228996070898927.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: delegate access control decisions to the kernel
Darrick J. Wong [Thu, 24 Apr 2025 21:45:28 +0000 (14:45 -0700)]
fuse2fs: delegate access control decisions to the kernel

In "kernel" mode (aka allow_others + default_permissions), the kernel
enforces all the access control for us.  Therefore, we don't need to do
any checking of our own.  Create a purpose-built helper to detect this
situation and turn off all the access controlling.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065373.1161102.14873909355987419902.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: refactor sysadmin predicate
Darrick J. Wong [Thu, 24 Apr 2025 21:45:12 +0000 (14:45 -0700)]
fuse2fs: refactor sysadmin predicate

Refactor the code that decides if an access is being made by the
superuser into a helper, which we'll use to fix more permissions
problems in the next patch.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065355.1161102.13914905314262828953.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: report inode number and file type via readdir
Darrick J. Wong [Thu, 24 Apr 2025 21:44:57 +0000 (14:44 -0700)]
fuse2fs: report inode number and file type via readdir

Report the inode number and file type in readdir to speed up directory
iteration a bit.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065213.1160461.4431922817174080124.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: fix FITRIM validation
Darrick J. Wong [Thu, 24 Apr 2025 21:44:41 +0000 (14:44 -0700)]
fuse2fs: fix FITRIM validation

Fix the validation here to match the kernel, and report the number of
blocks trimmed.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065195.1160461.15575039465292160279.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: disable renameat2
Darrick J. Wong [Thu, 24 Apr 2025 21:44:25 +0000 (14:44 -0700)]
fuse2fs: disable renameat2

Apparently fuse munged rename and renameat2 together into the same
upcall, so we actually have to filter out nonzero flags because
otherwise we do a regular rename for a RENAME_EXCHANGE/WHITEOUT, which
is not what the user asked for.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065177.1160461.684615549721279410.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: report real inode numbers
Darrick J. Wong [Thu, 24 Apr 2025 21:44:10 +0000 (14:44 -0700)]
fuse2fs: report real inode numbers

Report real inode numbers in stat instead of letting fuse invent them
for us.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065159.1160461.12395515521619169511.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: update new child timestamps during mkdir/symlink
Darrick J. Wong [Thu, 24 Apr 2025 21:43:54 +0000 (14:43 -0700)]
fuse2fs: update new child timestamps during mkdir/symlink

These two file creation functions fail to update the timestamps of the
new child file, unlike the others (mknod/creat).  Fix that.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065141.1160461.7342685341356901806.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: support changing newer iflags
Darrick J. Wong [Thu, 24 Apr 2025 21:43:39 +0000 (14:43 -0700)]
fuse2fs: support changing newer iflags

Redefine FUSE2FS_MODIFIABLE_IFLAGS so that userspace can modify any
flags that the kernel can, except for the ones that fuse2fs lacks the
ability to change.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065123.1160461.3149004980436873980.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: support getting and setting via struct fsxattr
Darrick J. Wong [Thu, 24 Apr 2025 21:43:23 +0000 (14:43 -0700)]
fuse2fs: support getting and setting via struct fsxattr

Support querying xfs file attributes in fuse2fs so that the vfs
getattr/setattr functions continue to work.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065105.1160461.8046224721957766466.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: add supportable mount options from the kernel
Darrick J. Wong [Thu, 24 Apr 2025 21:43:07 +0000 (14:43 -0700)]
fuse2fs: add supportable mount options from the kernel

Add all the kernel mount options that we can actually support.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065087.1160461.16716917319493753291.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: clamp timestamps that are being written to disk
Darrick J. Wong [Thu, 24 Apr 2025 21:42:52 +0000 (14:42 -0700)]
fuse2fs: clamp timestamps that are being written to disk

Clamp the timestamps that we write to disk to the minimum and maximum
values permitted given the ondisk format.  This fixes y2038 support, as
tested by generic/402.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065069.1160461.14751120886781323020.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: report nanoseconds resolution through getattr
Darrick J. Wong [Thu, 24 Apr 2025 21:42:36 +0000 (14:42 -0700)]
fuse2fs: report nanoseconds resolution through getattr

Report the nanonseconds component of timestamps via getattr, and tell
fuse that we actually support nanosecond granularity.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065051.1160461.5080284869849276746.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: add an easy option for emulating kernel access behaviors
Darrick J. Wong [Thu, 24 Apr 2025 21:42:20 +0000 (14:42 -0700)]
fuse2fs: add an easy option for emulating kernel access behaviors

By default, fuse doesn't allow processes with a uid/gid that don't match
those of the server process to access the fuse mount, it doesn't allow
suid files or devices, and it relies on the fuse server to perform
permissions checking.  This is a secure default for very untrusted
filesystems, but it's possible that we might actually want to allow
general access to an ext4 filesystem as part of containerizing the ext4
metadata parsing.  In other words, we want the kernel access control
behavior.

Add an "kernel" mount option that moves most of the access permissions
interpretation back into the kernel, and logs mount/unmount/error
messages to dmesg.  Right now this is mostly useful for fstests, so we
leave it off by default.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065033.1160461.1393760776420459221.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: log names of xattrs being set/get/removed
Darrick J. Wong [Thu, 24 Apr 2025 21:42:05 +0000 (14:42 -0700)]
fuse2fs: log names of xattrs being set/get/removed

Actually record the names of the xattrs being modified to make it easier
to debug fstests failures.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553065016.1160461.12942341433377716292.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: remove posix acl translation
Darrick J. Wong [Thu, 24 Apr 2025 21:41:49 +0000 (14:41 -0700)]
fuse2fs: remove posix acl translation

Remove the POSIX ACL format translation since libext2fs takes care of
that now.

Fixes: 0ee1eaf70c257e ("libext2fs: translate internal ext4 acl to Posix ACL in ext2fs_xattr_[sg]et()")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553064997.1160461.14235157932332388225.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: implement zero range
Darrick J. Wong [Thu, 24 Apr 2025 21:41:34 +0000 (14:41 -0700)]
fuse2fs: implement zero range

Implement FALLOC_FL_ZERO_RANGE.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553064980.1160461.9850792727586596449.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: return -EOPNOTSUPP when we don't recognize a fallocate mode
Darrick J. Wong [Thu, 24 Apr 2025 21:41:18 +0000 (14:41 -0700)]
fuse2fs: return -EOPNOTSUPP when we don't recognize a fallocate mode

If we don't recognize a set bit in the mode parameter to fallocate,
return EOPNOTSUPP to communicate that we don't support that mode instead
of EINVAL.  This avoids unnecessary failures in generic/521 such as:

generic/521       - output mismatch (see /var/tmp/fstests/generic/521.out.bad)
    --- tests/generic/521.out   2025-01-30 10:00:16.898276477 -0800
    +++ /var/tmp/fstests/generic/521.out.bad    2025-04-03 14:46:20.019822396 -0700
    @@ -1,2 +1,9 @@
     QA output created by 521
    +zero range: 0x407ca to 0x52885
    +do_zero_range: fallocate: Invalid argument

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553064961.1160461.9412670014664878384.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: refuse unsupported features
Darrick J. Wong [Thu, 24 Apr 2025 21:41:02 +0000 (14:41 -0700)]
fuse2fs: refuse unsupported features

Don't mount a filesystem with superblock features that we don't actually
know how to support.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553064943.1160461.14810321477577468832.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: make "ro" behavior consistent with the kernel
Darrick J. Wong [Thu, 24 Apr 2025 21:40:47 +0000 (14:40 -0700)]
fuse2fs: make "ro" behavior consistent with the kernel

Make the behavior of the "ro" mount option consistent with the kernel:
User programs cannot change the files in the filesystem, but the driver
itself is allowed to update the filesystem metadata.  This means that ro
mounts can recover the journal.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553064727.1160289.10466952108264302412.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: set fuse subtype via argv[0] if possible
Darrick J. Wong [Thu, 24 Apr 2025 21:40:31 +0000 (14:40 -0700)]
fuse2fs: set fuse subtype via argv[0] if possible

If argv[0] ends in "ext[0-9]", set the fuse subtype string to this
value.  This enables us to place fuse2fs at some place in the filesystem
like /sbin/mount.ext2 and have /proc/mounts report the filesystem type
as "fuse.ext2".  This is fairly boring, but it'll make it easier to test
things in fstests.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553064709.1160289.11028230202411857669.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: add dummy acl/user_xattr mount options
Darrick J. Wong [Thu, 24 Apr 2025 21:40:16 +0000 (14:40 -0700)]
fuse2fs: add dummy acl/user_xattr mount options

ACLs and user xattrs are always supported, so add these mount options
and do nothing.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553064691.1160289.2390597214443719562.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: redirect all messages when FUSE2FS_LOGFILE is set
Darrick J. Wong [Thu, 24 Apr 2025 21:40:00 +0000 (14:40 -0700)]
fuse2fs: redirect all messages when FUSE2FS_LOGFILE is set

If the user sets FUSE2FS_LOGFILE, redirect all debug messages and error
reports to that file.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553064545.1160047.7348261379704899161.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: make other logging consistent
Darrick J. Wong [Thu, 24 Apr 2025 21:39:44 +0000 (14:39 -0700)]
fuse2fs: make other logging consistent

Make all the other advisory messages have a consistent format.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553064527.1160047.12420605972373641844.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: use error logging macro for mount errors
Darrick J. Wong [Thu, 24 Apr 2025 21:39:29 +0000 (14:39 -0700)]
fuse2fs: use error logging macro for mount errors

Use err_printf for mount errors so that they all have a standard format
and go where all the other errors go.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553064509.1160047.12034355870702470696.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: stop aliasing stderr with ff->err_fp
Darrick J. Wong [Thu, 24 Apr 2025 21:39:13 +0000 (14:39 -0700)]
fuse2fs: stop aliasing stderr with ff->err_fp

Remove this pointless aliasing of error stream pointers.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553064491.1160047.2269966041756188067.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agofuse2fs: enable runtime debugging
Darrick J. Wong [Thu, 24 Apr 2025 21:38:57 +0000 (14:38 -0700)]
fuse2fs: enable runtime debugging

Whenever fuse2fs is started with -o fuse2fs_debug, we should log all the
debugging messages generated by fuse2fs itself and libfuse.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553064473.1160047.16179858742889092063.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agojournal: increase revoke block hash size
Andreas Dilger [Sat, 25 Jan 2025 00:42:19 +0000 (17:42 -0700)]
journal: increase revoke block hash size

Increase the size of the revoke block hash table to scale with the
size of the journal, so that we don't get long hash chains if there
are a large number of revoke blocks in the journal to replay.

The new hash size will default to 1/16 of the blocks in the journal.
This is about 1 byte per block in the hash table, but there are two
allocated.  The total amount of memory allocated for revoke blocks
depends much more on how many are in the journal, and not on the size
of the hash table.  The system is regularly using this much memory
for the journal blocks, so the hash table size is not a big factor.

Consolidate duplicate code between recover_ext3_journal() and
ext2fs_open_ext3_journal() in debugfs.c to avoid duplicating logic.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Change-Id: Ibadf2a28c2f42fa92601f9da39a6ff73a43ebbe5
Reviewed-on: https://review.whamcloud.com/52386
Link: https://lore.kernel.org/r/20250125004220.44607-2-adilger@whamcloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agomisc: deduplicate log2/log10 functions
Andreas Dilger [Sat, 25 Jan 2025 00:42:18 +0000 (17:42 -0700)]
misc: deduplicate log2/log10 functions

Remove duplicate log2() and log10() functions and replace them with
functions ext2fs_log2_u{32,64}() and ext2fs_log10_u{32,64}().

The int_log10() functions in progress.c and mke2fs.c were not like
the others, since they did not divide by the base before increment,
effectively rounding up instead of down.  Compensate by adding one
to the returned ext2fs_log10_u32() value at the callers.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Change-Id: Ifc86efe7e5f0243eb914c6d24319cc7dee3ebbe5
Reviewed-on: https://review.whamcloud.com/52385
Link: https://lore.kernel.org/r/20250125004220.44607-1-adilger@whamcloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agodebugfs: byteswap dirsearch dirent buf on big endian systems
Brian Foster [Thu, 23 Jan 2025 13:52:11 +0000 (08:52 -0500)]
debugfs: byteswap dirsearch dirent buf on big endian systems

fstests test ext4/048 fails on big endian systems due to broken
debugfs dirsearch functionality. On an s390x system and 4k block
size, the dirsearch command seems to hang indefinitely. On the same
system with a 1k block size, the command fails to locate an existing
entry and causes the test to fail due to unexpected results.

The cause of the dirsearch failure is lack of byte swapping of the
on-disk (little endian) dirent buffer before attempting to iterate
entries in the given block. This leads to garbage record and name
length values, for example. To resolve this problem, byte swap the
directory buffer on big endian systems.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/20250123135211.575895-1-bfoster@redhat.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agoe2image.8: add missing comma
Jakub Wilk [Tue, 7 Jan 2025 07:07:24 +0000 (08:07 +0100)]
e2image.8: add missing comma

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/20250107070724.6375-1-jwilk@jwilk.net
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agotune2fs: do not update quota when not needed
Gwendal Grignou [Fri, 3 Jan 2025 23:50:42 +0000 (15:50 -0800)]
tune2fs: do not update quota when not needed

Enabling quota is expensive: All inodes in the filesystem are scanned.
Only do it when the requested quota configuration does not match the
existing configuration.

Test:
Add a tiny patch to print out when core of function
handle_quota_options() is triggered.
Issue commands:
truncate -s 1G unused ; mkfs.ext4 unused

| commands                                                | trigger |
comments
+---------------------------------------------------------+---------+---------
| tune2fs -Qusrquota,grpquota -Qprjquota -O quota unused  | Y       |
                  Quota not set at formatting.
| tune2fs -Qusrquota,grpquota -Qprjquota -O quota unused  | N       |
                  Already set just above
| tune2fs -Qusrquota,grpquota -Q^prjquota -O quota unused | Y       |
                  Disabling a quota
| tune2fs -Qusrquota,grpquota -Q^prjquota -O quota unused | N       |
                  No change from previous line.
| tune2fs -Qusrquota,grpquota -O quota unused             | N       |
                  No change from previous line.
| tune2fs -Qusrquota,^grpquota -O quota unused            | Y       |
                  Disabling a quota
| tune2fs -Qusrquota -O quota unused                      | N       |
                  No change from previous line.
| tune2fs -O ^quota unused                                | Y       |
                  Remove quota
| tune2fs -O quota unused                                 | Y       |
                  Re-enable quota, default values
                  (-Qusrquota,grpquota) used.
| tune2fs -O quota -Qusrquota unused                      | N       |
                  Already set just above

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20250103235042.4029197-1-gwendal@chromium.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 weeks agolibext2fs: teach ext2fs_extent_set_bmap() to update extents more optimally
Theodore Ts'o [Wed, 21 May 2025 02:53:41 +0000 (22:53 -0400)]
libext2fs: teach ext2fs_extent_set_bmap() to update extents more optimally

When programs like resize2fs or e2fsck relocates all of the blocks in
an extent one at a time, the ext2fs_extent_set_bmap() works by
initially adding a new extent and then moving mapping from the old
extent to the new extent.  For example:

t=1   EXTENTS: (0-2) 1152-1154

t=2   EXTENTS: (0) 1136, (1-2) 1153-1154

t=3   EXTENTS: (0-1) 1136-1137, (2) 1154

Unfortunately, previously, when the last block is updated, the
resulting extent tree will have two extents instead of one, like this:

t=4   EXTENTS: (0-1) 1136-1137, (2) 1138

With this commit, the resulting extent tree will be more optimally
represented with a single extent:

t=4   EXTENTS: (0-2) 1136-1138

The optimization in this commit solves the prolem reproted at:
https://github.com/tytso/e2fsprogs/issues/146

In that case, the file had a very large, complex (fragmented) extent
tree, and resize2fs needed to relcate all of its blocks as part of a
off-line shrink, the lack of the optimization led to an extent block
overflowing, resulting in the old extent (the one which originally
mapped logical block 2507128 to physical block 389065080) and the new
extent landing in two different leaf blocks:

 2/ 2   1/  1  2507128 -  2507128    640097 -    640097      1
 2/ 2   1/135  2507128 -  2507128 389065080 - 389065080      1

This resulted a corrupted extent tree block and data loss.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 months agofuse2fs: clarify warning message that fuse2fs does not support the journal
Theodore Ts'o [Tue, 8 Apr 2025 12:14:29 +0000 (08:14 -0400)]
fuse2fs: clarify warning message that fuse2fs does not support the journal

https://github.com/tytso/e2fsprogs/issues/220

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 months agotest: fix expect files which changed after EA bugfix
Theodore Ts'o [Sat, 22 Mar 2025 20:18:26 +0000 (16:18 -0400)]
test: fix expect files which changed after EA bugfix

The logic bug which was fixed in commit 92b6e93936d7 ("e2fsck: fix
logic bug when there are no references...") resulted in some silent
fixes that were never logged, and in some cases, corruption that was
not cleaned up.   Fix the tests so that they pass as expected.

Fixes: 92b6e93936d7 ("e2fsck: fix logic bug when there are no references..."
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 months agoe2fsck: fix logic bug when there are no references to an EA inode
Theodore Ts'o [Mon, 17 Mar 2025 14:38:44 +0000 (10:38 -0400)]
e2fsck: fix logic bug when there are no references to an EA inode

There was a boolean logic error which, among other things, could cause
an attempt to modify an inode in e2fsck -n mode:

e2fsck 1.47.2 (1-Jan-2025)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
ext2fs_write_inode: Attempt to write to filesystem opened read-only while writing inode 14 in pass4
e2fsck: aborted

Fixes: 849a9e6e133a ("e2fsck: add more checks for ea inode consistency")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
3 months agoDon't compile util/symlinks on Windows
Theodore Ts'o [Thu, 6 Mar 2025 03:41:43 +0000 (22:41 -0500)]
Don't compile util/symlinks on Windows

This helper program is only needed when building elf shared libraries,
and for some reason Windows is failing to compile POSIX's struct stat.
Windows doesn't support symlinks anyway.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
4 months agolsattr: fix potential 32-bit integer overflow warning
Theodore Ts'o [Wed, 26 Feb 2025 04:08:55 +0000 (23:08 -0500)]
lsattr: fix potential 32-bit integer overflow warning

This can't happen in practice due to MAXPATHNAMELEN constraints, but
gcc is too dumb to know that.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
4 months agoFix continuous integration testing workflow on Windows with mingw64
Theodore Ts'o [Wed, 26 Feb 2025 03:39:52 +0000 (22:39 -0500)]
Fix continuous integration testing workflow on Windows with mingw64

The subs Makefile target has been renamed to top-deps

Fixes: 3c8d4f6e0183 ('Fix parallel "make -j install"')
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
4 months agoblkid: use offsetof() to avoid UBSAN warnings
Theodore Ts'o [Wed, 26 Feb 2025 02:51:43 +0000 (21:51 -0500)]
blkid: use offsetof() to avoid UBSAN warnings

Newer versions of clang complain about "member access within null
pointer" when using the construct:

(unsigned long)(intptr_t)(&((type *)0)->member)

So use offsetof(type, member) instead.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
4 months agomisc: fix missing variable names in function prototype
Theodore Ts'o [Mon, 24 Feb 2025 05:00:42 +0000 (00:00 -0500)]
misc: fix missing variable names in function prototype

If libarchive support is not available or has been disable, the
function __populate_fs_from_tar() just prints an error message, and
doesn't use any of the function paramaters.  Newer versions of gcc
won't complain about the missing function names, since newer C
standards allow this, but it breaks on older versions of gcc.

Also return the error code ENOTSUP instead of 1.

https://github.com/tytso/e2fsprogs/issues/213

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
4 months agomisc: fix a typo which broke "configure --without-libarchive"
Theodore Ts'o [Mon, 24 Feb 2025 04:30:21 +0000 (23:30 -0500)]
misc: fix a typo which broke "configure --without-libarchive"

https://github.com/tytso/e2fsprogs/issues/212

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
a typo in create_inode_libarchive.c

4 months agorelease-checklist: add reminder to update the RELEASE-NOTES symlink
Theodore Ts'o [Mon, 24 Feb 2025 04:27:39 +0000 (23:27 -0500)]
release-checklist: add reminder to update the RELEASE-NOTES symlink

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
4 months agoTeach the makefile to build all of the programs in the util directory
Theodore Ts'o [Sat, 22 Feb 2025 05:14:24 +0000 (00:14 -0500)]
Teach the makefile to build all of the programs in the util directory

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
4 months agoFix dependencies in scrub's Makefile
Theodore Ts'o [Sat, 22 Feb 2025 05:13:01 +0000 (00:13 -0500)]
Fix dependencies in scrub's Makefile

Fix the dependences so things work correctly if the user runs "make
install" without running "make all" first.

4 months agoFix parallel "make -j install"
Theodore Ts'o [Sat, 22 Feb 2025 04:54:02 +0000 (23:54 -0500)]
Fix parallel "make -j install"

If running a parallel install with --enable-elf-shlibs, multiple makes
in different library directories can collide while try building
util/symlinks.  Fix this by building util/symlinks and
util/install-symlink as part of the top-level Makefile building other
dependencies before recursing into other directories.

https://github.com/tytso/e2fsprogs/issues/200

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 months agoUpdate RELEASE-NOTES symlink
Theodore Ts'o [Tue, 28 Jan 2025 17:35:10 +0000 (12:35 -0500)]
Update RELEASE-NOTES symlink

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agoUpdate release notes, etc., for the 1.47.2 release
Theodore Ts'o [Wed, 1 Jan 2025 06:24:42 +0000 (01:24 -0500)]
Update release notes, etc., for the 1.47.2 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agoconfig: update config.{guess,sub}
Theodore Ts'o [Wed, 1 Jan 2025 06:21:15 +0000 (01:21 -0500)]
config: update config.{guess,sub}

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agopo: update the binary gmo files
Theodore Ts'o [Wed, 1 Jan 2025 06:09:43 +0000 (01:09 -0500)]
po: update the binary gmo files

Also relax the msgfmt checking to avoid using --check-format, since
e2fsck's problem string's %-interpolation allows the ordering of
block, inode, etc. numbers to be moved around in translations.  (And
the recent update to the Spanish po file takes advantage of this
feature.)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agodebian: decrease priority of e2fsprogs from required to important
Theodore Ts'o [Wed, 1 Jan 2025 04:45:52 +0000 (23:45 -0500)]
debian: decrease priority of e2fsprogs from required to important

Addresses-Debian-Bug: #897277
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agopo: update zh_CN.po (from translationproject.org)
Wenbin Lv [Tue, 31 Dec 2024 23:41:35 +0000 (18:41 -0500)]
po: update zh_CN.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agopo: update uk.po (from translationproject.org)
Yuri Chornoivan [Tue, 31 Dec 2024 23:41:35 +0000 (18:41 -0500)]
po: update uk.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agopo: update sv.po (from translationproject.org)
Göran Uddeborg [Tue, 31 Dec 2024 23:41:35 +0000 (18:41 -0500)]
po: update sv.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agopo: update ro.po (from translationproject.org)
Remus-Gabriel Chelu [Tue, 31 Dec 2024 23:41:35 +0000 (18:41 -0500)]
po: update ro.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Tue, 31 Dec 2024 23:41:35 +0000 (18:41 -0500)]
po: update pl.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agopo: update ms.po (from translationproject.org)
Sharuzzaman Ahmat Raslan [Tue, 31 Dec 2024 23:41:35 +0000 (18:41 -0500)]
po: update ms.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agopo: update fr.po (from translationproject.org)
Samuel Thibault [Tue, 31 Dec 2024 23:41:35 +0000 (18:41 -0500)]
po: update fr.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agopo: update es.po (from translationproject.org)
Antonio Ceballos [Tue, 31 Dec 2024 23:41:35 +0000 (18:41 -0500)]
po: update es.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agopo: update cs.po (from translationproject.org)
Petr Pisar [Tue, 31 Dec 2024 23:41:34 +0000 (18:41 -0500)]
po: update cs.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agodebian: sort the symbol list for libext2fs2t64
Theodore Ts'o [Mon, 16 Dec 2024 05:00:21 +0000 (00:00 -0500)]
debian: sort the symbol list for libext2fs2t64

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agodebian: disable salsa CI on non-debian branches
Theodore Ts'o [Mon, 16 Dec 2024 04:16:05 +0000 (23:16 -0500)]
debian: disable salsa CI on non-debian branches

The Salsa CI attempts to do a package build, and the debian/patches
directory is generally not set up correctly for a successful source
build on non-debian branches.  So skip them to avoid failed builds and
to avoid wasting CI bandwidth.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agorezize2fs: fix memory leak when fixing up the orphan file inode
Theodore Ts'o [Wed, 11 Dec 2024 04:59:59 +0000 (23:59 -0500)]
rezize2fs: fix memory leak when fixing up the orphan file inode

Fixes: ff4f46b4fdb2 ("resize2fs: rewrite the checksums in the orphan...")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agolibext2fs: fix compiler warning in ext2fs_orphan_file_block_csum_set()
Theodore Ts'o [Tue, 10 Dec 2024 04:48:50 +0000 (23:48 -0500)]
libext2fs: fix compiler warning in ext2fs_orphan_file_block_csum_set()

Fixes: daf2d1c830d9 ("libext2fs: fix ext2fs_orphan_file_block_csum_set()")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>