Whamcloud - gitweb
tools/e2fsprogs.git
5 months agoblkid: include time.h to provide explicit declaration for time() maint master next
Theodore Ts'o [Sun, 11 Apr 2021 23:52:57 +0000 (19:52 -0400)]
blkid: include time.h to provide explicit declaration for time()

This was originally reported to the MacPorts of e2fsprogs at:

https://github.com/macports/macports-ports/pull/9137

Reported-by: Ryan Schmidt <ryandesign@macports.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 months agofilefrag: minor usability improvements
Andreas Dilger [Wed, 10 Mar 2021 22:47:15 +0000 (15:47 -0700)]
filefrag: minor usability improvements

Add '-V' to filefrag to print the installed version of the tool.

If '-V' is used twice, print out the list of supported FIEMAP flags.
This can be used to check if filefrag understands a specific feature.

Include FIEMAP in the error message printed when filefrag cannot
get the file layout. Since FIEMAP is commonly available and tried
first, it should also be mentioned in the error message unless it
was requested to only run FIBMAP.

Update filefrag.1.in man page to cover the new -V option.

Fix a formatting error with the recently added '-P' options, and
include '-E' and '-P' in the SYNOPSIS section.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Lustre-bug-id: https://jira.whamcloud.com/browse/LU-11848
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Change-Id: Ib126bdd70efa1775aef6db761f54e27a593ebbe5
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 months agoe2image: add OPTIONS section to man page
Andreas Dilger [Tue, 9 Mar 2021 08:35:08 +0000 (01:35 -0700)]
e2image: add OPTIONS section to man page

Reorganize the e2image.8 man page so that the command-line options
are listed in a dedicated OPTIONS section, rather than being
interspersed among the text in the DESCRIPTION section.  Otherwise,
it is difficult to determine which options are available, and to
find where each option is described.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 months agomisc: remove useless code in set_inode_xattr()
Zhiqiang Liu [Fri, 26 Feb 2021 01:22:58 +0000 (09:22 +0800)]
misc: remove useless code in set_inode_xattr()

In set_inode_xattr(), there are two returns as follows,
-
  return retval;
  return 0;
-
Here, we remove useless 'return 0;' code.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 months agoext2fs: compile the io implementation according to os
Paulo Antonio Alvarez [Tue, 22 Dec 2020 18:15:52 +0000 (15:15 -0300)]
ext2fs: compile the io implementation according to os

In mingw and cygwin, compile the windows_io manager, compile the unix_io
everywhere else.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 months agolibext2fs: code adaptation to use the Windows IO manager
Paulo Antonio Alvarez [Tue, 22 Dec 2020 18:15:51 +0000 (15:15 -0300)]
libext2fs: code adaptation to use the Windows IO manager

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 months agolibext2fs: add a Windows implementation of the IO manager
Paulo Antonio Alvarez [Tue, 22 Dec 2020 18:15:50 +0000 (15:15 -0300)]
libext2fs: add a Windows implementation of the IO manager

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agoresize2fs: close the file system on errors or early exits
Theodore Ts'o [Sun, 7 Mar 2021 04:54:33 +0000 (23:54 -0500)]
resize2fs: close the file system on errors or early exits

When resize2fs exits early, perhaps because of an error, we should
free the file system so that if MMP is in use, the MMP block is reset.
This also releases the memory to avoid memory leak reports.

Addresses-Debian-Bug: #984472
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agoresize2fs: avoid allocating over the MMP block
Theodore Ts'o [Sun, 7 Mar 2021 04:08:12 +0000 (23:08 -0500)]
resize2fs: avoid allocating over the MMP block

When resizing past the point where the reserve inode has reserved
space for the block group descriptors to expand, and resize2fs (in an
offline resize) needs to move the allocation bitmaps and/or inode
table around, it's possible for resize2fs to allocate over the MMP
block, which would be bad.

Prevent this from happening by reserving the MMP block as a file
system metadata block (which it is) in resize2fs's accounting.

Addresses-Debian-Bug: #984472
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agoUpdate release notes, etc., for the 1.46.2 release v1.46.2
Theodore Ts'o [Sun, 28 Feb 2021 14:57:25 +0000 (09:57 -0500)]
Update release notes, etc., for the 1.46.2 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agolibext2fs: fix potential races in unix_io
Theodore Ts'o [Sun, 28 Feb 2021 23:52:20 +0000 (18:52 -0500)]
libext2fs: fix potential races in unix_io

When unix_io does not use pread/pread64 (which is the case the bounce
buffer is in use, either when Direct I/O is in use or the
IO_FLAG_FORCE_BOUNCE in enabled), there are races between the llseek
and and read or write system calls.  Fix this by using the BOUNCE_MTX
so only one thread is using the file descriptor at a time.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agolibext2s: fix unix_io with IO_FLAG_FORCE_BOUNCE flag set
Theodore Ts'o [Sun, 28 Feb 2021 14:12:47 +0000 (09:12 -0500)]
libext2s: fix unix_io with IO_FLAG_FORCE_BOUNCE flag set

