Running lsblk when there are no valid block devicse results in
generating all block devices as the list of devices to scrub; this
results in a lot of e2scrub_all failures.
Addresses-Debian-Bug: #929186
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
In scrub/Makefile the various 'install-*' targets do not explicitly
depend on their corresponding 'installdirs-*' target, so they get run
in parallel.
Addresses-Gentoo-Bug: #680030
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Add the ability to save a log of problems found by e2fsck in a log
file that can be specified via /etc/e2fsck.conf.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
The check in mke2fs is intended to be for the number of blocks in the
filesystem exceeding the maximum number of addressable blocks in 2^32
bitmaps, which is (2^32 * 8 bits/byte * blocksize) = 2^47 blocks,
or 2^59 bytes = 512PiB for the common 4KiB blocksize.
However, s_log_blocksize holds log2(blocksize_in_kb), so the current
calculation is a factor of 2^10 too small. This caused mke2fs to fail
while trying to format a 900TB filesystem.
Fixes: 101ef2e93c ("mke2fs: Avoid crashes / infinite loops for absurdly large devices")
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Currently, e2fsck effectively checks only tail of the last inode and
block bitmap in the filesystem. Thus if some previous bitmap has unset
bits it goes unnoticed. Mostly these tail bits in the bitmap are
ignored; however, if blocks_per_group are smaller than 8*blocksize,
the multi-block allocator in the kernel can get confused when the tail
bits are unset and return bogus free extent.
Add support to libext2fs to check these bitmap tails when loading
bitmaps (as that's about the only place which has access to the bitmap
tail bits) and make e2fsck use this functionality to detect buggy bitmap
tails and fix them (by rewriting the bitmaps).
Reported-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jan Kara <jack@suse.cz>
Callers of libext2fs don't need to use this structure, and this gives
us the ability to change it later on without worrying about
changing public ABI's.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Also change mke2fs so that the encoding and encoding flags are
specified in mke2fs.conf in the fs_types and defaults stanzas instead
of the options stanza.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Merge nls_utf8-norm.c and nls_utf8.c. This also allows us to comment
out functions which we don't actually need for e2fsprogs.
Also fix some gcc -Wall complaints, including one which would have
caused utf8_casefold() to misbehave (this was fixed in the kernel, but
not carried back to e2fsprogs).
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Also remove nls.h, and avoid declaring static functions and variables
in a header file, which is wasteful of space.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
In ext2fs_write_inode2(), the 'old_flags' variable is never used.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
In parse_inode_csum(), the outer 'tmp_inode' variable is never used.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
In ext2fs_dirhash2(), the outer 'buff' variable is never used.
Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Fix the following bugs:
1. 'encoding' and 'hash_flags' are not initialized, causing a segfault.
2. 'hash_flags' incorrectly uses a __bitwise type.
3. The optstring doesn't contain "c" or "e", so the -c and -e options
aren't recognized.
4. The code that handles the -e option always returns.
Fixes: ef733f1a97 ("debugfs: support encoding when printing the file hash")
Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
The way debugfs escapes filenames is ambiguous because a sequence like
M-A can mean either the byte 'A' + 128 == 0xc1 or the three bytes
{'M', '-', 'A'}. Similarly, ^A can mean either the byte
'A' ^ 0x40 == 0x01 or the two bytes {'^', 'A'}.
Fix this and simplify the code by switching to a simpler strategy where
all bytes < 32, all bytes >= 127, and backslash are encoded with C-style
hex escape sequences. E.g., the byte 0xc1 will now be encoded as \xc1
rather than M-A as it was before, while a filename consisting of the
three bytes {'M', '-', 'A'} will continue to be shown as M-A.
I want to fix this mainly because I want to use debugfs to retrieve raw
encrypted filenames for ciphertext verification tests. But this doesn't
work if the returned filenames are ambiguous.
Fixes: 68a1de3df3 ("debugfs: pretty print encrypted filenames in the ls command")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Document the fact that the encoding support is only used by directories
with the +F attribute.
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
As agreed on the kernel side, ext4 will only support utf8 for now, and
not plain ASCII, so we don't need this anymore.
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
As agreed on the new design, even if fname_encoding is enabled,
directories entries who aren't owned by a +F directory will not be
normalized.
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Since we didn't release a kernel version that supports version 11.0.0,
it should be safe to reuse the sb entry for version 12.1.0.
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
The sparse script complained about the following issues in the kernel
version of this script. This patch port the fixes to the userspace
version.
sparse warnings: (new ones prefixed by >>)
>> fs/unicode/utf8-norm.c:41:24: sparse: non-ANSI function declaration
of function 'utf8version_latest'
vim +/utf8version_latest +41 fs/unicode/utf8-norm.c
40
> 41 int utf8version_latest()
42 {
43 return utf8vers;
44 }
45 EXPORT_SYMBOL(utf8version_latest);
46
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Delay the access of data->offset until after the null check. This was
reported by 0-day on the kernel version of the script.
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Following the kernel transition, convert the normalization format from
NFKD to NFD. This also regenerates the utf8data.h database.
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs->encoding is exposed by the library, so we need to at least try to
load it when populating ext2_filsys. Nevertheless, failing to do so
shouldn't be a fatal error, unless the user really needs that
information. Thus, we ignore this failure during open/initialization
and let the user who needs it validate that field before trying to use
it.
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Due to a missing "else" debugfs was printing (garbage) from the xattr
buffer which could potentially overrun the end of the buffer.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This time for real! The test-ea file has three very long xattrs,
description and description2 which are identical and share an inode to
store their value, and description3, which has a different value, and
thus uses another inode for storing its value.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Paul Menzel reported that the e2scrub_all reaper service that runs at
startup takes a long time to run, and Ted Ts'o pointed out that we could
do a lot less work by using lvs as the outer loop in the ext4 filesystem
probe function so that we only have to lsblk the lvm devices containing
ext4 filesystems.
Therefore, refactor the loops to put lvs first, which should boost speed
a bit.
[ Made some of the further optimizations suggested by Lukas Czerner. -- TYT ]
Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
If there isn't, skip the volume so we don't spam the system
administrator with error messages. It's quite commkon that there is
is zero free space in the volume group.
Addresses-Debian-Bug: #924301
Signed-off-by: Theodore Ts'o <tytso@mit.edu>