Commit Graph

6741 Commits

Author SHA1 Message Date
Theodore Ts'o
7e8d22814c debugfs: fix file descriptor leak on error path in do_logdump()
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-23 23:57:10 -05:00
Theodore Ts'o
4537f8aa80 misc/Makefile.in: add rules to build static versions of lsattr and chattr
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-23 22:03:59 -05:00
Theodore Ts'o
40ea4628ba libe2p: skip unneeded lstat(2) in fgetflags() and fsetflags()
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-23 21:25:46 -05:00
Theodore Ts'o
7fc56dd147 debugfs: fix uninitialized variable es in do_logdump()
Fixes: d96064e982 ("debugfs: simplify the do_logdump() function")

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-23 20:58:31 -05:00
Theodore Ts'o
d96064e982 debugfs: simplify the do_logdump() function
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-23 16:19:00 -05:00
Theodore Ts'o
03130cc27f 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>
2021-02-23 16:02:42 -05:00
Theodore Ts'o
61ec4fba1d e2fsck: fix miscellaneous clang warnings
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-23 13:03:37 -05:00
Harshad Shirwadkar
5ba3e1644c 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>
2021-02-23 12:58:16 -05:00
Harshad Shirwadkar
11797844f4 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>
2021-02-23 12:58:03 -05:00
Harshad Shirwadkar
c5ff455e42 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>
2021-02-23 12:58:03 -05:00
Harshad Shirwadkar
1e616535bc 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>
2021-02-23 12:58:03 -05:00
Theodore Ts'o
1dba260cef create_inode: fix potential file descriptor leak on an error path
Addresses-Coverity-Bug: 1473307
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-23 12:56:01 -05:00
Andreas Dilger
bd36e7d14f 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>
2021-02-22 21:53:53 -05:00
Akatsuki Rui
da3b6c27d2 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>
2021-02-22 11:42:38 -05:00
Earl Chew
bc50f5abd7 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>
2021-02-22 11:27:14 -05:00
Theodore Ts'o
ea82add307 debugfs: fix dump_metadata_block() for block sizes > 8192
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-16 00:30:24 -05:00
Theodore Ts'o
71f9bf7b08 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>
2021-02-14 23:51:45 -05:00
Theodore Ts'o
e3a13a47e6 tune2fs: teach tune2fs to use a random value for "-c random"
Addresses-Debian-Bug: #926293
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-14 10:37:00 -05:00
Theodore Ts'o
ff9b039b1f debugfs: clamp journal s_maxlen value when dumping the journal log
Addresses-Coverity-Bug: 1432478
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-13 11:54:58 -05:00
Theodore Ts'o
28e22540e2 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>
2021-02-13 10:35:50 -05:00
Theodore Ts'o
462c424500 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>
2021-02-12 21:43:00 -05:00
Theodore Ts'o
eef68a593f debugfs: fix header checks in logdump
Fixes: bd9ac48c92 ("debugfs: add journal header checks in logdump")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-12 16:50:07 -05:00
Theodore Ts'o
4d8169ad2a e2fsck: fix error code return in e2fsck_read_extents()
Addresses-Coverity-Bug: 1472586
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-12 15:12:42 -05:00
Theodore Ts'o
1b25ea248c libext2fs: fix incorrect error code return in ext2fs_add_jounral_inode3()
Addresses-Coverity-Bug: 1472255
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-12 15:10:11 -05:00
Theodore Ts'o
bd9ac48c92 debugfs: add journal header checks in logdump
Addresses-Coverity-Bug: 1431466
Addresses-Coverity-Bug: 1432478
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-12 12:04:21 -05:00
Theodore Ts'o
10f9b11b76 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>
2021-02-12 11:53:23 -05:00
Theodore Ts'o
46fcf7087b 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>
2021-02-12 00:10:06 -05:00
Theodore Ts'o
ea41284998 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>
2021-02-11 23:47:32 -05:00
Theodore Ts'o
33b9a60c36 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>
2021-02-11 10:55:21 -05:00
Theodore Ts'o
fb874e6ff4 mke2fs: fix resource leak on error path when creating inodes
Addresses-Coverity-Bug: 1472856
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-11 10:45:13 -05:00
Theodore Ts'o
b79f56ce5d 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>
2021-02-10 11:12:49 -05:00
Theodore Ts'o
df0fe7c9a3 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>
2021-02-09 18:36:32 -05:00
Yuri Chornoivan
d50ffa90a4 po: update uk.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-09 17:37:28 -05:00
Göran Uddeborg
66b6b4869b po: update sv.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-09 17:37:28 -05:00
Pedro Albuquerque
4a9730000f po: update pt.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-09 17:37:28 -05:00
Jakub Bogusz
1f1b285c2c po: update pl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-09 17:37:28 -05:00
Sharuzzaman Ahmat Raslan
1d4a6b2a1e po: update ms.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-09 17:37:28 -05:00
Samuel Thibault
a9c317cc50 po: update fr.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-09 17:37:28 -05:00
Petr Pisar
77e1dd3fc0 po: update cs.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-09 17:37:28 -05:00
Theodore Ts'o
67e6ae0a35 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>
2021-02-09 17:11:23 -05:00
Theodore Ts'o
b637c57d12 debian: add build profiles noudeb and pkg.e2fsprogs.no-static
Addresses-Debian-Bug: #966686
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-09 15:56:12 -05:00
Theodore Ts'o
8c9e2921ec 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>
2021-02-09 15:54:12 -05:00
Theodore Ts'o
319b6c4f1c 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>
2021-02-09 15:27:51 -05:00
Harshad Shirwadkar
4e95b37230 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>
2021-02-08 23:36:48 -05:00
Harshad Shirwadkar
2fae964a0e 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>
2021-02-08 23:36:21 -05:00
Andreas Dilger
f15b1aaf8f 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: 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>
2021-02-08 22:40:42 -05:00
Theodore Ts'o
d9844883a1 libext2fs: fix more compiler warnings
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2021-02-07 23:27:56 -05:00
Theodore Ts'o
9f4e9fbbe2 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>
2021-02-07 23:21:58 -05:00
Andreas Dilger
f41c7da2e4 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>
2021-02-07 20:30:21 -05:00
Theodore Ts'o
ee2ee8343e 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>
2021-01-29 23:35:38 -05:00