The bounce read/write code would crash with a floating point exception
if alignment is set to 0.

Fixes: c001596110e8 ("libext2fs: fix unix_io's Direct I/O support")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agopo: update es.po (from translationproject.org)
Antonio Ceballos [Sat, 27 Feb 2021 15:24:06 +0000 (10:24 -0500)]
po: update es.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agolibext2fs: fix unix_io's Direct I/O support
Theodore Ts'o [Fri, 26 Feb 2021 22:41:06 +0000 (17:41 -0500)]
libext2fs: fix unix_io's Direct I/O support

The previous Direct I/O support worked on HDD's with 512 byte logical
sector sizes, and on FreeBSD which required 4k aligned memory buffers.
However, it was incomplete and was not correctly working on HDD's with
4k logical sector sizes (aka Advanced Format Disks).

Based on a patch from Alexey Lyashkov <alexey.lyashkov@hpe.com> but
rewritten to work with the latest e2fsprogs and to minimize changes to
make it easier to review.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reported-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
6 months agoiscan: fix the test program iscan so it builds again
Theodore Ts'o [Fri, 26 Feb 2021 22:18:48 +0000 (17:18 -0500)]
iscan: fix the test program iscan so it builds again

The iscan program program isn't built by default, and was relying on
e2fsck's util.c, so it had suffered bitrot as e2fsck/util.c had
evolved.  Fix it so that iscan builds correct.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agommp: do not use O_DIRECT when working with regular file
Lukas Czerner [Thu, 18 Feb 2021 09:51:46 +0000 (10:51 +0100)]
mmp: do not use O_DIRECT when working with regular file

Currently the mmp block is read using O_DIRECT to avoid any caching that
may be done by the VM. However when working with regular files this
creates alignment issues when the device of the host file system has
sector size larger than the blocksize of the file system in the file
we're working with.

This can be reproduced with t_mmp_fail test when run on the device with
4k sector size because the mke2fs fails when trying to read the mmp
block.

Fix it by disabling O_DIRECT when working with regular files. I don't
think there is any risk of doing so since the file system layer, unlike
shared block device, should guarantee cache consistency.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agoresize2fs: prevent block bitmap warnings when doing extreme fs expansions
Theodore Ts'o [Fri, 26 Feb 2021 02:40:27 +0000 (21:40 -0500)]
resize2fs: prevent block bitmap warnings when doing extreme fs expansions

This commit fixes a bug where if a small file system is resized to
ridiculous sizes, such that the size of the resized block group
descriptor blocks exceed the original file system, and this would
result in resize2fs triggering a large number of scary warning
messages:

   Illegal block number passed to ext2fs_test_block_bitmap #12440
   for block bitmap for broken.img

This can be replicated via:

   ./misc/mke2fs broken.img -b 1024 -T default
   truncate -s +1500G broken.img
   ./resize/resize2fs broken.img

Fortunately, aside from triggering these warning messages, the bug had
no other bad effects.

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

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agodebugfs: fix rdump and ls to handle uids and gids > 65536 correctly
Theodore Ts'o [Thu, 25 Feb 2021 22:26:07 +0000 (17:26 -0500)]
debugfs: fix rdump and ls to handle uids and gids > 65536 correctly

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

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agoRemove superfluous break statements
Theodore Ts'o [Thu, 25 Feb 2021 17:39:01 +0000 (12:39 -0500)]
Remove superfluous break statements

https://github.com/tytso/e2fsprogs/pull/45
https://github.com/tytso/e2fsprogs/pull/46

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agochattr/lsattr: expose FS_NOCOMP_FL (aka EXT2_NOCOMPR_FL)
Lennart Poettering [Thu, 25 Feb 2021 17:33:35 +0000 (12:33 -0500)]
chattr/lsattr: expose FS_NOCOMP_FL (aka EXT2_NOCOMPR_FL)

This adds support for setting/querying the FS_NOCOMP_FL/EXT2_NOCOMPR_FL
file flag to chattr/lsattr. I picked the character "m" because it was
so far unused and all other characters that were more obvious candidates
were already taken.

The flag is available on btrfs, and with this patch it is possible to
manage it correctly.

Signed-off-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agodebugfs: fix memory leak problem in read_list()
Zhiqiang Liu [Sat, 20 Feb 2021 08:41:29 +0000 (16:41 +0800)]
debugfs: fix memory leak problem in read_list()

