Whamcloud - gitweb
Michael Hudson-Doyle [Thu, 26 May 2022 01:08:28 +0000 (13:08 +1200)]
resize2fs: open device read-only when -P is passed
We ran into this because we noticed that resize2fs -P $device was
triggering udev events.
I added a very simple test that just checks resize2fs -P on a file
lacking the w bit succeeds.
Signed-off-by: Michael Hudson-Doyle <michael.hudson@ubuntu.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Tue, 1 Mar 2022 04:17:06 +0000 (21:17 -0700)]
tests: fix ACL-printing tests
Fix the ACL-printing tests to be more flexible for different systems.
If the MKFS_DIR is on tmpfs, it will not list "system.posix_acl*"
xattrs, so they will not be copied. Create this on a real filesystem
or skip the test if that doesn't work.
Filter out the security.selinux xattr if it is printed, since this
depends on the selinux configuration of the host system. However,
this also spills xattrs for "acl_dir/file" into an external xattr
block, and causes it to fail due to different block allocations.
Increase the filesystem inode size so that the allocation is the same
regardless of whether selinux is enabled or not.
Fixes:
67e6ae0a35 ("mke2fs: fix a importing a directory with an ACL")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@hpe.com>
Reviewed-by: Li Dongyang <dongyangli@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Gabriel Krisman Bertazi [Mon, 25 Apr 2022 22:01:00 +0000 (18:01 -0400)]
e2fsck: always probe filesystem blocksize with simple io_manager
Combining superblock (-b) with undo file (-z) fails iff the block size
is not specified (-B) and is different from the first blocksize probed
in try_open_fs (1k). The reason is as follows:
try_open_fs() will probe different blocksizes if none is provided on
the command line. It is done by opening and closing the filesystem
until it finds a blocksize that makes sense. This is fine for all
io_managers, but undo_io creates the undo file with that blocksize
during ext2fs_open. Once try_open_fs realizes it had the wrong
blocksize and retries with a different blocksize, undo_io will read
the previously created file and think it's corrupt for this
filesystem.
Ideally, undo_io would know this is a probe and would fix the undo file.
It is not simple, though, because it would require undo_io to know the
file was just created by the probe code, since an undo file survives
through different fsck sessions. We'd have to pass this information
around somehow. This seems like a complex change to solve a corner
case.
Instead, this patch changes the blocksize probe to always use the
unix_io_manager. This way, we safely probe for the blocksize without
side effects. Once the blocksize is known, we can safely reopen the
filesystem under the proper io_manager.
An easily reproducer for this issue (from Ted, adapted by me) is:
mke2fs -b 4k -q -t ext4 /tmp/foo.img 2G
e2fsck -b 32768 -z /tmp/undo /tmp/foo.img
Reported-by: Peter Urbanec <linux-ext4.vger.kernel.org@urbanec.net>
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Thu, 4 Aug 2022 17:18:32 +0000 (11:18 -0600)]
Quiet unused variable warnings
Quiet various compiler warnings about unreferenced or unset variables.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Kiselev, Oleg [Sat, 14 May 2022 04:17:09 +0000 (04:17 +0000)]
resize2fs: trim resize to cluster boundary
This patch rounds down the size provided to resize2fs to the nearest
cluster boundary for bigalloc filesystems. This is similar to the
trimming already done for page boundary alignment. Aligning the size in
the user space provides the right value feedback from the resize2fs
command, which is a better user experience than trimming the size
in the kernel.
Signed-off-by: Oleg Kiselev <okiselev@amazon.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Thu, 11 Aug 2022 02:48:13 +0000 (22:48 -0400)]
e2fsck: handle invalid percent expansions in the log filename
Add a missing default: case when expanding percent expansions in the
log file specified in /etc/e2fsck.conf.
Addresses-Coverity-Bug: 1500757
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Thu, 11 Aug 2022 02:43:00 +0000 (22:43 -0400)]
libext2fs: validate block # of the inode table in ext2fs_image_inode_write()
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 6 Aug 2022 22:35:30 +0000 (18:35 -0400)]
Build the fuzzers from oss-fuzz
The fuzzers from oss-fuzz in projects/e2fsprogs/fuzz (as of commit
78ecd3f07fca with some slight modifications for better error
reporting) have been placed in the tests/fuzz directory and the
configure script now supports a new option --enable-fuzzing which will
build these fuzzers using clang's -fsanitize=fuzzer command line
option.
In general, some sanitizer such as --enable-addrsan or --enable-ubsan
(to enable ASAN or UBSAN, respectively) should be enabled alongside
--enable-fuzzing.
A typical configure command to build the fuzzers might be:
configure CC=clang CXX=clang++ CFLAGS=-g --enable-fuzzing --enable-addrsan
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 9 Aug 2022 15:16:47 +0000 (11:16 -0400)]
libext2fs: fix potential integer overflow in bitmap accessors
bmap->cluster_bits has a maximum value of 19, but Coverity doesn't
know that. To make it happy, and just in case there is a bug where
somehow the cluster size does get set to an invalid value and the rest
of the library doesn't check it, use 1ULL instead of 1 to avoid the
integer overflow.
Addresses-Coverity-Bug: 1500759
Addresses-Coverity-Bug: 1500764
Addresses-Coverity-Bug: 1500771
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 9 Aug 2022 14:52:57 +0000 (10:52 -0400)]
e2fsck: fix potential fencepost error in e2fsck_should_rebuild_extents()
The ext2_extent_info.max_depth is zero-based (e.g., it is zero when
the entire extent tree fits in the inode). Hence, if it is equal to
MAX_EXTENT_DEPTH_COUNT we should always rebuild the extent tree to
shorten it.
Also, for 1k block file systems, it's possible for the worst-case
extent tree in its most compact form to have a maximum depth of 6, not
5. So set MAX_EXTENT_DEPTH_COUNT to 8 just to be sure we have plenty
of headroom. (The kernel supports an extent depth up to 2**16, but
e2fsck only keeps statistics up to MAX_EXTENT_DEPTH_COUNT, and if it's
deeper than that, we know that it will be profitable to rebuild the
extent tree in any case.)
Addresses-Coverity-Bug: 1507761
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 9 Aug 2022 01:02:51 +0000 (21:02 -0400)]
libext2fs: make sure the bitmap locations are valid when writing bitmaps
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 9 Aug 2022 00:52:43 +0000 (20:52 -0400)]
libext2fs: reject various bitmap and inode operations for journal_dev file systems
The ext2fs_open() function will only allow journal_dev file systems to
be open if explicitly requested by programs using the
EXT2_FLAG_JOURNAL_DEV_OK flag. Those programs will not try to call
functions that make no sense, such as ext2fs_read_inode(),
ext2fs_read_bitmaps(), etc. Just to make things the library more
robust against buggy programs (or unrealistic fuzzers) add a check for
journal_dev file systems to various ext2fs library functions to return
a new error, EXT2_ET_EXTERNAL_JOURNAL_NOSUPP.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 9 Aug 2022 00:17:40 +0000 (20:17 -0400)]
libext2fs: in ext2fs_open[2](), return an error if s_desc_size is too large
Previously, ext2fs_open() and ext2fs_open2() would return an error if
s_desc_size is too small. Add a check so it will return an error if
s_desc_size is too large, as well.
These checks will be skipped for e2fsck when it uses the flag
EXT2_FLAG_IGNORE_SB_ERRORS.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 6 Aug 2022 18:58:40 +0000 (14:58 -0400)]
Update configure/configure.ac/aclocal.m4 to use autoconf 2.71
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 7 Aug 2022 23:47:25 +0000 (19:47 -0400)]
Fix UBSAN if s_log_groups_per_flex is 31
It is logal (albeit rare) for the number of block groups per flex_bg
to 2**31 (which effectively means to put all of the block groups into
a single flex_bg). However, in that case "1 << 31" is undefined on
architectures with a 32-bit integer. Fix this UBSAN complaint by
using "1U << 31" instead.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 6 Aug 2022 06:21:49 +0000 (02:21 -0400)]
libext2fs: teach ext2fs_open() to reject file systems with an invalid flex_bg size
If s_log_groups_per_flex is greater than 31, it will result in an
UBSAN error, since it will result in an invalid shift exponent when
calculating the flex_bg size. So reject such file systems when they
are opened. (The mke2fs program will not allow the creation of such
file systems, so they can only occur due to corruption.)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 6 Aug 2022 05:37:20 +0000 (01:37 -0400)]
libext2fs: teach ext2fs_open() to reject file systems with an invalid cluster size
If the cluster size is smaller than the block size, this can result in
a negative shift, which is undefined. When such a file system is
opened, immediately return an error indicating that the file system is
corrupted.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Thu, 4 Aug 2022 19:18:15 +0000 (15:18 -0400)]
resize2fs: fix to respect the environment variable E2FSPROGS_FAKE_TIME
When performing an off-line resize, if an inode's block map needs to
be updated, resize2fs will update the inode's ctime. In addition, if
inode numbers need to be renumbered due to the file system shrinking
forcing the inode table to be shrunk, any directories which need to be
modified will have their ctime and mtime updated.
If the E2FSPROGS_FAkE_TIME environment variable is set, when the file
system is opened, fs->now will be set to this value, and resize2fs
needs to use it instead of calling time(0) to get their current time.
Addresses-Google-Bug:
230874381
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 7 Jun 2022 03:48:37 +0000 (23:48 -0400)]
libext2fs: check for invalid blocks in ext2fs_punch_blocks()
If the extent tree has out-of-range physical block numbers, don't try
to release them.
Also add a similar check in ext2fs_block_alloc_stats2() to avoid a
NULL pointer dereference.
Reported-by: Nils Bars <nils.bars@rub.de>
Reported-by: Moritz Schlögel <moritz.schloegel@rub.de>
Reported-by: Nico Schiller <nico.schiller@rub.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 7 Jun 2022 02:49:47 +0000 (22:49 -0400)]
libext2fs: check for cyclic loops in the extent tree
In the extent tree handling code in libext2fs, when we go move down
the extent tree, if a cyclic loop is detected, return an error.
Reported-by: Nils Bars <nils.bars@rub.de>
Reported-by: Moritz Schlögel <moritz.schloegel@rub.de>
Reported-by: Nico Schiller <nico.schiller@rub.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 7 Jun 2022 02:44:35 +0000 (22:44 -0400)]
e2fsck: avoid out-of-bounds write for very deep extent trees
The kernel doesn't support extent trees deeper than 5
(EXT4_MAX_EXTENT_DEPTH). For this reason we only maintain the extent
tree statistics for 5 levels. Avoid out-of-bounds writes and reads if
the extent tree is deeper than this.
We keep these statistics to determine whether we should rebuild the
extent tree. If the extent tree is too deep, we don't need the
statistics because we should always rebuild the it.
Reported-by: Nils Bars <nils.bars@rub.de>
Reported-by: Moritz Schlögel <moritz.schloegel@rub.de>
Reported-by: Nico Schiller <nico.schiller@rub.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 6 Jun 2022 17:34:08 +0000 (13:34 -0400)]
e2fsck: check for xattr value size integer wraparound
When checking an extended attrbiute block for correctness, we check if
the starting offset plus the value size exceeds the end of the block.
However, we weren't checking if the size was too large, and if it is
so large that it triggers a wraparound when we added the starting
offset, we won't notice the problem. Add the missing check.
Reported-by: Nils Bars <nils.bars@rub.de>
Reported-by: Moritz Schlögel <moritz.schloegel@rub.de>
Reported-by: Nico Schiller <nico.schiller@rub.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 6 Jun 2022 16:03:36 +0000 (12:03 -0400)]
libext2fs: add check for too-short directory blocks
If there is an inline data directory which is smaller than 8 bytes
(which should never happen but for corrupted or fuzzed file systems),
ext2fs_process_dir_block() will now abort EXT2_ET_DIR_CORRUPTED to
avoid an out-of-bounds read.
Reported-by: Nils Bars <nils.bars@rub.de>
Reported-by: Moritz Schlögel <moritz.schloegel@rub.de>
Reported-by: Nico Schiller <nico.schiller@rub.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 6 Jun 2022 15:39:23 +0000 (11:39 -0400)]
e2fsck: fix potential out-of-bounds read in inc_ea_inode_refs()
If there isn't enough space for a full extended attribute entry,
inc_ea_inode_refs() might end up reading beyond the allocated memory
buffer.
Reported-by: Nils Bars <nils.bars@rub.de>
Reported-by: Moritz Schlögel <moritz.schloegel@rub.de>
Reported-by: Nico Schiller <nico.schiller@rub.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 30 May 2022 23:17:30 +0000 (19:17 -0400)]
e2fsck: sanity check the journal inode number
E2fsck replays the journal before sanity checking the full superblock.
So it's possible that the journal inode number is not valid relative
to the number of block groups. So to avoid potentially an array
bounds overrun, sanity check this before trying to find the journal
inode.
Reported-by: Nils Bars <nils.bars@rub.de>
Reported-by: Moritz Schlögel <moritz.schloegel@rub.de>
Reported-by: Nico Schiller <nico.schiller@rub.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
zhanchengbin [Fri, 31 Dec 2021 07:42:17 +0000 (15:42 +0800)]
libsupport: avoid possible null dereference in quota_set_sb_inum()
If the quota type is invalid, quota_sb_inump will return NULL; this
should not cause the program to crash.
Link: https://lore.kernel.org/r/ee0b034c-71f3-63b7-a8de-d8e7760b9545@huawei.com
Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
zhanchengbin [Fri, 31 Dec 2021 07:43:36 +0000 (15:43 +0800)]
libext2fs: fix memory leak in error path while opening test_io manager
Link: https://lore.kernel.org/r/d0632bbc-9713-38a9-c914-137b702f6ae1@huawei.com
Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
zhanchengbin [Fri, 31 Dec 2021 07:43:10 +0000 (15:43 +0800)]
e2fsck: avoid theoretical null dereference in end_problem_latch()
This should only happen if there is a programming bug, but better safe
than sorry.
Link: https://lore.kernel.org/r/9a9c6658-a8b3-794a-85df-c3bdf0470111@huawei.com
Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
zhanchengbin [Fri, 31 Dec 2021 07:42:40 +0000 (15:42 +0800)]
dumpe2fs, resize2fs: avoid memory leak on error path
Link: https://lore.kernel.org/r/cbfd9852-bc89-1e83-f101-36fd29a0e70e@huawei.com
Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
zhanchengbin [Fri, 31 Dec 2021 07:41:41 +0000 (15:41 +0800)]
e2fsck: handle malloc() failure when computing the log file name
Link: https://lore.kernel.org/r/6d2844c7-0fd2-e432-3c7e-bb8de8c8a186@huawei.com
Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Mon, 13 Dec 2021 06:35:30 +0000 (23:35 -0700)]
e2fsck: no parent lookup in disconnected dir
Don't call into ext2fs_get_pathname() to do a name lookup for a
disconnected directory, since the directory block traversal in
pass1 has already scanned all of the leaf blocks and never finds
the entry, always printing "???". If the name entry had been
found earlier, the directory would not be disconnected in pass3.
Instead, lookup ".." and print the parent name in the prompt, and
then do not search for the current directory name at all. This
avoids a useless full directory scan for each disconnected entry,
which can potentially be slow if the parent directory is large.
Separate the recursively looped directory case to a new error code,
since it is a different problem that should use its own descriptive
text, and a proper pathname can be shown in this case.
Lustre-bug-Id: https://jira.whamcloud.com/browse/LU-15330
Change-Id: If17a92689f24f365ca1fbe5c837e7d5f383ebbe5
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Wed, 8 Dec 2021 07:51:12 +0000 (00:51 -0700)]
e2fsck: map PROMPT_* values to prompt messages
It isn't totally clear when searching the code for PROMPT_*
constants from problem codes where these messages come from.
Similarly, there isn't a direct mapping from the prompt string
to the constant.
Add comments that make this mapping more clear.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Wed, 1 Dec 2021 22:56:51 +0000 (15:56 -0700)]
misc: fix chattr usage message for project ID
Fix the "chattr -h" usage message to properly document that the
"-p" option takes a project argument, like "-v" takes a version.
Update the man page formatting to emphasize literal strings.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Lukas Czerner [Thu, 17 Feb 2022 09:25:00 +0000 (10:25 +0100)]
Use mallinfo2 instead of mallinfo if available
mallinfo has been deprecated with GNU C library version 2.33 in favor of
mallinfo2 which works exactly the same as mallinfo but with larger field
widths. Use mallinfo2 if available.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Lukas Czerner [Thu, 17 Feb 2022 09:24:59 +0000 (10:24 +0100)]
libss: fix possible NULL pointer dereferece on allocation failure
Currently in ss_execute_command() we're missng a check to see if the
memory allocation was succesful. Fix it by checking the return from
malloc and returning ENOMEM if it had failed.
[ Removed addition of the SS_ET_ENOMEM entry to the the libss error
table. -TYT ]
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Lukas Czerner [Thu, 17 Feb 2022 09:24:58 +0000 (10:24 +0100)]
resize2fs: remove unused variable 'c'
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Lukas Czerner [Thu, 21 Apr 2022 17:31:48 +0000 (19:31 +0200)]
libext2fs: add sanity check to extent manipulation
It is possible to have a corrupted extent tree in such a way that a leaf
node contains zero extents in it. Currently if that happens and we try
to traverse the tree we can end up accessing wrong data, or possibly
even uninitialized memory. Make sure we don't do that.
Additionally make sure that we have a sane number of bytes passed to
memmove() in ext2fs_extent_delete().
Note that e2fsck is currently unable to spot and fix such corruption in
pass1.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reported-by: Nils Bars <nils_bars@t-online.de>
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2068113
Addresses: CVE-2022-1304
Addresses-Debian-Bug: #1010263
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 4 Jan 2022 05:02:22 +0000 (00:02 -0500)]
setup-schroot: install the udev and systemd packages separately
On non-Linux Debian ports (e.g., GNU/Hurd and GNU/kFreeBSD) the udev
and systemd packages don't exist. So try to install them separately,
so they can fail on their own on those platforms.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 4 Jan 2022 03:45:37 +0000 (22:45 -0500)]
tests: support older versions of timeout in r_corrupt_fs
Older versions of the timeout program in coreutils don't support the
-v option. (This is apparently still in use in the GNU/FreeBSD Debain
port since coreutils hasn't built successfully since Coreutils version
8.28.)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Thu, 30 Dec 2021 15:43:49 +0000 (10:43 -0500)]
debian: suppress the no-debian-changes lintian warning
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Thu, 30 Dec 2021 05:52:29 +0000 (00:52 -0500)]
Update release notes, etc., for the 1.46.5 release
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Thu, 30 Dec 2021 02:33:27 +0000 (21:33 -0500)]
mke2fs.conf.5: fix spelling errors in man page
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 28 Dec 2021 20:17:31 +0000 (15:17 -0500)]
tst_getsize: use ext2fs_get_device_size2() to support testing large devices
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Wenbin Lv [Tue, 28 Dec 2021 20:16:43 +0000 (15:16 -0500)]
po: update zh_CN.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Yuri Chornoivan [Tue, 28 Dec 2021 20:16:43 +0000 (15:16 -0500)]
po: update uk.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Göran Uddeborg [Tue, 28 Dec 2021 20:16:43 +0000 (15:16 -0500)]
po: update sv.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Мирослав Николић [Tue, 28 Dec 2021 20:16:42 +0000 (15:16 -0500)]
po: update sr.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Sharuzzaman Ahmat Raslan [Tue, 28 Dec 2021 20:16:42 +0000 (15:16 -0500)]
po: update ms.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Antonio Ceballos [Tue, 28 Dec 2021 20:16:42 +0000 (15:16 -0500)]
po: update es.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 28 Dec 2021 17:33:15 +0000 (12:33 -0500)]
reisze2fs: sanity check free block group counts when calculating minimum size
If one or more block group descriptor's free blocks count is insane,
it's possible this can lead to a infinite loop in the function
calculate_minimum_resize_size(), which is called by resize2fs -P or
resize2fs -M.
Add some sanity checks to avoid this. In the case where the file
system is corrupt, this will result in resize2fs -P reporting an
incorrect value, but that's OK, since when we try to do an actual
resize operation, resize2fs requires that the file system be freshly
checked using e2fsck.
https://github.com/tytso/e2fsprogs/issues/94
Fixes:
ac94445fc01f ("resize2fs: make minimum size estimates more reliable for mounted fs")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 21 Dec 2021 19:55:32 +0000 (14:55 -0500)]
setup-schroot: add some additional packages needed to build debian packages
On older Debian systems, "apt-get build-dep e2fsprogs" might not bring
in all of the packages needed to build in the most recent versions of
e2fsprogs. So explicitly try to install some additional packages
including dh-exec, udev, systemd, and cron.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 21 Dec 2021 19:28:51 +0000 (14:28 -0500)]
libuuid: try to use getrandom() or getentropy() if available
If getrandom() or getentropy() is available, use these interfaces in
favor of opening /dev/[u]random. This avoids a potential TSAN problem
that could potentially cause a fd leak when trying to open
/dev/urandom. (Which is not a disaster, but these interfaces are more
foolproof and avoids needing to open a file descriptor in a library,
which is a good thing.)
Addresses-Google-Bug: #
198050608
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 11 Dec 2021 03:40:40 +0000 (22:40 -0500)]
e2fsck: update the bg_checksum after fixing problems in the bg descriptor
Otherwise, we break the block group descriptor's checksum, and while
this gets fixed by e2fsck, it results unnecessary messages printed or
questions asked of the system administrator.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Thu, 9 Dec 2021 15:55:54 +0000 (10:55 -0500)]
libext2fs: don't old the CACHE_MTX while doing I/O
A report a deadlock problem caused by I/O errors (caused by e2fsck's
error handler trying to write to a bad block to perform a forced
rewrite) uncovered that we were holding the CACHE_MTX while doing read
operations. This serialized read operations which destroyed the
performance benefits from doing parallel bitmap loading (or the
parallel e2fsck processing under development).
So restructure the code in unix_read_blk64() so that the read is
always done into the user-provided buffer, and then copied into the
cache afterwards.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Harshad Shirwadkar [Wed, 17 Nov 2021 16:50:15 +0000 (08:50 -0800)]
e2fsck: skip sorting extents if there are no valid extents
At the end of a fast commit replay, e2fsck tries merging extents in a
inode. This patch fixes a bug in this logic where we were continuing
this action even if there were no extents to merge resulting in
accessing illegal memory.
Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
ryancaicse [Mon, 1 Nov 2021 05:42:56 +0000 (13:42 +0800)]
libext2fs: fix missing unlocks in the error path in unix_set_blksize()
https://github.com/tytso/e2fsprogs/pull/83
Signed-off-by: Ryan Cai <ryancaicse@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Lukas Czerner [Thu, 2 Sep 2021 10:58:52 +0000 (12:58 +0200)]
tests: Add option to print diff output of failed tests
Add variable $PRINT_FAILED which when set will print the diff output of
a failed test.
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 14 Sep 2021 19:05:45 +0000 (15:05 -0400)]
resize2fs: optimize resize2fs_calculate_summary_stats()
Speed up an off-line resize of a 10GB file system to 64TB located on
tmpfs from 90 seconds to 16 seconds by extracting block group bitmaps
using a population count function to count the blocks in use instead
checking each bit in the block bitmap.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 14 Sep 2021 12:56:46 +0000 (08:56 -0400)]
resize2fs: adjust new size of the file system to allow a successful resize
The previous commit in this series (commit
50088b1996cc: "resize2fs:
attempt to keep the # of inodes valid by removing the last bg") allows
a successful off-line resize of a file system with the default 16k
inode ratio to be grown to support a 64TB storage device by dropping
the last block group so the number of inodes is just below the maximum
2**32-1 number of inodes.
However, this is not a complete solution, for two reasons. First,
this adjustment happens after resize2fs has started potentially making
changes to the file system in the off-line (unmounted) case, which
means resize2fs will do a lot of unnecessary work. Secondly, in the
on-line resize case, passing the original requested size to the kernel
causes the kernel fail the online resize request.
So teach resize2fs to adjust the new size of the file system much
earlier, which avoids both problems.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Leah Rumancik <leah.rumancik@gmail.com>
Theodore Ts'o [Tue, 14 Sep 2021 12:41:33 +0000 (08:41 -0400)]
resize2fs: attempt to keep the # of inodes valid by removing the last bg
If a the 10GB file system (with the default inode ratio size of 16k)
is resized to 64TB, the number of inodes will become 2**32 --- one
above the maximum allowed number of inodes of 2**32-1. In
adjust_fs_info(), we already try drop the last block group if there
isn't sufficient space in the last block group to support the metadata
for that block group. So if dropping the last block group allows the
number of inodes to valid, we should try that as well. In some cases
this will mean resizing a file system to 64TB will result in it be
resized to a size of 64TB - 128MB, which is close enough for
government work.
Addresses-Google-Bug:
199105099
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Leah Rumancik <leah.rumancik@gmail.com>
Lukas Czerner [Tue, 24 Aug 2021 12:10:20 +0000 (14:10 +0200)]
tests: update expect files for f_large_dir and f_large_dir_csum
Update expect files for f_large_dir and f_large_dir_csum tests to
include the warning about missing y2038 support with 128-byte inodes.
Fixes:
a23b50cd ("mke2fs: warn about missing y2038 support when formatting fresh ext4 fs")
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Lukas Czerner [Tue, 24 Aug 2021 12:10:19 +0000 (14:10 +0200)]
tests: update expect files for f_mmp_garbage
Update expect file for f_mmp_garbage test to work correctly with the
new default 256 inode size.
Fixes:
d730be5ceeba ("tests: update mke2fs.conf to create 256 byte inodes by default")
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Jan Kara [Mon, 23 Aug 2021 15:41:28 +0000 (17:41 +0200)]
quota: Drop dead code
Drop unused function from quota support code.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Jan Kara [Mon, 23 Aug 2021 15:41:27 +0000 (17:41 +0200)]
debugfs: Fix headers for quota commands
list_quota and get_quota commands have 'blocks' header while what they
actually show is a used space in bytes. Fix the header to state 'space'
instead.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Jan Kara [Mon, 23 Aug 2021 15:41:26 +0000 (17:41 +0200)]
tests: Expand test checking quota and orphan processing interaction
Expand f_orphquot test to also check handling of quotas for non-root
user and verify that quota limits are properly preserved over orphan
replay.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Jan Kara [Mon, 23 Aug 2021 15:41:25 +0000 (17:41 +0200)]
e2fsck: Do not trash user limits when processing orphan list
When e2fsck was loading quotas to process orphan list, it was loading
only quota usage. However subsequent quota writeout has effectively
overwritten quota limits, loosing them forever. Make sure quota limits
are preserved over orphan replay.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Jan Kara [Mon, 23 Aug 2021 15:41:24 +0000 (17:41 +0200)]
tune2fs: Fix conversion of quota files
When tune2fs is enabling quota feature, it looks for old-style quota
files and tries to transfer limits stored in these files into newly
created hidded quota files. However the code doing the transfer setups
the quota scan wrongly and instead of transferring limits we transfer
usage. So not only quota limits are lost (at least they can still be
recovered from the old quota files) but also usage information may be
wrong if the accounting in e2fsprogs does not exactly match the
accounting in quota-tools (which is actually the case). Fix the setup of
the quota scan.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Jan Kara [Mon, 23 Aug 2021 15:41:23 +0000 (17:41 +0200)]
quota: Rename quota_update_limits() to quota_read_all_dquots()
quota_update_limits() is a misnomer because what it actually does is
that it updates 'usage' counters and leaves 'limit' counters intact.
Rename quota_update_limits() to quota_read_all_dquots() and while
changing prototype also add a flags argument so that callers can control
which quota information is actually updated from the disk.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Jan Kara [Mon, 23 Aug 2021 15:41:22 +0000 (17:41 +0200)]
quota: Fold quota_read_all_dquots() into quota_update_limits()
There's just one caller of quota_read_all_dquots(), fold it into its
caller quota_update_limits(). No functional changes.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Jan Kara [Mon, 23 Aug 2021 15:41:21 +0000 (17:41 +0200)]
quota: Add support to version 0 quota format
Version 0 quota format differs from version 1 by having only 32-bit
counters for inodes and block limits. For many installations this is not
limiting and thus the format is widely used. Also quota tools still
create quota files with this format by default. Add support for this
quota format to e2fsprogs so that we can seamlessly convert quota files
in this format into our internal quota files.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 22 Aug 2021 14:07:15 +0000 (10:07 -0400)]
tests: update expect file for u_direct_io
The u_direct_io test is normally not run (since it requires root
privileges); as a result, when the mke2fs.conf defaults were changed,
I didn't notice that the expected output for u_direct_io test needed
to be updated.
Fixes:
d730be5ceeba ("tests: update mke2fs.conf to create 256 byte inodes by default"
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Jan Kara [Fri, 20 Aug 2021 16:15:02 +0000 (18:15 +0200)]
libss: add newer libreadline.so.8 to dlopen path
OpenSUSE Tumbleweed now has libreadline.so.8. Add it to the list of libs
to look for.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Thu, 19 Aug 2021 19:18:33 +0000 (15:18 -0400)]
debian/changelog: add missing section for 1.46.2-2
E2fsprogs 1.46.2-2 was uploaded during the release freeze, so the
changelog was assembled outside of the normal maint branch. Add it
now.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 17 Aug 2021 19:56:24 +0000 (15:56 -0400)]
fix unused-function -Wall warnings
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 17 Aug 2021 22:00:55 +0000 (18:00 -0400)]
debugfs: fix shadow and sign-compare -Wall warnings
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Thu, 19 Aug 2021 02:52:03 +0000 (22:52 -0400)]
Update release notes, etc., for the 1.46.4 release
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 17 Aug 2021 21:10:15 +0000 (17:10 -0400)]
libcom_err: fix suggest-attribute=format -Wall warnings
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 17 Aug 2021 21:08:56 +0000 (17:08 -0400)]
libss: fix fallthrough -Wall warnings
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 17 Aug 2021 22:01:39 +0000 (18:01 -0400)]
tests: fix shadow -Wall warnings in the crcsum test program
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 17 Aug 2021 19:45:49 +0000 (15:45 -0400)]
tests: fix "format not a string literal" -Wall warning in test_icount
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 17 Aug 2021 21:56:55 +0000 (17:56 -0400)]
libe2p: fix missing-prototypes and sign-compare -Wall warnings
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 17 Aug 2021 19:44:31 +0000 (15:44 -0400)]
debugfs: fix missing byte swap when dumping a revoke block
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 16 Aug 2021 12:18:59 +0000 (08:18 -0400)]
debian: switch to using build dependency on debhelper-compat
This is preferred in favor of using the debhelper/compat file, and we
no longer worry about supporting Debian Jessie or Debian Stretch
(at least without Stretch Backports).
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 14 Aug 2021 22:53:30 +0000 (18:53 -0400)]
Update release notes, etc., for the 1.46.4-rc1 release
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 16 Aug 2021 00:42:14 +0000 (20:42 -0400)]
debian: set Rules-Requires-Root to "no".
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 15 Aug 2021 23:35:12 +0000 (19:35 -0400)]
Fix miscellaneous spelling errors in man pages, and release notes
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 15 Aug 2021 23:13:02 +0000 (19:13 -0400)]
Change "filesystem" to "file system" in the man pages
To improve consistency, use "file system" in all of the man pages in
preference over "filesystem".
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 15 Aug 2021 15:17:42 +0000 (11:17 -0400)]
libsupport: fix sort_r.h to work on FreeBSD
FreeBSD defines __GNU_SOURCE so this is not reliable marker that the
OS is using a glibc-style qsort_r(3).
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 15 Aug 2021 14:42:03 +0000 (10:42 -0400)]
mke2fs: allow the default creator os to be specified in /etc/mke2fs.conf
This is useful for keeping the regression test results consistent
when run on non-Linux systems, especially on GNU Hurd.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 15 Aug 2021 03:42:23 +0000 (23:42 -0400)]
config: update config.{guess,sub}
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 14 Aug 2021 22:49:53 +0000 (18:49 -0400)]
resize2fs.8.in: clarify the description of the progress bar option
Addresses-Debian-Bug: #979411
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 14 Aug 2021 22:08:19 +0000 (18:08 -0400)]
e2scrub: use WantedBy=multi-user.target in e2scrub_reap.service
Addresses-Debian-Bug: #991349
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Göran Uddeborg [Sat, 14 Aug 2021 21:10:48 +0000 (17:10 -0400)]
po: update sv.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Pedro Albuquerque [Sat, 14 Aug 2021 21:10:48 +0000 (17:10 -0400)]
po: update pt.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Jakub Bogusz [Sat, 14 Aug 2021 21:10:48 +0000 (17:10 -0400)]
po: update pl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Benno Schulenberg [Sat, 14 Aug 2021 21:10:48 +0000 (17:10 -0400)]
po: update nl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Samuel Thibault [Sat, 14 Aug 2021 21:10:48 +0000 (17:10 -0400)]
po: update fr.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Petr Pisar [Sat, 14 Aug 2021 21:10:48 +0000 (17:10 -0400)]
po: update cs.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 14 Aug 2021 21:07:53 +0000 (17:07 -0400)]
tests: update mke2fs.conf to create 256 byte inodes by default
The regression tests have their own private copy of mke2fs which is
used when tests create file systems. Since we are now using 256 byte
inodes by default, the tests should reflect this.
While we're at it, modify the r_move_itable test so it actually tests
moving the inode table.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 14 Aug 2021 14:39:13 +0000 (10:39 -0400)]
mke2fs: warn that bigalloc is experimental only for large cluster sizes
Since we have done a lot of testing with a cluster size equal to 64k
(or 16 times the default 4k block size), mke2fs will only warn for
bigalloc file systems where the cluster size is greater than 16 times
the block size.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>