Whamcloud - gitweb
tools/e2fsprogs.git
2 years agoUpdate release notes, etc., for the 1.46.5 release v1.46.5
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>
2 years agomke2fs.conf.5: fix spelling errors in man page
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>
2 years agotst_getsize: use ext2fs_get_device_size2() to support testing large devices
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>
2 years agopo: update zh_CN.po (from translationproject.org)
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>
2 years agopo: update uk.po (from translationproject.org)
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>
2 years agopo: update sv.po (from translationproject.org)
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>
2 years agopo: update sr.po (from translationproject.org)
Мирослав Николић [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>
2 years agopo: update ms.po (from translationproject.org)
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>
2 years agopo: update es.po (from translationproject.org)
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>
2 years agoreisze2fs: sanity check free block group counts when calculating minimum size
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>
2 years agosetup-schroot: add some additional packages needed to build debian packages
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>
2 years agolibuuid: try to use getrandom() or getentropy() if available
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>
2 years agoe2fsck: update the bg_checksum after fixing problems in the bg descriptor
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>
2 years agolibext2fs: don't old the CACHE_MTX while doing I/O
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>
2 years agoe2fsck: skip sorting extents if there are no valid extents
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>
2 years agolibext2fs: fix missing unlocks in the error path in unix_set_blksize()
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>
2 years agotests: Add option to print diff output of failed tests
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>
2 years agoresize2fs: optimize resize2fs_calculate_summary_stats()
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>
2 years agoresize2fs: adjust new size of the file system to allow a successful resize
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>
2 years agoresize2fs: attempt to keep the # of inodes valid by removing the last bg
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>
2 years agotests: update expect files for f_large_dir and f_large_dir_csum
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>
2 years agotests: update expect files for f_mmp_garbage
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>
2 years agoquota: Drop dead code
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>
2 years agodebugfs: Fix headers for quota commands
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>
2 years agotests: Expand test checking quota and orphan processing interaction
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>
2 years agoe2fsck: Do not trash user limits when processing orphan list
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>
2 years agotune2fs: Fix conversion of quota files
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>
2 years agoquota: Rename quota_update_limits() to quota_read_all_dquots()
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>
2 years agoquota: Fold quota_read_all_dquots() into quota_update_limits()
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>
2 years agoquota: Add support to version 0 quota format
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>
2 years agotests: update expect file for u_direct_io
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>
2 years agolibss: add newer libreadline.so.8 to dlopen path
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>
2 years agodebian/changelog: add missing section for 1.46.2-2
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>
2 years agofix unused-function -Wall warnings
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>
2 years agodebugfs: fix shadow and sign-compare -Wall warnings
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>
2 years agoUpdate release notes, etc., for the 1.46.4 release v1.46.4
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>
2 years agolibcom_err: fix suggest-attribute=format -Wall warnings
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>
2 years agolibss: fix fallthrough -Wall warnings
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>
2 years agotests: fix shadow -Wall warnings in the crcsum test program
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>
2 years agotests: fix "format not a string literal" -Wall warning in test_icount
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>
2 years agolibe2p: fix missing-prototypes and sign-compare -Wall warnings
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>
2 years agodebugfs: fix missing byte swap when dumping a revoke block
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>
2 years agodebian: switch to using build dependency on debhelper-compat
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>
2 years agoUpdate release notes, etc., for the 1.46.4-rc1 release
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>
2 years agodebian: set Rules-Requires-Root to "no".
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>
2 years agoFix miscellaneous spelling errors in man pages, and release notes
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>
2 years agoChange "filesystem" to "file system" in the man pages
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>
2 years agolibsupport: fix sort_r.h to work on FreeBSD
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>
2 years agomke2fs: allow the default creator os to be specified in /etc/mke2fs.conf
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>
2 years agoconfig: update config.{guess,sub}
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>
2 years agoresize2fs.8.in: clarify the description of the progress bar option
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>
2 years agoe2scrub: use WantedBy=multi-user.target in e2scrub_reap.service
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>
2 years agopo: update sv.po (from translationproject.org)
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>
2 years agopo: update pt.po (from translationproject.org)
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>
2 years agopo: update pl.po (from translationproject.org)
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>
2 years agopo: update nl.po (from translationproject.org)
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>
2 years agopo: update fr.po (from translationproject.org)
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>
2 years agopo: update cs.po (from translationproject.org)
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>
2 years agotests: update mke2fs.conf to create 256 byte inodes by default
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>
2 years agomke2fs: warn that bigalloc is experimental only for large cluster sizes
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>
2 years agomke2fs: warn about missing y2038 support when formatting fresh ext4 fs
Darrick J. Wong [Thu, 12 Aug 2021 23:22:22 +0000 (16:22 -0700)]
mke2fs: warn about missing y2038 support when formatting fresh ext4 fs

Filesystems with 128-byte inodes do not support timestamps beyond the
year 2038.  Since we're now less than 16.5 years away from that point,
it's time to start warning users about this lack of support when they
format an ext4 filesystem with small inodes.

(Note that even for ext2 and ext3, we changed the default for
non-small file systems in 2008 in commit commit b1631cce648e ("Create
new filesystems with 256-byte inodes by default").)

So change the mke2fs.conf file to specify 256-byte inodes even for
small filesystems, and then add a warning to mke2fs itself if someone
is trying to make us format a file system with 128-byte inodes.  This
can be suppressed by setting the boolean option warn_y2038_dates in
the mke2fs.conf file to false, which we do in the case of GNU Hurd,
since it only supports 128 byte inodes as of this writing.

[ Patch reworked by tytso to only warn in the case of GNU Hurd, since
  the default for ext2/ext3 was changed for all but small file systems
  in 2008. ]

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agoe2fsck: make sure quota files are not referenced from dirs
Jan Kara [Thu, 12 Aug 2021 13:32:16 +0000 (15:32 +0200)]
e2fsck: make sure quota files are not referenced from dirs

Quota files must not be referenced from directory entries. Otherwise
they can get corrupted under the hands of the kernel.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agotests: check quota file space usage does not get accounted
Jan Kara [Wed, 4 Aug 2021 12:16:52 +0000 (14:16 +0200)]
tests: check quota file space usage does not get accounted

Check that space used by quota files themselves does not get accounted
into the space tracked by quota subsystem.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agotst_bitops: don't stop testing on low memory
Heinrich Schuchardt [Wed, 11 Aug 2021 15:46:10 +0000 (17:46 +0200)]
tst_bitops: don't stop testing on low memory

Some build systems have 512 MiB memory or less, e.g. Ubiquity Edgeroute
Lite which can be used to build for the mips and mips64 architectures.

On these allocating 512 MIB will always fail. So if allocating 512 MiB
fails treat this as expected behavior and return 0.

This will allow testing to continue with the remaining tests.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agoe2fsck: add maximum string length specifiers to fscanf format strings
Theodore Ts'o [Tue, 10 Aug 2021 19:36:46 +0000 (15:36 -0400)]
e2fsck: add maximum string length specifiers to fscanf format strings

When parsing strings from /proc/apm and /proc/acpi/ac_adapter, add
string length limits to prevent possible buffer overruns.

Addresses-Coverty-Bug: 1297496
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agolibext2fs: fix coverity nits in tdb.c
Theodore Ts'o [Tue, 10 Aug 2021 18:52:15 +0000 (14:52 -0400)]
libext2fs: fix coverity nits in tdb.c

Address unchecked returned value and a string not null terminated warnings.

Addresses-Coverity-Bug: 709473
Addresses-Coverity-Bug: 709474
Addresses-Coverity-Bug: 1464578
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agoe2fsck: clean up two gcc -Wall warnings in recovery.c
Theodore Ts'o [Tue, 10 Aug 2021 18:02:33 +0000 (14:02 -0400)]
e2fsck: clean up two gcc -Wall warnings in recovery.c

Fix a signed vs unsigned and a void * pointer arithmetic warning.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agolibsupport: fix potental NULL pointer dereferences in quota functions
Lukas Czerner [Fri, 6 Aug 2021 09:58:20 +0000 (11:58 +0200)]
libsupport: fix potental NULL pointer dereferences in quota functions

get_dq() function can fail when the memory allocation fails and so we
could end up dereferencing NULL pointer. Fix it.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agolibss: Add missing error handling for fdopen()
Lukas Czerner [Fri, 6 Aug 2021 09:58:19 +0000 (11:58 +0200)]
libss: Add missing error handling for fdopen()

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agolibss: handle memory allcation failure in ss_help()
Lukas Czerner [Fri, 6 Aug 2021 09:58:18 +0000 (11:58 +0200)]
libss: handle memory allcation failure in ss_help()

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agolibext2fs: remove augmented rbtree functionality
Lukas Czerner [Fri, 6 Aug 2021 09:58:17 +0000 (11:58 +0200)]
libext2fs: remove augmented rbtree functionality

Rbtree code was originally taken from linux kernel. This includes the
augmented rbtree functionality, however this was never intended to be
used and is not used still. Just remove it.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agolibext2fs: fix unexpected NULL variable
Lukas Czerner [Fri, 6 Aug 2021 09:58:16 +0000 (11:58 +0200)]
libext2fs: fix unexpected NULL variable

The ext2fs_check_mount_point() function can be called with mtpt being
NULL as for example from ext2fs_check_if_mounted(). However in the
is_swap_device condition we use the mtpt in strncpy without checking
whether it is non-null first.

This should not be a problem on linux since the previous attempt to open
the device exclusively would have prevented us from ever reaching the
problematic strncpy. However it's still a bug and can cause problems on
other systems, fix it by conditioning strncpy on mtpt not being null.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agoext2fs: initialize retval before using it
Lukas Czerner [Fri, 6 Aug 2021 09:58:15 +0000 (11:58 +0200)]
ext2fs: initialize retval before using it

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agoe2fsck: value stored to err is never read
Lukas Czerner [Fri, 6 Aug 2021 09:58:14 +0000 (11:58 +0200)]
e2fsck: value stored to err is never read

Remove it to silence clang warning.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agoe2fsck: drop gfp_t argument from blkdev_issue_flush()
Theodore Ts'o [Tue, 10 Aug 2021 14:29:21 +0000 (10:29 -0400)]
e2fsck: drop gfp_t argument from blkdev_issue_flush()

This synchronizes e2fsprogs with kernel commit c6bf3f0e25f4 ("block:
use an on-stack bio in blkdev_issue_flush").

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agotests: skip u_direct_io if losetup fails
Darrick J. Wong [Thu, 5 Aug 2021 15:43:28 +0000 (08:43 -0700)]
tests: skip u_direct_io if losetup fails

This new test requires a loop device to run testing.  While it checks
for some "obvious" parameters that might cause the test to fail such as
not being root and no losetup executable, it doesn't actually check that
the losetup -a call succeeds.  This causes a test regression in my
package building container (where there is only a minimal /dev with no
loop devices available) so I can't build debian packages.

Fix the test to skip out if we can't create a loop device.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agomke2fs: fix a file descriptor leak when creating a file system image file
Theodore Ts'o [Wed, 4 Aug 2021 03:54:06 +0000 (23:54 -0400)]
mke2fs: fix a file descriptor leak when creating a file system image file

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agoe2image: Dump quota files
Jan Kara [Mon, 12 Jul 2021 15:43:09 +0000 (17:43 +0200)]
e2image: Dump quota files

Dump quota files to resulting filesystem image. They are fs metadata.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agoquota: Do not account space used by project quota file to quota
Jan Kara [Mon, 12 Jul 2021 15:43:08 +0000 (17:43 +0200)]
quota: Do not account space used by project quota file to quota

Project quota files have high inode numbers but are not accounted in
quota usage. Do not track them when computing quota usage.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agoss_create_invocation: fix potential unititalized reference in error path
Theodore Ts'o [Tue, 3 Aug 2021 15:03:34 +0000 (11:03 -0400)]
ss_create_invocation: fix potential unititalized reference in error path

Fixes: eccdde1ff381 ("ss_create_invocation: fix error handling when ...")
Addresses-Coverity-Bug: 1489771
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agolsattr: check whether path is NULL in lsattr_dir_proc()
Zhiqiang Liu [Wed, 28 Jul 2021 01:56:48 +0000 (09:56 +0800)]
lsattr: check whether path is NULL in lsattr_dir_proc()

In lsattr_dir_proc(), if malloc() return NULL, it will cause
a segmentation fault problem.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agohashmap: change return value type of ext2fs_hashmap_add()
Zhiqiang Liu [Wed, 28 Jul 2021 01:56:47 +0000 (09:56 +0800)]
hashmap: change return value type of ext2fs_hashmap_add()

In ext2fs_hashmap_add(), new entry is allocated by calling
malloc(). If malloc() return NULL, it will cause a
segmentation fault problem.

Here, we change return value type of ext2fs_hashmap_add()
from void to int. If allocating new entry fails, we will
return -1, and the callers should also verify the return
value of ext2fs_hashmap_add().

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agoss_create_invocation: fix error handling when memory allocation fails
Wu Guanghao [Wed, 28 Jul 2021 01:56:46 +0000 (09:56 +0800)]
ss_create_invocation: fix error handling when memory allocation fails

In ss_create_invocation(), it is necessary to check whether
returned by malloc is a null pointer.

Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agoss_add_info_dir: fix error handling when memory allocation fails
Wu Guanghao [Wed, 28 Jul 2021 01:56:45 +0000 (09:56 +0800)]
ss_add_info_dir: fix error handling when memory allocation fails

If the realloc() and malloc() calls fail, avoid a memory leak as well
as a potential seg fault.

[ Fix error code setting to avoid depending on malloc() and realloc()
  setting errno. -- TYT ]

Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Reviewed-by: Wu Bo <wubo40@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agomke2fs: fix creating a file system image w/o a pre-existing file
Theodore Ts'o [Tue, 3 Aug 2021 01:08:01 +0000 (21:08 -0400)]
mke2fs: fix creating a file system image w/o a pre-existing file

The mke2fs program should allow creating a file system image when an
explicit file system size is specified, even if the file doesn't yet
exist.  By deferring the call to check_plausible() in commit
942b00cb9d2f ("mke2fs: do not warn about a pre-existing partition
table when using a non-zero offset") this behaviour was broken.

Fix this regression by explicitly creating the file if the file system
size is specified.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agolibext2fs: improve error handling in POSIX ACL conversions
Samuel Holland [Sat, 29 May 2021 03:14:04 +0000 (22:14 -0500)]
libext2fs: improve error handling in POSIX ACL conversions

When encoding a POSIX ACL to the EXT4 ACL format, if an unknown tag
is encountered, that entry is silently ignored. It would be better
to return an error to inform the user that the ACL is incompatible.

Also fix the mismatched indentation in the opposite function.

Signed-off-by: Samuel Holland <samuel@sholland.org>
2 years agosetup-schroot: install the acl and libreadline-dev packages
Theodore Ts'o [Fri, 30 Jul 2021 17:11:40 +0000 (13:11 -0400)]
setup-schroot: install the acl and libreadline-dev packages

The acl package is needed to run the m_rootdir_acl test.  The
libreadline-dev package will drag in the shared library package for
libreadline (libreadlineN) so that the developer running debugfs will
be able to use line editing.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agotests: skip m_rootdir_acl on GNU Hurd
Theodore Ts'o [Fri, 30 Jul 2021 17:10:28 +0000 (13:10 -0400)]
tests: skip m_rootdir_acl on GNU Hurd

The GNU Hurd doesn't support Posix ACL's, so even if the acl package
is installed, the setfattr command will fail.  So just skip the test
on Hurd.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agolibext2fs: fix translation of Posix ACL's on big-endian systems
Theodore Ts'o [Fri, 30 Jul 2021 16:29:44 +0000 (12:29 -0400)]
libext2fs: fix translation of Posix ACL's on big-endian systems

The ACL returned by the kernel in lgetxattr(2) is returned in Little
Endian, even on Big Endian systems.  Fix the functions
convert_posix_acl_to_disk_buffer() and convert_disk_buffer_to_posix_acl()
to work correctly on Big Endian systems.  This fixes a failure of
the test m_rootdir_acl.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agocontrib: add setup-schroot command for use on Debian porter boxes
Theodore Ts'o [Fri, 30 Jul 2021 00:57:42 +0000 (20:57 -0400)]
contrib: add setup-schroot command for use on Debian porter boxes

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agotests: add description for j_recover_fast_commit
Theodore Ts'o [Thu, 29 Jul 2021 21:42:23 +0000 (17:42 -0400)]
tests: add description for j_recover_fast_commit

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agotests: force test file systems to be built for the Linux OS
Theodore Ts'o [Thu, 29 Jul 2021 14:31:53 +0000 (10:31 -0400)]
tests: force test file systems to be built for the Linux OS

This is needed to fix a large number of test failures on GNU Hurd.

Also skip a number of tests that require creating very large test file
systems,since Hurd does not support files greater than 4GB.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agotests: try using truncate command before falling back to using dd
Theodore Ts'o [Thu, 29 Jul 2021 03:56:08 +0000 (23:56 -0400)]
tests: try using truncate command before falling back to using dd

On the GNU Hurd, dd seems to be buggy and hangs if seeking beyond 4G.
Fortunately the GNU Hurd does have the truncate command, which does
work correctly.  So try using the truncate command first, and fall
back to using dd only if the truncate command doesn't work.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agolibsupport: fix sort_r.h to work on the GNU Hurd
Theodore Ts'o [Thu, 29 Jul 2021 03:46:36 +0000 (23:46 -0400)]
libsupport: fix sort_r.h to work on the GNU Hurd

On the GNU Hurd both __MACH__ and __GNU__ are defined.  So rearrange
the #ifdef to prioritize checking for GLIBC compatibility over BSD
compatibility.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agoe2fsck: fix f_baddotdir failure on big-endian systems
Theodore Ts'o [Wed, 28 Jul 2021 17:51:13 +0000 (13:51 -0400)]
e2fsck: fix f_baddotdir failure on big-endian systems

Commit 63f44aafb1f2 ("e2fsck: fix ".." more gracefully if possible")
changed the check_dot() function to try to avoid resetting the '..'
entry when the '.' entry is too large..  But if we do that, then on
big-endian systems, we need to try byte swapping the rest of the
directory entries, or else the f_baddotdir test will fail on
big-endian systems.

Also add a check to avoid UBSAN warning when there is not enough space
at the end of the directory block for a directory entry, and so we can
potentially overflow some pointer arithmetic when trying to byte swap
the remainder of the (negative) space in the directory block.

Fixes: 63f44aafb1f2 ("e2fsck: fix ".." more gracefully if possible")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agoUpdate release notes, etc., for the 1.46.3 release v1.46.3
Theodore Ts'o [Tue, 27 Jul 2021 16:46:39 +0000 (12:46 -0400)]
Update release notes, etc., for the 1.46.3 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2 years agoAOSP: Move system_shared_libs into target.bionic clause
Colin Cross [Tue, 13 Jul 2021 23:29:01 +0000 (16:29 -0700)]
AOSP: Move system_shared_libs into target.bionic clause

Use target.bionic.system_shared_libs when it is used to limit the
default shared libraries (as opposed to remove them completely).
This avoids attempting to add a host dependency on libc when
system_shared_libs is modified to apply to all variants.

Also remove system_shared_libs from static binaries where it has
no effect, and consolidate it into e2fsprogs-defaults.

Bug: 193559105
Test: m checkbuild
Change-Id: I2d447b006afc783f4acd6c1acd93f338a68a01ed
From AOSP commit: 48fa7248112701c30d3cabfb8d3360b2408d6491

2 years agoAOSP: Use -Wno-pointer-arith in Android build
Eric Biggers [Wed, 16 Jun 2021 04:48:08 +0000 (21:48 -0700)]
AOSP: Use -Wno-pointer-arith in Android build

Some "arithmetic on a void pointer is a GNU extension" warnings were
introduced into upstream e2fsprogs, but they are of questionable value,
so disable them for now.

Change-Id: I19e99382e9434828927c1b8287b91f3333110151
From AOSP commit: f203c38fd43dc384cedfcaeb155771a15906022f

2 years agoAOSP: Add a new upstream source file to lib/e2p/Android.bp
Eric Biggers [Tue, 15 Jun 2021 23:32:30 +0000 (16:32 -0700)]
AOSP: Add a new upstream source file to lib/e2p/Android.bp

Change-Id: Ibc305759a9046996a397d652d799e930629f9f71
From AOSP commit: a02aa2b8e145449711e0dcdae5573fbaa888bf33

2 years agoAOSP: [LSC] Add LOCAL_LICENSE_KINDS to external/e2fsprogs
Bob Badour [Sat, 13 Feb 2021 02:59:49 +0000 (18:59 -0800)]
AOSP: [LSC] Add LOCAL_LICENSE_KINDS to external/e2fsprogs

Added SPDX-license-identifier-0BSD SPDX-license-identifier-Apache-2.0
    SPDX-license-identifier-BSD SPDX-license-identifier-GPL
    SPDX-license-identifier-GPL-2.0 SPDX-license-identifier-LGPL
    SPDX-license-identifier-LGPL-2.0 SPDX-license-identifier-LGPL-2.1
    SPDX-license-identifier-LGPL-3.0 SPDX-license-identifier-MIT
    legacy_notice legacy_unencumbered
to:
  Android.bp

Added SPDX-license-identifier-0BSD SPDX-license-identifier-BSD
    SPDX-license-identifier-GPL SPDX-license-identifier-GPL-2.0
    SPDX-license-identifier-LGPL SPDX-license-identifier-LGPL-2.1
    SPDX-license-identifier-LGPL-3.0 SPDX-license-identifier-MIT
    legacy_unencumbered
to:
  lib/Android.bp

Added SPDX-license-identifier-0BSD SPDX-license-identifier-BSD
    SPDX-license-identifier-GPL-2.0 SPDX-license-identifier-MIT
to:
  lib/et/Android.bp

Added SPDX-license-identifier-0BSD SPDX-license-identifier-MIT
to:
  lib/ss/Android.bp

Added SPDX-license-identifier-Apache-2.0
to:
  contrib/android/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-GPL
to:
  contrib/Android.bp

Added SPDX-license-identifier-BSD
to:
  lib/uuid/Android.bp

Added SPDX-license-identifier-GPL
to:
  resize/Android.bp

Added SPDX-license-identifier-GPL SPDX-license-identifier-GPL-2.0
to:
  debugfs/Android.bp

Added SPDX-license-identifier-GPL SPDX-license-identifier-GPL-2.0
    SPDX-license-identifier-LGPL
to:
  e2fsck/Android.bp

Added SPDX-license-identifier-GPL SPDX-license-identifier-GPL-2.0
    SPDX-license-identifier-LGPL SPDX-license-identifier-LGPL-2.1
    SPDX-license-identifier-LGPL-3.0 legacy_unencumbered
to:
  lib/ext2fs/Android.bp

Added SPDX-license-identifier-GPL SPDX-license-identifier-LGPL
to:
  lib/e2p/Android.bp

Added SPDX-license-identifier-GPL SPDX-license-identifier-LGPL
    SPDX-license-identifier-LGPL-2.1 SPDX-license-identifier-LGPL-3.0
to:
  lib/blkid/Android.bp
  misc/Android.bp

Added SPDX-license-identifier-GPL SPDX-license-identifier-MIT
to:
  lib/support/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I239a04a83f12ba051be911d18f6df4ae77fb3368
From AOSP commit: e86522c572b5715b85889cf8ca1c52a5cc350ca7