In read_list func, if strtoull() fails in while loop,
we will return the error code directly. Then, memory of
variable lst will be leaked without setting to *list.

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: linfeilong <linfeilong@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agolibe2p: remove nested #ifdefs in fgetflags.c and fsetflags.c
Theodore Ts'o [Wed, 24 Feb 2021 05:08:07 +0000 (00:08 -0500)]
libe2p: remove nested #ifdefs in fgetflags.c and fsetflags.c

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agodebugfs: fix file descriptor leak on error path in do_logdump()
Theodore Ts'o [Wed, 24 Feb 2021 04:57:10 +0000 (23:57 -0500)]
debugfs: fix file descriptor leak on error path in do_logdump()

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agomisc/Makefile.in: add rules to build static versions of lsattr and chattr
Theodore Ts'o [Wed, 24 Feb 2021 03:03:59 +0000 (22:03 -0500)]
misc/Makefile.in: add rules to build static versions of lsattr and chattr

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agolibe2p: skip unneeded lstat(2) in fgetflags() and fsetflags()
Theodore Ts'o [Wed, 24 Feb 2021 02:25:46 +0000 (21:25 -0500)]
libe2p: skip unneeded lstat(2) in fgetflags() and fsetflags()

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agodebugfs: fix uninitialized variable es in do_logdump()
Theodore Ts'o [Wed, 24 Feb 2021 01:58:31 +0000 (20:58 -0500)]
debugfs: fix uninitialized variable es in do_logdump()

Fixes: d96064e9821a ("debugfs: simplify the do_logdump() function")

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agodebugfs: simplify the do_logdump() function
Theodore Ts'o [Tue, 23 Feb 2021 21:19:00 +0000 (16:19 -0500)]
debugfs: simplify the do_logdump() function

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agoAdd checks for fs->blocksize == 0 which could cause some crashes
Theodore Ts'o [Tue, 23 Feb 2021 21:02:42 +0000 (16:02 -0500)]
Add checks for fs->blocksize == 0 which could cause some crashes

This should never happeb, but some checks is useful, and also fixes
some Coverity warnings.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agoe2fsck: fix miscellaneous clang warnings
Theodore Ts'o [Tue, 23 Feb 2021 18:03:37 +0000 (13:03 -0500)]
e2fsck: fix miscellaneous clang warnings

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agoe2fsck: initialize variable before first use in fast commit replay
Harshad Shirwadkar [Tue, 23 Feb 2021 17:41:56 +0000 (09:41 -0800)]
e2fsck: initialize variable before first use in fast commit replay

Initialize ext2fs_ex variable in ext4_fc_replay_scan() before first
use.  Also make sure ext2fs_decode_extent() completely overwrites the
extent structure passed to it as argument to prevent potential future
bugs for the users of the function.

Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agoe2fsck: add fallthrough comment in fc replay switch case
Harshad Shirwadkar [Tue, 23 Feb 2021 17:41:55 +0000 (09:41 -0800)]
e2fsck: add fallthrough comment in fc replay switch case

During fast commit replay scan phase, in ext4_fc_replay_scan(), we
want to fallthrough in switch case for EXT4_FC_TAG_ADD_RANGE case. Add
a comment for that.

Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agoext2fs: don't ignore return value in ext2fs_count_blocks
Harshad Shirwadkar [Tue, 23 Feb 2021 17:41:54 +0000 (09:41 -0800)]
ext2fs: don't ignore return value in ext2fs_count_blocks

Don't ignore return value of ext2fs_get_array() in
ext2fs_count_blocks().

Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agoe2fsck: don't ignore return values in e2fsck_rewrite_extent_tree
Harshad Shirwadkar [Tue, 23 Feb 2021 17:41:53 +0000 (09:41 -0800)]
e2fsck: don't ignore return values in e2fsck_rewrite_extent_tree

Don't ignore return values of library function calls in
e2fsck_rewrite_extent_tree.

Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agocreate_inode: fix potential file descriptor leak on an error path
Theodore Ts'o [Tue, 23 Feb 2021 17:56:01 +0000 (12:56 -0500)]
create_inode: fix potential file descriptor leak on an error path

Addresses-Coverity-Bug: 1473307
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agomisc: replace remaining loff_t with ext2_loff_t
Andreas Dilger [Tue, 23 Feb 2021 02:53:53 +0000 (21:53 -0500)]
misc: replace remaining loff_t with ext2_loff_t

Replace the remaining loff_t uses with ext2_loff_t, as
was done in patch 1df6a4555, since loff_t is a GCC'ism
and is not portable.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agochattr.1: improve attributes description to btrfs
Akatsuki Rui [Mon, 22 Feb 2021 16:42:38 +0000 (11:42 -0500)]
chattr.1: improve attributes description to btrfs

- c: for btrfs, compression are conflicts with nodatacow and nodatasum
- C: for btrfs, nodatacow is conflict with compression

ref:
- https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs(5)#MOUNT_OPTIONS
- https://www.spinics.net/lists/linux-btrfs/msg103219.html

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 months agocreate_inode: Find subdirectory in do_write_internal
Earl Chew [Sat, 20 Feb 2021 16:47:46 +0000 (08:47 -0800)]
create_inode: Find subdirectory in do_write_internal

