Commit Graph

6759 Commits

Author SHA1 Message Date
Theodore Ts'o
5a3ea3905f 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>
2021-07-29 10:31:53 -04:00
Theodore Ts'o
4d988e1bba 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>
2021-07-28 23:56:08 -04:00
Theodore Ts'o
9aba05286c 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>
2021-07-28 23:46:36 -04:00
Theodore Ts'o
225e5d093b e2fsck: fix f_baddotdir failure on big-endian systems
Commit 63f44aafb1 ("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: 63f44aafb1 ("e2fsck: fix ".." more gracefully if possible")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-28 14:40:49 -04:00
Theodore Ts'o
496669a290 Update release notes, etc., for the 1.46.3 release
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-27 13:38:14 -04:00
Colin Cross
59eed5421c 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
2021-07-27 12:31:55 -04:00
Eric Biggers
3e3403d96d 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
2021-07-27 12:28:18 -04:00
Eric Biggers
64348f6e29 AOSP: Add a new upstream source file to lib/e2p/Android.bp
Change-Id: Ibc305759a9046996a397d652d799e930629f9f71
From AOSP commit: a02aa2b8e145449711e0dcdae5573fbaa888bf33
2021-07-27 12:26:00 -04:00
Bob Badour
9c897f0103 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
2021-07-27 11:14:05 -04:00
Мирослав Николић
69e1cb3b32 po: update sr.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-27 11:02:28 -04:00
Benno Schulenberg
57d79b65aa po: update nl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-27 11:02:28 -04:00
Sharuzzaman Ahmat Raslan
daf3a6ac05 po: update ms.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-27 11:02:28 -04:00
Theodore Ts'o
f158f8962e Fix miscellaneous compiler warnings using "make gcc-wall"
Address a number of signed vs. unsigned comparison errors, unused
function parameters, casts which drop const, etc.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-25 23:38:39 -04:00
Theodore Ts'o
ddee43e8e8 libext2fs: avoid unnecessary stat(2) calls on mountpoints
If the device name in the mtab or /proc/mounts file does not match
with the device passed into ext2fs_check_if_mounted() or
ext2fs_check_mount_point(), skip the stat(2) call on the mountpoint,
since we never use the results of the stat(2) in that case.  Not only
does this provide a slight performance win, but it the stat calls on
the mountpoints could potentially trigger some SELinux denials that
could stress some sysadmins out.

Google-Bug-Id:  193137337
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-24 12:55:28 -04:00
Theodore Ts'o
4e424586cc debian/changelog: fix missing Closed: annotation
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-23 07:30:04 -04:00
David Anderson
83782a6877 AOSP: e2fsdroid: Don't over-reserve blocks for files in Base FS.
If a large number of blocks move from one file to another file,
e2fsdroid will inadvertently reserve the moved blocks for the source
file. If the larger file is visited first, it can fail to acquire blocks
because they're reserved by the smaller file.

This patch only reserves the first N blocks of a file in Base FS, where N
is large enough to satisfy the |st_size| property from lstat(2). We only
consider "owned" blocks rather than deduplicated blocks, in case the new
file cannot be deduplicated.

Google-Bug-Id: 145316683
Test: e2fsdroid with dynamic partitions
Change-Id: I32e255a19550d52d90342c21d7218981108a71b1
From AOSP commit: 2985b26cdbe674084fa02b211503eef9bf970023
2021-07-21 21:09:09 -04:00
Theodore Ts'o
942b00cb9d mke2fs: do not warn about a pre-existing partition table when using a non-zero offset
The existing code attempted to avoid warning about a pre-existing file
system with a non-zero offset, but because the offset was not set at
the time of the check, this intention was not actually working.  So
this commit will suppress warnings about pre-existing a partition
table as well as pre-existing file system when there is a non-zero
offset.

Addresses-Debian-Bug: #989612
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-21 16:24:15 -04:00
Theodore Ts'o
6568ba325e mke2fs: only try discarding a single block to test if discard works
Commit d2bfdc7ff1 ("Use punch hole as "discard" on regular files")
added a test to see if the storage device actually supports discard.
The intent was to try discarding the first block but since
io_channel_discard() interprets the offset and count arguments in
blocks, and not bytes, mke2fs was actually discarding the first 16
megabytes (when the block size is 4k).  This is normally not a
problem, since most file systems are larger than that, and requests to
discard beyond the end of the block device are ignored.

However, when creating a small file system as part of a image
containing multiple partitions, the initial test discard can end up
discarding data beyond the file system being created.

Addresses-Debian-Bug: #989630
Reported-by: Josh Triplett <josh@joshtriplett.org>
Fixes: d2bfdc7ff1 ("Use punch hole as "discard" on regular files")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-18 11:05:20 -04:00
Theodore Ts'o
d0b6b64f62 libext2fs: avoid forking a single thread in ext2fs_rw_bitmaps()
https://github.com/tytso/e2fsprogs/issues/67

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-16 23:10:52 -04:00
Theodore Ts'o
a3f844da91 libe2p: use stat to prevent calling EXT2_IOC_[GS]ETFLAGS on devices
Some devices can react badly to the EXT2_IOC_[GS]ETFLAGS ioctls, since
ioctl codes are not guaranteed to be unique across different device
drivers and file systems.

Addresses-Debian-Bug: #986332
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-16 22:31:26 -04:00
Zhiqiang Liu
29a61d8940 ext2ed: fix potential NULL pointer dereference in dupstr()
In dupstr(), we should check return value of malloc().

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
Reviewed-by: Wu Bo <wubo40@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-15 23:59:21 -04:00
Zhiqiang Liu
a6aee13bc2 lib/ss/error.c: check return value malloc in ss_name()
In ss_name(), we should check return value of malloc(),
otherwise, it may 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>
2021-07-15 23:45:20 -04:00
Zhiqiang Liu
f9033bd2e8 misc: fix potential segmentation fault problem in scandir()
In scandir(), temp_list[num_dent] is allocated by calling
malloc(), we should check whether malloc() returns NULL before
accessing temp_list[num_dent].

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>
2021-07-15 23:43:37 -04:00
Zhiqiang Liu
a61bc9e009 argv_parse: check return value of malloc in argv_parse()
In argv_parse(), return value of malloc should be checked
whether it is NULL, otherwise, it may cause a segfault error.

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>
2021-07-15 23:41:20 -04:00
wuguanghao
af03924f5b append_pathname: check the value returned by realloc
In append_pathname(), we need to add a new path to save the value
returned by realloc, otherwise the name->path may be NULL, causing
a segfault.

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>
2021-07-15 23:38:36 -04:00
wuguanghao
c3215a5324 zap_sector: fix memory leak
In zap_sector(), need free buf before return,
otherwise it will cause memory leak.

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>
2021-07-15 23:20:39 -04:00
wuguanghao
1b673e44c1 tdb_transaction_recover: fix memory leak
In tdb_transaction_recover(), need free data before return,
otherwise it will cause memory leak.

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>
2021-07-15 23:19:26 -04:00
wuguanghao
cac906a942 profile_create_node: set magic before strdup(name) to avoid memory leak
If new->magic != PROF_MAGIC_NODE, profile_free_node() don't free node.
This will cause the node to be unable to be released correctly and
a memory leak will occur.

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>
2021-07-15 23:17:46 -04:00
Eric Biggers
657715deb8 libext2fs: fix a -Wunused-label warning
Remove a label which isn't used.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-06 23:13:48 -04:00
Eric Biggers
beb863f144 Fix -Wunused-variable warnings
Fix all warnings about unused variables that were introduced since
e2fsprogs v1.45.4.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-06 23:11:35 -04:00
Eric Biggers
b5f2be81eb Fix -Wunused-parameter warnings
Fix all warnings about unused function parameters that were introduced
since e2fsprogs v1.45.4, by adding EXT2FS_ATTR((unused)) or removing
parameters as appropriate.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-06 22:44:19 -04:00
Eric Biggers
108f3021a6 mke2fs: use ext2fs_get_device_size2() on all platforms
Since commit e8c858047b ("libext2fs: fix build issue for on
Windows/Cygwin systems"), ext2fs_get_device_size2() is available in
Windows builds of libext2fs.  So there is no need for mke2fs to call
ext2fs_get_device_size() instead.

This fixes a -Wincompatible-pointer-types warning because
ext2fs_get_device_size() was being passed a 'blk64_t *', but it expected
a 'blk_t *'.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-06 22:43:25 -04:00
Eric Biggers
6c60acbb94 e2fsck: sync fc_do_one_pass() changes from kernel
Sync the changes to fc_do_one_pass() from the kernel's recovery.c so
that e2fsck picks up the fixes to the jbd_debug() statements.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-06 22:41:45 -04:00
Eric Biggers
19e50aa762 libext2fs: improve jbd_debug() implementation
Make jbd_debug() do format string checking (but still get compiled away
to nothing) when --enable-jbd-debug isn't specified, similar to
commit d556435156b7 ("jbd2: avoid -Wempty-body warnings") on the kernel
side.  This should prevent --enable-jbd-debug from getting broken due to
bad jbd_debug() statements.  It also eliminates a -Wunused-variable
warning where a variable was only used in a jbd_debug() statement.

Also remove an alternative definition of jbd_debug() that was
conditional on CONFIG_JBD_DEBUG && !CONFIG_JBD_DEBUG, so was dead code.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-06 22:34:03 -04:00
Jan Kara
0af9a7e9dc tune2fs: update overhead when toggling journal feature
When adding or removing journal from a filesystem, we also need to add /
remove journal blocks from overhead stored in the superblock.  Otherwise
total number of blocks in the filesystem as reported by statfs(2) need
not match reality and could lead to odd results like negative number of
used blocks reported by df(1).

Fixes: 9046b4dfd0ce ("mke2fs: set overhead in super block")
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-06 19:55:09 -04:00
Lukas Czerner
2c69c94217 e2fsck: fix last mount/write time when e2fsck is forced
With commit c52d930f e2fsck is no longer able to fix bad last
mount/write time by default because it is conditioned on s_checkinterval
not being zero, which it is by default.

One place where it matters is when other e2fsprogs tools require to run
full file system check before a certain operation. If the last mount
time is for any reason in future, it will not allow it to run even if
full e2fsck is ran.

Fix it by checking the last mount/write time when the e2fsck is forced,
except for the case where we know the system clock is broken.

[ Reworked the conditionals so error messages claiming that the last
  write/mount time were corrupted wouldn't be always printed when the
  e2fsck was run with the -f option, thus causing 299 out of 372
  regression tests to fail.  -- TYT ]

Fixes: c52d930f ("e2fsck: don't check for future superblock times if checkinterval == 0")
Reported-by: Dusty Mabe <dustymabe@redhat.com>
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-06 19:48:20 -04:00
Andreas Dilger
63f44aafb1 e2fsck: fix ".." more gracefully if possible
If the "." entry is corrupted, it will be reset in check_dot().
It is possible that the ".." entry can be recovered from the
directory block instead of also resetting it immediately.  If
it appears that there is a valid ".." entry in the block, allow
that to be used, and let check_dotdot() verify the dirent itself.

When resetting the "." and ".." entries, use EXT2_FT_DIR as the
file type instead of EXT2_FT_UNKNOWN for the very common case of
filesystems with the "filetype" feature, to avoid later problems
that can be easily avoided.  This can't always be done, even if
filesystems without "filetype" are totally obsolete, because many
old test images do not have this feature enabled.

Fixup affected tests using the new "repair-test" script that
updates the expect.[12] files from $test.[12].log for the given
tests and re-runs the test to ensure it now passes.

Signed-off-by: Andreas dilger <adilger@whamcloud.com>
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@hpe.com>
Lustre-bug-Id: https://jira.whamcloud.com/browse/LU-14710
Change-Id: Ia5e579bcf31a9d9ee260d5640de6dbdb60514823
Reviewed-on: https://review.whamcloud.com/43858
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-06 15:43:21 -04:00
Michael Forney
a39e58bab6 libext2fs: use offsetof() from stddef.h
offsetof is a standard C feature available from stddef.h, going
back all the way to ANSI C.

Signed-off-by: Michael Forney <mforney@mforney.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-05 20:22:57 -04:00
Michael Forney
9d5fdcc5db libext2fs: use statement-expression for container_of only on GNU-compatible compilers
Functionally, the statement-expression is not necessary here; it
just gives a bit of type-safety to make sure the pointer really
does have a compatible type with the specified member of the struct.

When statement expressions are not available, we can just use a
portable fallback macro that skips this member type check.

Signed-off-by: Michael Forney <mforney@mforney.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-07-05 20:22:57 -04:00
Artem Blagodarenko
f11448318f e2image: fix overflow in l2 table processing
For a large partition during e2image capture process
it is possible to overflow offset at multiply operation.
This leads to the situation when data is written to the
position at the start of the image instead of the image end.

Let's use the right cast to avoid integer overflow.

Signed-off-by: Alexey Lyashkov <c17817@cray.com>
Signed-off-by: Artem Blagodarenko <c17828@cray.com>
HPE-bug-id: LUS-9368
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-05-07 18:48:45 -04:00
Theodore Ts'o
9ae89fe3a9 tests: add test of Direct I/O support in the Unix I/O manager
This test requires root, and only works on Linux systems.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-05-07 18:47:11 -04:00
Alexander Kanavin
f53fa5a2ac libext2fs: fix Direct I/O support in the Unix I/O manager
Commit d557b9659b ("libext2fs: fix potential races in unix_io")
contained some additional changes that were supposed to clarify the
management of the length calculations when reading and writing
non-page aligned data using Direct I/O; unfortunately, those changes
were incorrect, and actually broke the Direct I/O support.

Fix these problems by reverting those portions of that commit.

[ commit description rewritten by tytso ]

Originally from https://github.com/tytso/e2fsprogs/pull/68

Fixes: d557b9659b ("libext2fs: fix potential races in unix_io")
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-05-07 16:29:41 -04:00
Alexander Kanavin
4c928984bf libext2fs: fix missing mutex unlock in an error path of the Unix I/O manager
Originally from https://github.com/tytso/e2fsprogs/pull/68

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-05-07 16:28:31 -04:00
Theodore Ts'o
86fe64e486 e2fsck: fix unaligned accesses to ext4_fc_add_range and fc_raw_inode
These fast commit related structures can be unaligned on disk.  So we
need to avoid accessing these structures directly, and first copy
them to memory which we know is appropriately aligned.

This fixes an e2fsck crash while running the j_recovery_fast_commit
regression test on a sparc64 system.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-05-06 22:40:57 -04:00
Harshad Shirwadkar
45780b37ef e2fsck: fix unaligned accesses to ext4_fc_tl struct
Fast commit related struct ext4_fc_tl can be unaligned on disk. So,
while accessing that we should ensure that the pointers are
aligned. This patch fixes unaligned accesses to ext4_fc_tl and also
gets rid of macros fc_for_each_tl and ext4_fc_tag_val that may result
in unaligned accesses to struct ext4_fc_tl.

Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-05-06 21:57:15 -04:00
Theodore Ts'o
1e0c8ca7c0 e2fsck: fix portability problems caused by unaligned accesses
The on-disk format for the ext4 journal can have unaigned 32-bit
integers.  This can happen when replaying a journal using a obsolete
checksum format (which was never popularly used, since the v3 format
replaced v2 while the metadata checksum feature was being stablized),
and in the fast commit feature (which landed in the 5.10 kernel,
although it is not enabled by default).

This commit fixes the following regression tests on some platforms
(such as running 32-bit arm architectures on a 64-bit arm kernel):
j_recover_csum2_32bit, j_recover_csum2_64bit, j_recover_fast_commit.

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

Addresses-Debian-Bug: #987641
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-05-06 14:02:51 -04:00
Theodore Ts'o
32fda1e5a3 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>
2021-04-11 19:52:57 -04:00
Andreas Dilger
612358c193 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>
2021-04-02 16:04:38 -04:00
Andreas Dilger
b5bdc0432f 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>
2021-04-02 16:02:01 -04:00
Zhiqiang Liu
e4979da45d 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>
2021-04-02 15:57:00 -04:00