OSDN Git Service
Darrick J. Wong [Wed, 22 Jul 2015 04:06:43 +0000 (00:06 -0400)]
e2fsck: check htree leaf block checksums
We weren't verifying the checksum of an htree leaf block due to a
coding error that marked all htree blocks as not having checksums.
While we're at it, fix the error message that gets displayed so that
it doesn't print a meaningless block offset.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Thu, 16 Jul 2015 21:19:38 +0000 (17:19 -0400)]
e2fsck: check for encrypted directory entries with too-short file names
If there are directory entries with file names which are less than 16
bytes, it turns out that passing less than the crypto block size to
the kernel's crypto layer will cause the kernel to crash.
However, since there never should be encrypted directory entries where
the file name is less than 16 bytes (the AES block size), change
e2fsck to offer to address this corruption by deleting the directory
entry.
(We need to checks for this condition into the kernel as well.)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Thu, 16 Jul 2015 18:21:22 +0000 (14:21 -0400)]
e2fsck: check for an encrypted lost+found directory
The /lost+found directory must not be encrypted, since e2fsck won't
have any keys. If we find an encrypted lost+found directory, we
should delete the directory and recreate it.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Wed, 15 Jul 2015 03:19:08 +0000 (23:19 -0400)]
android: add add_ext4_encrypt helper program
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 19:36:19 +0000 (15:36 -0400)]
debugfs: cleanup gcc -Wall warnings
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 17:23:28 +0000 (13:23 -0400)]
misc: cleanup gcc -Wall warnings
Also change ext2fs_symlink() so that the target parameter is a const
char *, thus promising that we will never change the incoming string.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 14:58:33 +0000 (10:58 -0400)]
Remove dropped const warning and enable pread/pwrite for Android build
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 14:41:23 +0000 (10:41 -0400)]
create_inode: remove backup definition of __func__
We are using __func__ without any backup definition in the rest of
e2fsprogs, and this is causing warnings in the Android build, so just
remove it.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 13:22:47 +0000 (09:22 -0400)]
Eliminate unused variable and unused label warnings from Android build
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 12:31:51 +0000 (08:31 -0400)]
Eliminate unused parameter warnings from Android build
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 03:09:15 +0000 (23:09 -0400)]
Eliminate unused function warnings from Android build
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 02:54:37 +0000 (22:54 -0400)]
Eliminate doubly defined _LARGEFILE_SOURCE warning
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 02:43:31 +0000 (22:43 -0400)]
Move dict.c from e2fsck to lib/support
The quota code required that we included dict.o in libsupport.a, so we
might as well just move dict.c and dict.h to lib/support, and then
have e2fsck use the version of dict.c in libsupport.a. This
simplifies the build system and eliminates having two identical copies
of dict.o floating around in the build tree.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 01:55:32 +0000 (21:55 -0400)]
Move the check_plausibility() function from misc to lib/support
The check_plausibility() function is now used all over the place, so
we should move the plausible.c file to lib/support and remove the
special case handling for that file that had been in the build system.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 00:44:53 +0000 (20:44 -0400)]
Suppress annoying missing field initializer warnings
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 12 Jul 2015 22:05:40 +0000 (18:05 -0400)]
Move the profile parsing functions from e2fsck to lib/support
The profile functions started as something specific to e2fsck. It's
now used by mke2fs and e2fsck, so it's better to move it into
libsupport.a.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 12 Jul 2015 21:39:26 +0000 (17:39 -0400)]
tune2fs: allow tune2fs to be built as a static library for Android
Sync up with aosp's e2fsprogs commits:
d25948b9b4a9e361ef071dc8175df0407f60b7e0
e59f7c7cedb1e07eb4dbbb66e115c14faea19f19
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 12 Jul 2015 20:59:52 +0000 (16:59 -0400)]
Theodore Ts'o [Sun, 12 Jul 2015 20:56:39 +0000 (16:56 -0400)]
android_config: remove HAVE_TERMIO_H
Sync up with aosp's e2fsprogs commits:
dc351db427e667b9f954c4338f69da83fa16222b
2ca3c65991609bb5b48004ec3c7a66f6b417beed
4ef951aa5e69116963f1836fe5ddcf6b87afbecd
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 12 Jul 2015 03:24:38 +0000 (23:24 -0400)]
Add fallocate.c to lib/exte2fs/Android.mk
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 12 Jul 2015 03:05:57 +0000 (23:05 -0400)]
rename libquota.a to libsupport.a
We will be using libsupport.a for e2fsprogs's internal support
functions. It will contain the quota support functions, but we will
also be moving code such as profile.c and plausible.c to libsupport.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 4 Jul 2015 02:02:30 +0000 (22:02 -0400)]
configure: remove support to disable quota support
For the 1.43 release, quota support will be the default. It's much
simpler if we don't try to make quota support optional. This was done
originally because the quota feature wasn't fully tested. It is now,
so we can remove this as an option.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Fri, 3 Jul 2015 20:29:35 +0000 (16:29 -0400)]
configure: remove support to disable htree support
The presence of --disable-htree is very much a legacy thing. Remove
it since supporting the lack of htree support is pretty silly.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Wed, 1 Jul 2015 23:42:05 +0000 (19:42 -0400)]
configure: only include libuuid and libblkid in AC_OUTPUT if needed
If we are not buildinig the uuid or blkid library, we shouldn't create
the Makefile and other files generated by configure / config.status.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Wed, 1 Jul 2015 23:40:23 +0000 (19:40 -0400)]
Fix "make clean" and "make distclean"
There were some generated files that weren't getting removed by the
clean and distclean targets; fix this.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 22 Jun 2015 00:15:52 +0000 (20:15 -0400)]
libext2fs: fix gcc -Wall nits
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 22 Jun 2015 00:14:32 +0000 (20:14 -0400)]
Revert "debugfs: add the hexdump_block command"
This reverts commit
58b0356a251a6bc7703a482bea5d1fe6766a65c5.
We already have the block_dump (bd) command, but I had completely
forgotten about it. Oops!
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 21 Jun 2015 02:10:10 +0000 (22:10 -0400)]
update config.{guess,sub,rpath} from FSF and gettext
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 21 Jun 2015 02:01:26 +0000 (22:01 -0400)]
Merge branch 'maint' into next
Phillip Susi [Sat, 23 May 2015 20:49:45 +0000 (16:49 -0400)]
tune2fs.8: update maximum journal size
The man page for tune2fs still listed the upper limit for the journal
as 102,400 blocks.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 20 Jun 2015 18:33:24 +0000 (14:33 -0400)]
rename configure.in to configure.ac
Some newer versions of autoconf kvetch if we are still using
configure.in. As of this writing the only version of autoconf which I
support is autoconf 2.69, and if you try to recreate the configure
script which is shipped with e2fsprogs, and it breaks, you get to keep
both pieces.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 20 Jun 2015 18:20:14 +0000 (14:20 -0400)]
configure: use system libraries for blkid and uuid if present
The configure script will now determine if the blkid and uuid
libraries are present (requires that pkg-config and their .pc files
are available).
In addition, enable quota support by default.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 20 Jun 2015 04:10:20 +0000 (00:10 -0400)]
debugfs: add the hexdump_block command
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 20 Jun 2015 02:01:16 +0000 (22:01 -0400)]
Merge branch 'maint' into next
Konstantin Khlebnikov [Sat, 20 Jun 2015 01:54:09 +0000 (21:54 -0400)]
debugfs: fix several errors and add assertions in the set_fields command
Fix copy-n-paste errors:
* remove duplicate "lastcheck" and "min_extra_isize"
* fix pointer for "first_error_line" and "last_error_line"
* remove superblock field "inodes_count" from inode fields
* add null-termination for mmp_fields
Add assertions for catching such errors in the future.
Mark true aliases with flag "FLAG_ALIAS" and suppress assert for them.
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Sat, 20 Jun 2015 01:34:02 +0000 (21:34 -0400)]
mke2fs: prompt for user verification for "-S"
Prompt for user verification before rewriting the filesystem
superblocks using the "-S" (super-only) option. This should
not normally be used at all, so adding the extra verification
will probably save a few user filesystems in the future. Since
this is something that should only be done in rare cases under
user supervision, wait for user input rather than proceeding
automatically after a timeout.
Update the mke2fs man page to more fully explain the many
dangers of this option.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Fri, 22 May 2015 22:40:51 +0000 (16:40 -0600)]
misc: fix alignment warnings on ARM
Some temporary char buffers allocated on the stack are not properly
aligned when typecast to a structure containing __u32 or __u64 types,
and this can cause alignment warnings on ARM and other alignment
sensitive architectures, and potential slowdowns to do fixups.
Fix the buffer alignment to avoid such issues.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=680090
Reported-by: Gordan Bobic <gordan.bobic@gmail.com>
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Sat, 20 Jun 2015 01:31:26 +0000 (21:31 -0400)]
tests: skip large filesystem tests on MacOS
Skip tests that create large filesystem on MacOS, since HFS doesn't
have sparse file support and this causes testing to be uninterruptible
for minutes while mke2fs is writing to some large non-zero offset and
filling up the test filesystem. Since most testing is done on Linux
this shouldn't cause a significant gap in testing coverage.
Tests skipped are d_dumpe2fs_group_only, m_bigjournal, m_hugefile,
t_iexpand_full, t_iexpand_mcsum, and t_uninit_bg_rm.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Fri, 19 Jun 2015 23:28:25 +0000 (19:28 -0400)]
fix diet libc build breaks for e4crypt and fallocate
Diet libc doesn't support syscall correctly, but it does have
add_key() and keyctl() in libc (although glibc does not). So change
e4crypt to use add_key() and keyctl() directly if they are available.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Fri, 19 Jun 2015 22:14:33 +0000 (18:14 -0400)]
e2fsck: skip checking the journal fields if the file system is mounted
When a file system with journal checksums is mounted, the journal
checksum is only updated when the journal superblock is actually
written to disk. But when a root file system is mounted read-only,
e2fsck will get the in-memory version of the journal superblock, and
the checksum is not necessarily going to be correct. Since we only
allow the root file system to be checked while it is mounted
read-only, and we won't be trying to replay the journal anyway. So we
can skip the checking the journal superblock fields for mounted file
systems.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 16 Jun 2015 03:16:24 +0000 (23:16 -0400)]
Merge branch 'maint' into next
Theodore Ts'o [Mon, 15 Jun 2015 19:22:01 +0000 (15:22 -0400)]
misc: fix bugs which broke misc/Makefile.in's "make depend"
This resulted in the build failing when building e2fsprogs from
scratch.
Reported-by: "Darrick J. Wong" <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Richard Yao [Sun, 14 Jun 2015 18:50:53 +0000 (14:50 -0400)]
misc: remove broken whole device check
Modern Linux major/minor numbering on block devices no longer conform to
the divisible by 64 rule for minor numbering. On my development system,
the correct number is 16. Consequently, this applies only to every 4th
drive on a modern system, which is inconsistent. That caused the
following bug to be filed against Flocker:
https://clusterhq.atlassian.net/browse/FLOC-2041
We could unconditionally pass -F to override this check whenever it
triggers, but that it would also override the libblkid check that
determines whether there are existing partitions, logical volumes or
filesystems on the disk, which seems unwise.
I propose that this check be removed because passing a whole disk to
mke2fs is a valid use case and given how long this has been broken,
users are already accustomed to the behavior where -F is not necessary
to format a whole disk as ext4.
Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Theodore Ts'o [Thu, 11 Jun 2015 02:52:48 +0000 (22:52 -0400)]
e4crypt: fix hexidecimal salt parsing
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Thu, 11 Jun 2015 00:08:33 +0000 (20:08 -0400)]
libext2fs: remove unnecessary undo file flush calls
Remove all flushes of the undo file except for the one that happens just
prior to the file being closed; it seems that the arbitrary flushes
aren't sufficiently useful.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Thu, 14 May 2015 00:22:40 +0000 (17:22 -0700)]
misc: add fuse2fs, a FUSE server for e2fsprogs
This is the initial implementation of a FUSE server based on
e2fsprogs. The point of this program is to enable ext4 to run on any
OS that FUSE supports (and doesn't already have a native driver), such
as MacOS X, BSDs, and Windows. The code requires FUSE API v28, which
is available in Linux fuse and osxfuse releases that are available as
of August 2013.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Thu, 11 Jun 2015 00:02:39 +0000 (20:02 -0400)]
tests: test debugfs punch command
Test punching out various parts of sparse files.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Thu, 11 Jun 2015 00:01:24 +0000 (20:01 -0400)]
debugfs: implement fallocate
Implement a fallocate function for debugfs, and add some tests to
demonstrate that it works (more or less).
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Wed, 10 Jun 2015 23:57:50 +0000 (19:57 -0400)]
libext2fs: use fallocate for creating journals and hugefiles
Use the new fallocate API for creating the journal and the mk_hugefile
feature.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Wed, 10 Jun 2015 23:56:43 +0000 (19:56 -0400)]
libext2fs: implement fallocate
Create a library function to perform fallocation on arbitrary files.
This is a bit more intense than Ted's original mk_hugefiles
implementation since we have to honor any blocks that may already be
allocated to the file.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Wed, 10 Jun 2015 18:13:25 +0000 (14:13 -0400)]
libext2fs: add new hooks to support large allocations
Add a new get_alloc_blocks hook and a block_alloc_stats_range hook so
that e2fsck can capture allocation requests spanning more than a
block to its block_found_map.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 26 May 2015 02:27:47 +0000 (22:27 -0400)]
Add fsstress to contrib so it can be built for use in Android
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 26 May 2015 02:26:20 +0000 (22:26 -0400)]
Allow debugfs to be built for use in Android
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 26 May 2015 02:18:43 +0000 (22:18 -0400)]
libext2fs: fix ext2fs_close() when MMP is not enabled
If MMP support is not configured, then ext2fs_mmp_stop() will always
return the error EXT2_ET_OP_NOT_SUPPORTED. Unfortunately,
ext2fs_close() and tune2fs call ext2fs_mmp_stop() unconditionally. So
if the file system does not have MMP enabled, fix ext2fs_mmp_stop() to
return success even if CONFIG_MMP is not enabled, so that
ext2fs_close() and tune2fs doesn't fail for no good reason.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 25 May 2015 23:29:34 +0000 (19:29 -0400)]
libext2fs, libe2p, misc: git rid of jfs_user.h
Having multiple versions of jfs_user.h was confusing the Android
build. Clean up things by removing the lib/ext2fs/jfs_user.h and
misc/jfs_user.h and simplifying how we emulate the kernel
infrastructure needed by journal replay code and removing the
kernel-specific lines from kernel-jbd.h.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 23 May 2015 22:09:33 +0000 (18:09 -0400)]
Update Android build files so the 1.43 branch builds on AOSP
Recent changes in the 1.43 branch as well as the latest AOSP caused
the Android build to break; fix them.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Eric Sandeen [Sat, 23 May 2015 22:39:04 +0000 (18:39 -0400)]
e2fsprogs: use $DUMPE2FS in resize_test script
Use $DUMPE2FS in resize tests to be sure it's testing
the in-tree dumpe2fs, not the system dumpe2fs (which may
not even be there...)
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 23 May 2015 22:08:35 +0000 (18:08 -0400)]
e2fsck,misc: include ext2fs.h to avoid clang warnings
e2fsck/dirinfo.c and misc/e4crypt.c use functions from libext2fs, so
we need to include its header file or clang will complain.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 18 May 2015 14:41:27 +0000 (10:41 -0400)]
debian: update e2fslibs.symbols for 1.43-WIP release
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 18 May 2015 06:15:56 +0000 (02:15 -0400)]
Merge branch 'maint' into next
Theodore Ts'o [Mon, 18 May 2015 06:14:55 +0000 (02:14 -0400)]
debian: remove trailing spaces from control.in file
This were causing lintian failures.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 18 May 2015 05:57:30 +0000 (01:57 -0400)]
Update release notes for a 1.43-WIP release (18-May-2015)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 18 May 2015 05:49:00 +0000 (01:49 -0400)]
mke2fs: enable the metadata_csum and 64bit features by default
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 18 May 2015 01:58:28 +0000 (21:58 -0400)]
Merge branch 'maint' into next
Theodore Ts'o [Mon, 18 May 2015 01:10:07 +0000 (21:10 -0400)]
Update release notes, etc. for final 1.42.13 release
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 18 May 2015 01:25:45 +0000 (21:25 -0400)]
Merge remote-tracking branch 'origin/maint' into maint
Theodore Ts'o [Mon, 18 May 2015 00:34:58 +0000 (20:34 -0400)]
Update translation template file
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 18 May 2015 00:27:50 +0000 (20:27 -0400)]
Add the Danish translation file from the Translation Project
The Danish translation is now up to 829/1317 messages, which is much
better than it had been before, and better than some of the current
translations which we are including in the e2fsprogs distribution.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Antonio Ceballos [Mon, 18 May 2015 00:21:40 +0000 (20:21 -0400)]
po: update es.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Benno Schulenberg [Mon, 18 May 2015 00:21:39 +0000 (20:21 -0400)]
po: update eo.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Philipp Thomas [Mon, 18 May 2015 00:21:39 +0000 (20:21 -0400)]
po: update de.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Àngel Mompó [Mon, 18 May 2015 00:21:39 +0000 (20:21 -0400)]
po: update ca.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 17 May 2015 19:06:45 +0000 (15:06 -0400)]
create_inode: handle source symlinks with extended attributes
We need to use lgetxattr(2) instead of getxattr(2) or attempts to
create file systems with extended attributes will fail:
set_inode_xattr: No data available while reading attribute "trusted.link" of "link"
__populate_fs: No data available while setting xattrs for "link"
mke2fs: No data available while populating file system
Reported-by: Jack_Fewx@Dell.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 17 May 2015 04:15:12 +0000 (00:15 -0400)]
tests: clean up the script for m_hugefile_slack
This test doesn't require resize2fs or debugfs, so remove those
checks.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 17 May 2015 04:14:51 +0000 (00:14 -0400)]
tests: test creating a single huge file using mke2fs -T hugefile
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sun, 17 May 2015 00:56:32 +0000 (20:56 -0400)]
libext2fs: find/alloc a range of empty blocks
Provide a function that, given a goal pblk and a range, will try to
find a run of free blocks to satisfy the allocation. By default the
function will look anywhere in the filesystem for the run, though this
can be constrained with optional flags. One flag indicates that the
range must start at the goal block; the other flag indicates that we
should not return a range shorter than len.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sun, 17 May 2015 00:54:29 +0000 (20:54 -0400)]
libext2fs: support allocating uninit blocks in bmap2()
As part of supporting fallocate-like functionality, extend
ext2fs_bmap() with two flags -- BMAP_UNINIT and BMAP_ZERO. The first
will cause it to mark/set a block uninitialized, if it's part of an
extent based file. For a block mapped file, the mapping is put in,
but there is no way to remember the uninitialized status. The second
flag causes the block to be zeroed to support the use case of
emulating uninitialized blocks on a block-map file by zeroing them.
Eventually fallocate or fuse2fs or somebody will use these.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sun, 17 May 2015 00:51:40 +0000 (20:51 -0400)]
e2fsck: convert block-mapped files to extents on bigalloc fs
As of v4.0, the Linux kernel won't add blocks to a block-mapped file
on a bigalloc filesystem. Therefore, convert any such files or
directories we find, to prevent fs errors later on.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sun, 17 May 2015 00:50:21 +0000 (20:50 -0400)]
e2fsck: fix buffer overrun in revoke block scanning
Check the value of r_count to ensure that we never try to read revoke
records past the end of the revoke block. It turns out that the
journal writing code in debugfs was also playing fast and loose with
the r_count, so fix that as well.
The Coverity bug was
1297508.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sun, 17 May 2015 00:22:43 +0000 (20:22 -0400)]
filefrag: fix broken extent emulation and uninitialized variables
This started with the fm_ext being uninitialized, but upon closer
analysis I discovered that forcing extent emulation in FIBMAP mode
was reporting an extent for every block in the file. Fix both
problems.
The Coverity bug was
1297512.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sun, 17 May 2015 00:19:52 +0000 (20:19 -0400)]
misc: fix undo file setup
Fix Coverity bugs
1297094-
1297101 by fixing all the mutations in the
*_setup_tdb() functions, fixing buffer overflows, and checking
return values.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sat, 16 May 2015 23:52:06 +0000 (19:52 -0400)]
undo-io: write out index block after every write
Write out the undo file's index block after writing a block to the
undo file. This ensures that we always have a consistent undo file
in the page cache, even if the program crashes. When we fill up a
key block in the undo file, we'll call fsync to force the whole
thing to storage; this should happen about every 256 blocks given
the usual 4K block size.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sat, 16 May 2015 22:32:33 +0000 (18:32 -0400)]
misc: fix Coverity bugs
Fix Coverity bugs
1297093,
1297096,
1297489,
1297491,
1297493,
1297506,
1297507,
1297514,
1297516, and
1297517.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Tue, 5 May 2015 14:52:12 +0000 (10:52 -0400)]
contrib: script to create minified ext4 image from a directory
The dir2fs script converts a directory into a minimized ext4 filesystem.
FS creation parameters are tweaked to reduce as much FS overhead as
possible, and to leave as few unused blocks and inodes as possible.
Given that mke2fs -d lays out files linearly from the beginning of the
FS, using resize2fs -M is not as horrible as it usually is.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Tue, 5 May 2015 14:52:01 +0000 (10:52 -0400)]
mke2fs: add simple tests and re-alphabetize mke2fs manpage options
Add some simple tests for mke2fs -d (create image from dir) and make
the manpage options appear in alphabetic order.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Tue, 5 May 2015 14:51:02 +0000 (10:51 -0400)]
copyin: fix error handling
Save errno (in retval) before doing anything else, because the
"anything else" (usually com_err()) can call library functions, which
will reset errno.
Fix the error messages to use the message catalog, and don't _ever_
print an error without providing context.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Tue, 5 May 2015 14:46:48 +0000 (10:46 -0400)]
copy-in: for files, only iterate file blocks that are mapped
Rewrite the file copy-in algorithm to detect smaller holes in the
files we're copying in. Use SEEK_DATA/SEEK_HOLE/FIEMAP when available
to skip known empty parts. This fixes the particular bug where zeroed
blocks on a system with 64k pages are needlessly copied into a
4k-block filesystem. It also saves time by skipping parts we know to
be zeroed.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Tue, 5 May 2015 14:46:06 +0000 (10:46 -0400)]
copy-in: create hardlinks with the correct directory filetype
When we're creating hard links via ext2fs_link, the (misnamed?) flags
argument specifies the filetype for the directory entry. This is
*derived* from i_mode, so provide a translator. Otherwise, fsck will
complain about unset file types.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Tue, 5 May 2015 14:42:23 +0000 (10:42 -0400)]
tests: test various features of the new e2undo format
Verify that the header, checksum, and wrong-order rollback detection
features of the new e2undo actually work.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Tue, 5 May 2015 14:42:08 +0000 (10:42 -0400)]
tests: test undo file creation in e2fsck/resize2fs/tune2fs/mke2fs
Regression tests to ensure that we can create undo files and roll
things back if need be.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Tue, 5 May 2015 14:41:52 +0000 (10:41 -0400)]
debugfs: optionally create undo file
Provide the user with an option to create an undo file so that they
can roll back a failed debugfs expedition.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Tue, 5 May 2015 14:41:23 +0000 (10:41 -0400)]
mke2fs: optionally create undo file
Provide the user with an option to create an undo file so that they
can roll back a failed tuning operation. Previously, one would be
created if force_undo was set in the configuration file and a bunch of
(undocumented) conditions were met.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Tue, 5 May 2015 14:41:08 +0000 (10:41 -0400)]
tune2fs: optionally create undo file
Provide the user with an option to create an undo file so that they
can roll back a failed tuning operation. Previously, one would be
created for inode resize if a bunch of (undocumented) conditions were
met.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Tue, 5 May 2015 14:40:53 +0000 (10:40 -0400)]
resize2fs: optionally create undo file
Provide the user with an option to create an undo file so that they
can roll back a failed resize operation.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Tue, 5 May 2015 14:40:37 +0000 (10:40 -0400)]
e2fsck: optionally create an undo file
Provide the user with an option to create an undo file so that they
can roll back a failed repair operation.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Tue, 5 May 2015 14:40:21 +0000 (10:40 -0400)]
libext2fs: support atexit cleanups
Use the atexit() function to provide a means for the library to clean
itself up on program exit. This will be used by the undo IO manager
to flush the undo file state to disk if the program should terminate
without closing the io channel, since most e2fsprogs clients will
simply exit() when they hit errors.
This won't help for signal termination; client programs must set
up signal handlers.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Tue, 5 May 2015 14:39:55 +0000 (10:39 -0400)]
e2undo: ditch tdb file, write everything to a flat file
The existing undo file format (which is based on tdb) has many
problems. First, its comparison of superblock fields is ineffective,
since the last mount time is only written by the kernel, not the tools
(which means that undo files can be applied out of order, thus
corrupting the filesystem); block numbers are written in CPU byte
order, which will cause silent failures if an undo file is moved from
one type of system to another; using the tdb database costs us an
enormous amount of CPU overhead to maintain the key data structure,
and finally, the tdb database is unable to deal with databases larger
than 2GB. (Upstream tdb 1.2.12 can handle 4GB, but upgrading a 2TB FS
to 64bit,metadata_csum easily produces 2.9GB of undo files, so we
might as well move off of tdb now.)
The last problem is fatal if you want to use tune2fs to turn on
metadata checksumming, since that rewrites every block on the
filesystem, which can easily produce a many-gigabyte undo file, which
of course is unreadable and therefore the operation cannot be undone.
Therefore, rip all of that out in favor of writing to a flat file.
Old blocks are appended to a file and the index is written to the end
when we're done. This implementation is much faster than wasting a
considerable amount of time trying to maintain a hash index, which
drops the runtime overhead of tune2fs -O metadata_csum from ~45min
to ~20 seconds on a 2TB filesystem.
I have a few reasons that factored in my decision not to repurpose the
jbd2 file format for undo files. First, undo files are limited to
2^32 blocks (16TB) which some day might not serve us well. Second,
the journal block size is tied to the file system block size, but
mke2fs wants to be able to back up big chunks of old device contents.
This would require large changes to the e2fsck journal replay code,
which itself is derived from the kernel jbd2 driver, which I'd rather
not destabilize. Third, I want to require undo files to store the FS
superblock at the end of undo file creation so that e2undo can be
reasonably sure that an undo file is supposed to apply against the
given block device, and doing so would require changes to the jbd2
format. Fourth, it didn't seem like a good idea that external
journals should resemble undo files so closely.
v2: Provide a state bit that is only set when the undo channel is
closed correctly so we can warn the user about potentially incomplete
undo files. Straighten out the superblock handling so that undo files
won't be confused for real ext* FS images. Record multi-block runs in
each block key to reduce overhead even further. Support reopening an
undo file so that we can combine multiple FS operations into one
(overall smaller) transaction file, which will be easier to manage.
Flush the undo index data if the program should terminate
unexpectedly. Update the ext4 superblock bits if errors or -f is
found to encourage fsck to do a full run the next time it's invoked.
Enable undoing the undo.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Tue, 5 May 2015 14:39:38 +0000 (10:39 -0400)]
e2undo: fix memory leaks and tweak the error messages somewhat
Fix memory leaks and improve the error messages to make it easier
to figure out why e2undo went wrong.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Tue, 5 May 2015 14:39:19 +0000 (10:39 -0400)]
undo-io: use a bitmap to track what we've already written
It's really inefficient to (ab)use the TDB key store as a bitmap to
find out if we've already written a block to the undo file, because
the tdb code is reads the database key btree disk blocks for *every*
query. Changing that logic to a bitmap reduces overhead by a large
margin -- the overhead of using undo_io while converting a 2TB FS to
metadata_csum is reduced from 55 minutes to 45.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Tue, 5 May 2015 14:38:49 +0000 (10:38 -0400)]
undo-io: be more flexible about setting block size
Most of the e2fsprogs utilities set the IO block size multiple times
(once to 1k to read the superblock, then again to set the real block
size if we find a real superblock). Unfortunately, the undo IO
manager only lets the block size be set once. For the non-mke2fs
utilities we'd rather catch the real block size and use that. mke2fs
of course wants to use a really large block size since it's probably
writing a lot of data.
Therefore, if we haven't written any blocks to the undo file, it's
perfectly fine to allow block size changes. For mke2fs, we'll modify
the IO channel option that lets us set the huge size to lock that
in place. This greatly reduces index overhead for undo files for
e2fsck/tune2fs/resize2fs while continuing the practice of reducing
it even more for mke2fs.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>