Follow the example in do_mkdir_internal, and do_symlink_internal,
and find the correct parent directory if the destination
is not just a plain basename.

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

Signed-off-by: Earl Chew <earl_chew@yahoo.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agodebugfs: fix dump_metadata_block() for block sizes > 8192
Theodore Ts'o [Tue, 16 Feb 2021 05:30:24 +0000 (00:30 -0500)]
debugfs: fix dump_metadata_block() for block sizes > 8192

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agolibext2fs: fix crash when ext2fs_mmp_stop() is called before MMP is initialized
Theodore Ts'o [Mon, 15 Feb 2021 04:51:45 +0000 (23:51 -0500)]
libext2fs: fix crash when ext2fs_mmp_stop() is called before MMP is initialized

The fatal_error() function in e2fsck can call ext2fs_mmp_stop() on a
file system where MMP hasn't yet been initialized.  When that happens,
instead of crashing, have ext2fs_mmp_stop() return success, since mmp
doesn't need to be stopped if it hasn't even been initialized yet.

Addresses-Debian-Bug: #696609
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agotune2fs: teach tune2fs to use a random value for "-c random"
Theodore Ts'o [Sun, 14 Feb 2021 15:37:00 +0000 (10:37 -0500)]
tune2fs: teach tune2fs to use a random value for "-c random"

Addresses-Debian-Bug: #926293
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agodebugfs: clamp journal s_maxlen value when dumping the journal log
Theodore Ts'o [Sat, 13 Feb 2021 16:54:58 +0000 (11:54 -0500)]
debugfs: clamp journal s_maxlen value when dumping the journal log

Addresses-Coverity-Bug: 1432478
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agodebugfs: fix logdump on file systems with block sizes > 8192
Theodore Ts'o [Sat, 13 Feb 2021 15:35:50 +0000 (10:35 -0500)]
debugfs: fix logdump on file systems with block sizes > 8192

Addresses-Coverity-Bug: 1472879
Addresses-Coverity-Bug: 1472880
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agodebugfs: fix memory allocation failures when parsing journal_write arguments
Theodore Ts'o [Sat, 13 Feb 2021 02:43:00 +0000 (21:43 -0500)]
debugfs: fix memory allocation failures when parsing journal_write arguments

Fix double-free issues when parsing an invalid journal_write command,
such as: "journal_write -b 12 -b BAD -b 42".

Addresses-Coverity-Bug: 1464571
Addresses-Coverity-Bug: 1464575
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agodebugfs: fix header checks in logdump
Theodore Ts'o [Fri, 12 Feb 2021 21:50:07 +0000 (16:50 -0500)]
debugfs: fix header checks in logdump

Fixes: bd9ac48c9200 ("debugfs: add journal header checks in logdump")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoe2fsck: fix error code return in e2fsck_read_extents()
Theodore Ts'o [Fri, 12 Feb 2021 20:12:42 +0000 (15:12 -0500)]
e2fsck: fix error code return in e2fsck_read_extents()

Addresses-Coverity-Bug: 1472586
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agolibext2fs: fix incorrect error code return in ext2fs_add_jounral_inode3()
Theodore Ts'o [Fri, 12 Feb 2021 20:10:11 +0000 (15:10 -0500)]
libext2fs: fix incorrect error code return in ext2fs_add_jounral_inode3()

Addresses-Coverity-Bug: 1472255
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agodebugfs: add journal header checks in logdump
Theodore Ts'o [Fri, 12 Feb 2021 17:04:21 +0000 (12:04 -0500)]
debugfs: add journal header checks in logdump

Addresses-Coverity-Bug: 1431466
Addresses-Coverity-Bug: 1432478
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agobadblocks: add error checking for command-line arguments for -b and -c
Theodore Ts'o [Fri, 12 Feb 2021 16:53:23 +0000 (11:53 -0500)]
badblocks: add error checking for command-line arguments for -b and -c

Also remove a dead assignment (the value of try is overwritten after
the continue statement).

Addresses-Coverity-Bug: 1297515
Addresses-Coverity-Bug: 1464573
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoext2_fs.h: use the ext2fs_has_feature_64bits() instead of open coded check
Theodore Ts'o [Fri, 12 Feb 2021 05:10:06 +0000 (00:10 -0500)]
ext2_fs.h: use the ext2fs_has_feature_64bits() instead of open coded check

