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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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_rhttps://github.com/tytso/e2fsprogs/issues/58
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
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>
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>
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: 49f28a06b7 ("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>
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>
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>