This makes the code a bit cleaner and fixes a false positive warning by
Coverity.  (CID #1464576)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoe2fsck: add error checking for ext2fs_extent_get_info()
Theodore Ts'o [Fri, 12 Feb 2021 04:47:32 +0000 (23:47 -0500)]
e2fsck: add error checking for ext2fs_extent_get_info()

This function can't actually fail today, but in the future it could
return an error, so it's better to add the appropriate error check.

Addresses-Coverity-Bug: #1464579
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoFix clang warnings on architectures with a 64-bit long
Theodore Ts'o [Thu, 11 Feb 2021 15:55:21 +0000 (10:55 -0500)]
Fix clang warnings on architectures with a 64-bit long

On most systems where we compile e2fsprogs, the u64 type is an
unsigned long long.  However, there are platforms (such as the
PowerPC) where a long 64-bits and so u64 is typedef'ed to be unsigned
long instead of a unsigned long long.  Fix this by using explicit
casts in printf statements.  For scanf calls, we need to receive the
value into a unsigned long long, and then assign it to a u64, after
doing range checks.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agomke2fs: fix resource leak on error path when creating inodes
Theodore Ts'o [Thu, 11 Feb 2021 15:45:13 +0000 (10:45 -0500)]
mke2fs: fix resource leak on error path when creating inodes

Addresses-Coverity-Bug: 1472856
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agotests: fix environmental dependency in m_rootdir_acl
Theodore Ts'o [Wed, 10 Feb 2021 16:12:49 +0000 (11:12 -0500)]
tests: fix environmental dependency in m_rootdir_acl

The test script had a dependency on the group id for the "adm" group
being 4.  Fixed by hard-coding the group id for the default acl for
the acl_dir directory.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoUpdate release notes, etc., for the 1.46.1 release v1.46.1
Theodore Ts'o [Tue, 9 Feb 2021 22:50:25 +0000 (17:50 -0500)]
Update release notes, etc., for the 1.46.1 release

(Also update some inaccuracies in the 1.46.0 release.)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agopo: update uk.po (from translationproject.org)
Yuri Chornoivan [Tue, 9 Feb 2021 22:37:28 +0000 (17:37 -0500)]
po: update uk.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agopo: update sv.po (from translationproject.org)
Göran Uddeborg [Tue, 9 Feb 2021 22:37:28 +0000 (17:37 -0500)]
po: update sv.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agopo: update pt.po (from translationproject.org)
Pedro Albuquerque [Tue, 9 Feb 2021 22:37:28 +0000 (17:37 -0500)]
po: update pt.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Tue, 9 Feb 2021 22:37:28 +0000 (17:37 -0500)]
po: update pl.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agopo: update ms.po (from translationproject.org)
Sharuzzaman Ahmat Raslan [Tue, 9 Feb 2021 22:37:28 +0000 (17:37 -0500)]
po: update ms.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agopo: update fr.po (from translationproject.org)
Samuel Thibault [Tue, 9 Feb 2021 22:37:28 +0000 (17:37 -0500)]
po: update fr.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agopo: update cs.po (from translationproject.org)
Petr Pisar [Tue, 9 Feb 2021 22:37:28 +0000 (17:37 -0500)]
po: update cs.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agomke2fs: fix a importing a directory with an ACL and inline data
Theodore Ts'o [Tue, 9 Feb 2021 22:11:23 +0000 (17:11 -0500)]
mke2fs: fix a importing a directory with an ACL and inline data

If an inode which is copied into a file system using "mke2fs -d" has
an ACL (or extended attributes) and it is also using inline data, when
the extended attribute(s) are copied in, the inline data gets dropped due to a missing call to ext2fs_xattrs_read().

Addresses-Debian-Bug: #971014
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agodebian: add build profiles noudeb and pkg.e2fsprogs.no-static
Theodore Ts'o [Tue, 9 Feb 2021 20:56:12 +0000 (15:56 -0500)]
debian: add build profiles noudeb and pkg.e2fsprogs.no-static

Addresses-Debian-Bug: #966686
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoconfigure.ac: convert all help strings to use AS_HELP_STRING
Theodore Ts'o [Tue, 9 Feb 2021 20:54:12 +0000 (15:54 -0500)]
configure.ac: convert all help strings to use AS_HELP_STRING

Some help strings were using the deprecated AC_HELP_STRING, and others
were completely hard-coded.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoProvide and use sort_r() instead of qsort_r() for portability reasons
Theodore Ts'o [Tue, 9 Feb 2021 20:27:51 +0000 (15:27 -0500)]
Provide and use sort_r() instead of qsort_r() for portability reasons

The qsort_r() function is specific to glibc.  It is not present in the
musl C library.  Worse, FreeBSD supports qsort_r, but with an
incompatible interface.  So use sort_r() from commit c8c65c1e183d
from the git repository: https://github.com/noporpoise/sort_r

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

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoe2fsck: endianness fixes for fast commit replay
Harshad Shirwadkar [Thu, 4 Feb 2021 23:36:01 +0000 (15:36 -0800)]
e2fsck: endianness fixes for fast commit replay

There are a few places where the endianness conversion wasn't done
right. This patch fixes that. Verified that after this patch,
j_recover_fast_commit passes on big endian qemu VM.

root@debian-powerpc:~/e2fsprogs/tests# make j_recover_fast_commit
j_recover_fast_commit: : ok

Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoext2fs: initialize handle to NULL in ext2fs_count_blks
Harshad Shirwadkar [Thu, 4 Feb 2021 23:35:59 +0000 (15:35 -0800)]
ext2fs: initialize handle to NULL in ext2fs_count_blks

Initialize the handle to NULL to ensure that in error cases,
ext2fs_free_mem can be called on it.

Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoe2fsck: fix check of directories over 4GB
Andreas Dilger [Tue, 2 Feb 2021 08:25:49 +0000 (01:25 -0700)]
e2fsck: fix check of directories over 4GB

If directories grow larger than 4GB in size with the large_dir
feature, e2fsck will consider them to be corrupted and clear
the high bits of the size.

Since it isn't very common to have directories this large, and
unlike sparse files that don't have ill effects if the size is
too large, an too-large directory will have all of the sparse
blocks filled in by e2fsck, so huge directories should still
be viewed with suspicion.  Check for consistency between two of
the three among block count, inode size, and superblock large_dir
flag before deciding whether the directory inode should be fixed
or cleared, or if large_dir should be set in the superblock.

Update the f_recnect_bad test case to match new output.

Fixes: 49f28a06b738 ("e2fsck: allow to check >2GB sized directory")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Lustre-bug-id: https://jira.whamcloud.com/browse/LU-14345
Change-Id: I1b898cdab95d239ba1a7b37eb96255acadce7057
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agolibext2fs: fix more compiler warnings
Theodore Ts'o [Mon, 8 Feb 2021 04:27:56 +0000 (23:27 -0500)]
libext2fs: fix more compiler warnings

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agolibext2fs: fix segault when setting an xattr with an unknown prefix
Theodore Ts'o [Mon, 8 Feb 2021 04:21:58 +0000 (23:21 -0500)]
libext2fs: fix segault when setting an xattr with an unknown prefix

Also avoid unnecessary calls to find_ea_index() by caching the short
name and name index in the ext2_attr structure.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agomisc: fix minor llvm warnings
Andreas Dilger [Sun, 24 Jan 2021 23:20:06 +0000 (16:20 -0700)]
misc: fix minor llvm warnings

Fix a couple minor type mismatch warnings.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agodebian: drop transitional packages
Theodore Ts'o [Sat, 30 Jan 2021 04:35:38 +0000 (23:35 -0500)]
debian: drop transitional packages

We renamed the libcomerr2, e2fslibs, and e2fslibs-dev packages to
match Debian package naming convetions in Debian 10 (Buster).  Now
that Debian 11 (Bullseye) is about to be released, we no longer need
the transitional packages.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoconfigure.ac: fix build failure on systems with pthreads && !fuse support
Theodore Ts'o [Sat, 30 Jan 2021 03:28:31 +0000 (22:28 -0500)]
configure.ac: fix build failure on systems with pthreads && !fuse support

The configure script checks for pthread.h as part of double-checking
that the FUSE support works correctly, which implicitly defined
HAVE_PHREAD_H.  If the FUSE libraries are not present (or fuse support
is explicitly disabled), this check doesn't happen and so
HAVE_PTHREAD_H is not defined, and this causes a build failure.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoUpdate release notes, etc., for the 1.46.0 release v1.46.0
Theodore Ts'o [Fri, 29 Jan 2021 21:28:44 +0000 (16:28 -0500)]
Update release notes, etc., for the 1.46.0 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoUpdate makefile dependencies
Theodore Ts'o [Fri, 29 Jan 2021 19:45:44 +0000 (14:45 -0500)]
Update makefile dependencies

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoUpdate debian/libext2fs2.symbols with the additions to the shared library
Theodore Ts'o [Fri, 29 Jan 2021 06:56:41 +0000 (01:56 -0500)]
Update debian/libext2fs2.symbols with the additions to the shared library

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoMerge branch 'maint' into next
Theodore Ts'o [Fri, 29 Jan 2021 06:13:18 +0000 (01:13 -0500)]
Merge branch 'maint' into next

7 months agoe2fsck: drop use of sysctl(2)
Theodore Ts'o [Fri, 29 Jan 2021 06:03:36 +0000 (01:03 -0500)]
e2fsck: drop use of sysctl(2)

Remove the use of the binary interface using the sysctl(2) system call
since sys/sysctl.h has been deprecated.  We can find the total memory
available in the system using the POSIX standard sysconf(2) interface.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoconfigure.ac: add substitution for @mkdir_p@ since po/Makefile.in.in uses it
Theodore Ts'o [Fri, 29 Jan 2021 04:16:46 +0000 (23:16 -0500)]
configure.ac: add substitution for @mkdir_p@ since po/Makefile.in.in uses it

Fixes: e598c29b4d38 ("Update gettext files to version 0.19.8")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoUpdate release notes, etc., for the 1.45.7 release v1.45.7
Theodore Ts'o [Fri, 29 Jan 2021 05:27:17 +0000 (00:27 -0500)]
Update release notes, etc., for the 1.45.7 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agopo: update sr.po (from translationproject.org)
Мирослав Николић [Thu, 28 Jan 2021 19:27:00 +0000 (14:27 -0500)]
po: update sr.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agopo: update nl.po (from translationproject.org)
Benno Schulenberg [Thu, 28 Jan 2021 19:27:00 +0000 (14:27 -0500)]
po: update nl.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agopo: update ms.po (from translationproject.org)
Sharuzzaman Ahmat Raslan [Thu, 28 Jan 2021 19:27:00 +0000 (14:27 -0500)]
po: update ms.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agomisc: fix a spelling nit in the mke2fs man page
Theodore Ts'o [Thu, 28 Jan 2021 19:21:09 +0000 (14:21 -0500)]
misc: fix a spelling nit in the mke2fs man page

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoUpdate Makefile dependencies for lib/e2p and lib/ext2fs
Theodore Ts'o [Thu, 28 Jan 2021 06:31:21 +0000 (01:31 -0500)]
Update Makefile dependencies for lib/e2p and lib/ext2fs

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoMerge branch 'maint' into next
Theodore Ts'o [Thu, 28 Jan 2021 05:52:22 +0000 (00:52 -0500)]
Merge branch 'maint' into next

7 months agoAOSP: Add assemble_cvd to com.android.virt
Jiyong Park [Tue, 5 Jan 2021 05:43:46 +0000 (14:43 +0900)]
AOSP: Add assemble_cvd to com.android.virt

assemble_cvd directly or indirectly depends on these modules. To add
assemble_cvd to the com.anroid.virt APEX, these modules are marked as
being available to the APEX.

Google-Bug-Id: 174639526
Test: m com.android.virt
Change-Id: Ibc28d24abd358fb1f8608b3f3d6d06c2746f2d72
From AOSP commit: e70718ecae3cf1e2a26af800734130e003186e7e

7 months agoAOSP: tune2fs/resize2fs: make vendor_ramdisk_available.
Yifan Hong [Thu, 19 Nov 2020 02:52:13 +0000 (18:52 -0800)]
AOSP: tune2fs/resize2fs: make vendor_ramdisk_available.

The vendor_ramdisk variant is dynamic, unlike the ramdisk variant.

Test: builds
Google-Bug-Id: 173425293
Change-Id: I45547b5ea99aae98727121c038129844b7930ed6
From AOSP commit: 073ede3200afeffd82889cb61a71fa1947314476

7 months agoAOSP: Make libext2_uuid and e2fsprogs headers vendor_ramdisk_available.
David Anderson [Tue, 17 Nov 2020 07:19:04 +0000 (23:19 -0800)]
AOSP: Make libext2_uuid and e2fsprogs headers vendor_ramdisk_available.

This is needed to build snapuserd into the vendor ramdisk.

Google-Bug-Id: 173463595
Test: snapuserd builds
Change-Id: I05d85357ebf47abd0d82e9c6211e854bdf0d5ae9
From AOSP commit: b28c0ef21cf8ebd172a07cfd09551af38366a5a7

7 months agoAOSP: Add "product_available" to product available modules
Justin Yun [Wed, 11 Nov 2020 07:15:33 +0000 (16:15 +0900)]
AOSP: Add "product_available" to product available modules

"vendor_available" modules were available to product modules.
However, not all "vendor_available" modules are required to be
available to product modules. Some modules want to be available only
to product modules but not vendor modules.

To cover the requirement, we separate "product_available" from
"vendor_available".
"vendor_available" will not provide product available module.

Google-Bug-Id: 150902910
Test: build
Change-Id: I316da0d24bde8b6231114aa80841c59547691152
From AOSP commit: df51b0de40581f52c6515f8775ecd84dc4a50bb0

7 months agoAOSP: ANDROID: e2fsck: Handle casefolded encryption
Daniel Rosenberg [Fri, 13 Mar 2020 23:08:52 +0000 (16:08 -0700)]
AOSP: ANDROID: e2fsck: Handle casefolded encryption

Adds support for EXT2_HASH_SIPHASH, and reading the hash from disk in
that case. We cannot compute the siphash without the key, so we must
not modify the names of any encrypted and casefolded directories,
which limits some recovery options, and we must assume the hashes
stored in dirents are correct.
This is in preparation for upcoming kernel support for encryption and
casefolding at the same time.

Google-Bug-Id: 138322712
Test: Create fs with casefold and encryption enabled via mke2fs and
      tune2fs, run fsck after creating casefolded + encrypted folder

Change-Id: Icca32d7d9dd3c7f52da03d60e4d89273cbec0a7d
From AOSP commit: 67eae926bdac1a54dbb8335731c5e1581f93e4bb

7 months agoAOSP: ANDROID: mke2fs: Support encrypt+casefold
Daniel Rosenberg [Thu, 11 Jun 2020 04:22:05 +0000 (21:22 -0700)]
AOSP: ANDROID: mke2fs: Support encrypt+casefold

In preparation for upcoming kernel changes that will make the kernel
support both encryption and casefolding at the same time, allow mke2fs
to enable both features at the same time.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Google-Bug-Id: 138322712
Test: Create fs with casefold and encryption enabled via mke2fs
Change-Id: I4e2350e43e21cffb3d972310cd74df1e662bf87e
From AOSP commit: f8fc427df385260f3424e1e9d5485c8640606920

7 months agoAOSP: ANDROID: tune2fs: Support encrypt+casefold
Daniel Rosenberg [Thu, 11 Jun 2020 04:21:42 +0000 (21:21 -0700)]
AOSP: ANDROID: tune2fs: Support encrypt+casefold

In preparation for upcoming kernel changes that will make the kernel
support both encryption and casefolding at the same time, allow tune2fs
to enable both features at the same time.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Google-Bug-Id: 138322712
Test: Create fs with casefold and encryption enabled via tune2fs

Change-Id: I36537a8b6dc5e2997b7016212f9b574c76673067
From AOSP commit: 44ac9dccd9853cc9807f0d6ce952bdcdeb93954a

7 months agoAOSP: ANDROID: e2fsck: Do not mutate encrypted names
Daniel Rosenberg [Fri, 12 Jun 2020 11:11:38 +0000 (04:11 -0700)]
AOSP: ANDROID: e2fsck: Do not mutate encrypted names

We can't mutate a name without the key, as this will at best cause the
name to become gibberish, and at worst may introduce invalid characters
or even fail to be unique after decoding, so drop duplicates instead.
Files lost in this way will be reconnected to lost+found

Fixes: dbff534ec685 ("e2fsck: suppress bad name checks for encrypted directories")
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Google-Bug-Id: 138322712
Test: f_dup_de_crypt
Change-Id: I8d6cc3984872868a845fafabc554abdd86351fcc
From AOSP commit: 80b85f8a0b2ba7090a927f692ff9d2097ffd8d1f

7 months agoAOSP: ANDROID: tune2fs: Allow setting the casefold feature
Daniel Rosenberg [Thu, 11 Jun 2020 04:18:44 +0000 (21:18 -0700)]
AOSP: ANDROID: tune2fs: Allow setting the casefold feature

This allows tune2fs to enable casefolding on an existing filesystem.
At the moment, casefolding is incompatible with encryption.

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Google-Bug-Id: 138322712
Test: Create fs without casefold and enable it via tune2fs
Change-Id: Ic9ed63180ef28c36e083cee85ade432e4bfcc654
From AOSP commit: eb5b168decac07058e90ead191350be80c75aff4

7 months agoAOSP: Make e2fsck depends on badblocks
Howard Chen [Fri, 29 May 2020 04:26:54 +0000 (12:26 +0800)]
AOSP: Make e2fsck depends on badblocks

The e2fsck may invoke the badblocks when -c is specified.
Also the badblocks is required by Mediatek devices. Add it for
completeness.

Test: compile wembley-userdebug
Google-Bug-Id: 157393160

Change-Id: I1163129c925e93ef386e86a60c93e9c314397134
From AOSP commit: dffec44dd56175b80810657f95f8e09a7e3ab0bf

7 months agotests: test case-folding checks in e2fsck
Gabriel Krisman Bertazi [Thu, 17 Dec 2020 17:35:44 +0000 (18:35 +0100)]
tests: test case-folding checks in e2fsck

Add the test f_bad_fname which test fixes of invalid filenames and
duplicates.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoe2fsck.8.in: document check_encoding extended option
Gabriel Krisman Bertazi [Thu, 17 Dec 2020 17:35:43 +0000 (18:35 +0100)]
e2fsck.8.in: document check_encoding extended option

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoe2fsck: add option to force encoded filename verification
Gabriel Krisman Bertazi [Thu, 17 Dec 2020 17:35:42 +0000 (18:35 +0100)]
e2fsck: add option to force encoded filename verification

This is interesting for !strict filesystems as part of the encoding
update procedure. Once the filesystem is known to not have badly encoded
filenames, the update is trivial, thanks to the stability of assigned
code points in the unicode specification.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 months agoe2fsck: detect duplicated casefolded direntries for rehash
Gabriel Krisman Bertazi [Thu, 17 Dec 2020 17:35:41 +0000 (18:35 +0100)]
e2fsck: detect duplicated casefolded direntries for rehash

On pass2, support casefolded directories when looking for duplicated
entries.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>