Whamcloud - gitweb
tools/e2fsprogs.git
8 years agoMerge branch 'maint' into next
Theodore Ts'o [Mon, 30 Nov 2015 23:16:36 +0000 (18:16 -0500)]
Merge branch 'maint' into next

8 years agoe2fsck: fix e2fsck -fD directory truncation
Andreas Dilger [Mon, 30 Nov 2015 20:26:35 +0000 (15:26 -0500)]
e2fsck: fix e2fsck -fD directory truncation

When an extent-mapped directory is compacted by "e2fsck -fD" and
frees enough leaf blocks that it loses an extent tree index block,
the old e2fsck_rehash_dir->ext2fs_block_iterate3->write_dir_block()
code would not free the extent block, which would result in the
extent tree becoming corrupted when it is written out.

    Pass 1: Checking inodes, blocks, and sizes
    Inode 17825800, end of extent exceeds allowed value
            (logical block 710, physical block 570459684, len 1019)

This results in loss of a whole index block of directory leaf blocks
and maybe thousands or millions of files in lost+found.

Fix e2fsck_rehash_dir() to call ext2fs_punch() to free the blocks
at the end of the directory instead of trying to handle this itself
while writing out the directory.  That properly handles all of the
cases of updating the extent tree as well as accounting for blocks
that are released (both leaf blocks and index blocks).

Add a test case for compacting the directory to be smaller than the
index block that originally caused the corruption.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibext2fs: fix block-mapped file punch
Andreas Dilger [Mon, 30 Nov 2015 20:26:21 +0000 (15:26 -0500)]
libext2fs: fix block-mapped file punch

If ext2fs_punch() was called with "end = ~0ULL" to indicate truncate
to the end of file it tried to compute "count" for ext2fs_punch_ind()
based on "start" and "end", but incorrectly passed "count = ~0U" even
when "start" was non-zero, causing an overflow in some cases.

The calling convention for ext2fs_punch_ind() was also gratuitously
different from ext2fs_punch() and ext2fs_punch_extent(), passing
"count" instead of "end" as the last parameter.  Fix this by passing
it "end" like the other functions, and handle "count" internally.

Add checks to ext2fs_punch_ind() if "end" is at or beyond the 2^32
indirect block limit so the 32-bit internal variables don't overflow.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoe2fsck: zap extent-format inode with no extent header
Darrick J. Wong [Mon, 30 Nov 2015 20:22:07 +0000 (15:22 -0500)]
e2fsck: zap extent-format inode with no extent header

The kernel requires all inodes with the extent flag set to have a
valid extent tree header in i_block.  The ext2fs_extent_open2 prefers
to initialize the header if i_block is zeroed, but e2fsck never writes
the new header to disk.  Since the kernel won't create inodes with the
flag and no header anyway, zap such files.

Reported-by: Bo Branten <bosse@acc.umu.se>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agotune2fs: warn if the filesystem journal is dirty
Jim Garlick [Mon, 30 Nov 2015 17:13:39 +0000 (12:13 -0500)]
tune2fs: warn if the filesystem journal is dirty

Running tune2fs on a filesystem with an unrecovered journal can
cause the tune2fs settings changes in the superblock to be reverted
when the journal is replayed if it contains an uncommitted copy of
the superblock.  Print a warning if this is detected so that the
user isn't surprised if it happens.

Signed-off-by: Jim Garlick <garlick@llnl.gov>
Updated message printed to include steps to replay journal.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibext2fs: fix tst_badblocks buffer overrun
Andreas Dilger [Mon, 30 Nov 2015 17:09:44 +0000 (12:09 -0500)]
libext2fs: fix tst_badblocks buffer overrun

The test2[] array is not 0-terminated and the create_test_list() for
loop does not terminate properly at the end of this array, but
continues until it hits the 0 at the end of test3[].

Reported-by: Hanno Boeck <hanno@hboeck.de>
Addresses: https://bugzilla.kernel.org/show_bug.cgi?id=104311
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoe2fsck: do not read EA header beyond the end of an inode
Artemiy Volkov [Mon, 30 Nov 2015 17:03:52 +0000 (12:03 -0500)]
e2fsck: do not read EA header beyond the end of an inode

In check_inode_extra_space(), if we attempt to read an EA header at
the end of the extra space, in a corrupted filesystem it may result in
a read beyond the bounds of the inode. Add a check to prevent this.

Reproduced by running ./test_one --valgrind f_write_ea_toobig_extra_isize.

Signed-off-by: Artemiy Volkov <artemiyv@acm.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Acked-by: Darrick J. Wong <darrick.wong@oracle.com>
8 years agochattr: fix typo in a manpage
Jan Kara [Mon, 30 Nov 2015 16:56:55 +0000 (11:56 -0500)]
chattr: fix typo in a manpage

Signed-off-by: Jan Kara <jack@suse.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agodebugfs: add support to properly set and display extended timestamps
Theodore Ts'o [Mon, 9 Dec 2013 18:55:23 +0000 (13:55 -0500)]
debugfs: add support to properly set and display extended timestamps

This code is partially derived from patches from David Turner to allow
debugfs to properly support extended timestamps.

Cc: David Turner <novalis@novalis.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
8 years agoe2fsck: skip quota update when interrupted
Andreas Dilger [Sat, 14 Nov 2015 01:10:27 +0000 (18:10 -0700)]
e2fsck: skip quota update when interrupted

There is a bug in how e2fsck handles being interrupted by CTRL-C.
If CTRL-C is pressed to kill e2fsck rather than e.g. kill -9, then
the interrupt handler sets E2F_FLAG_CANCEL in the context but doesn't
actually kill the process.  Instead, e2fsck_pass1() checks this flag
before processing the next inode.

If a filesystem is running in fix mode (e2fsck -fy) is interrupted,
and the quota feature is enabled, then the quota file will still be
written to disk even though the inode scan was not complete and the
quota information is totally inaccurate.  Even worse, if the Pass 1
inode and block scan was not finished, then the in-memory block
bitmaps (which are used for block allocation during e2fsck) are also
invalid, so any blocks allocated to the quota files may corrupt other
files if those blocks were actually used.

  e2fsck 1.42.13.wc3 (28-Aug-2015)
  Pass 1: Checking inodes, blocks, and sizes
  ^C[QUOTA WARNING] Usage inconsistent for ID 0:
      actual (6455296, 168) != expected (8568832, 231)
  [QUOTA WARNING] Usage inconsistent for ID 695:
      actual (614932320256, 63981) != expected (2102405386240, 176432)
  Update quota info for quota type 0? yes

  [QUOTA WARNING] Usage inconsistent for ID 0:
      actual (6455296, 168) != expected (8568832, 231)
  [QUOTA WARNING] Usage inconsistent for ID 538:
      actual (614932320256, 63981) != expected (2102405386240, 176432)
  Update quota info for quota type 1? yes

  myth-OST0001: e2fsck canceled.
  myth-OST0001: ***** FILE SYSTEM WAS MODIFIED *****

There may be a desire to flush out modified inodes and such that have
been repaired, so that restarting an interrupted e2fsck will make
progress, but the quota file update is plain wrong unless at least
pass1 has finished, and the journal recreation is also dangerous if
the block bitmaps have not been fully updated.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibext2fs: fix parents when modifying extents
Darrick J. Wong [Sat, 15 Mar 2014 15:36:34 +0000 (11:36 -0400)]
libext2fs: fix parents when modifying extents

In ext2fs_extent_set_bmap() and ext2fs_punch_extent(), fix the parents
when altering either end of an extent so that the parent nodes reflect
the added mapping.

There's a slight complication to using fix_parents: if there are two
mappings to an lblk in the tree, the value of handle->path->curr can
point to either extent afterwards), which is documented in a comment.

Some additional color commentary from Darrick:

  In the _set_bmap() case, I noticed that the "remapping last block in
  extent" case would produce symptoms if we are trying to remap a
  block from "extent" to "next_extent", and the two extents are
  pointed to by different index nodes.  _extent_replace(...,
  next_extent) updates e_lblk in the leaf extent, but because there's
  no _extent_fix_parents() call, the index nodes never get updated.

  In the _punch_extent() case, we conclude that we need to split an
  extent into two pieces since we're punching out the middle.  If the
  extent is the last extent in the block, the second extent will be
  inserted into a new leaf node block.  Without _fix_parents(), the
  index node doesn't seem to get updated.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
8 years agomake2fs: parse a human readable inode ratio for the -i option
Matthieu Dupont [Sun, 15 Nov 2015 15:24:54 +0000 (16:24 +0100)]
make2fs: parse a human readable inode ratio for the -i option

Signed-off-by: Matthieu Dupont <matt.59491@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agodebugfs: clean up feature test macros with predicate functions
Darrick J. Wong [Sat, 24 Oct 2015 05:26:35 +0000 (01:26 -0400)]
debugfs: clean up feature test macros with predicate functions

Create separate predicate functions to test/set/clear feature flags,
thereby replacing the wordy old macros.  Furthermore, clean out the
places where we open-coded feature tests.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoresize2fs: clean up feature test macros with predicate functions
Darrick J. Wong [Sat, 24 Oct 2015 05:23:30 +0000 (01:23 -0400)]
resize2fs: clean up feature test macros with predicate functions

Create separate predicate functions to test/set/clear feature flags,
thereby replacing the wordy old macros.  Furthermore, clean out the
places where we open-coded feature tests.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agomisc: clean up feature test macros with predicate functions
Darrick J. Wong [Sat, 24 Oct 2015 05:23:01 +0000 (01:23 -0400)]
misc: clean up feature test macros with predicate functions

Create separate predicate functions to test/set/clear feature flags,
thereby replacing the wordy old macros.  Furthermore, clean out the
places where we open-coded feature tests.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoe2fsck: clean up feature test macros with predicate functions
Darrick J. Wong [Sat, 24 Oct 2015 04:43:19 +0000 (00:43 -0400)]
e2fsck: clean up feature test macros with predicate functions

Create separate predicate functions to test/set/clear feature flags,
thereby replacing the wordy old macros.  Furthermore, clean out the
places where we open-coded feature tests.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibext2fs: clean up feature test macros with predicate functions
Darrick J. Wong [Sat, 24 Oct 2015 04:34:09 +0000 (00:34 -0400)]
libext2fs: clean up feature test macros with predicate functions

Create separate predicate functions to test/set/clear feature flags,
thereby replacing the wordy old macros.  Furthermore, clean out the
places where we open-coded feature tests.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibext2fs: automatically enable meta_bg to avoid filling up BG 0
Darrick J. Wong [Sat, 24 Oct 2015 04:30:02 +0000 (00:30 -0400)]
libext2fs: automatically enable meta_bg to avoid filling up BG 0

If during formatting we'd lose more than 75% a block group to group
descriptors and other metadata, enable the meta_bg feature.  This
enables us to create >500T filesystems with default options.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibext2fs: fix maximum bg overhead calculation with meta_bg enabled
Darrick J. Wong [Sat, 24 Oct 2015 04:24:57 +0000 (00:24 -0400)]
libext2fs: fix maximum bg overhead calculation with meta_bg enabled

When meta_bg is enabled at mkfs time, we put at most one group
descriptor block in each blockgroup.  Unfortunately, the calculation
of max overhead per bg doesn't know this, so mkfs fails when it isn't
strictly necessary.  Fix it, since Dave reported that he couldn't
create a 500TB ext4 filesystem.

Reported-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoMerge remote-tracking branch 'origin/maint' into next
Theodore Ts'o [Tue, 29 Sep 2015 14:26:16 +0000 (10:26 -0400)]
Merge remote-tracking branch 'origin/maint' into next

8 years agosubst: work around an NFS bug
Theodore Ts'o [Sat, 19 Sep 2015 01:37:53 +0000 (21:37 -0400)]
subst: work around an NFS bug

When running on NFS, opening files with 0444 perms for writing can
sometimes fail.  This is arguably an NFS server bug, but work around
it by creating the file with 0644 permissions, and only change the
permissions to be 0444 right before we close the file.

URL: https://bugs.gentoo.org/550986
Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoFix typo in the ext4(5) man page
Theodore Ts'o [Wed, 9 Sep 2015 14:53:49 +0000 (10:53 -0400)]
Fix typo in the ext4(5) man page

Addresses-Debian-Bug: #798425

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agotune2fs: allow changing the UUID mounted file systems with the -f option
Theodore Ts'o [Sun, 6 Sep 2015 02:21:35 +0000 (22:21 -0400)]
tune2fs: allow changing the UUID mounted file systems with the -f option

There are times when it is necessary to update the UUID on a mounted
root file system (for example).  So when we add this this safety check
to e2fsprogs 1.43, we will likely break some scripts.  Allow the -f
option to force an override of this safety check.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoe4defrag: fix build failure if libc doesn't have sync_file_range()
Theodore Ts'o [Sun, 6 Sep 2015 02:18:29 +0000 (22:18 -0400)]
e4defrag: fix build failure if libc doesn't have sync_file_range()

The posix_fadvise() to hint to the system that the file can be removed
from memory will probably not work well without the sync_file_range(2)
call, but e4defrag should still fundamentally work, and this will
allow e4defrag to compile if the C library doesn't happen this system
call exposed.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoandroid: be able to build dumpe2fs, lsattr, and e2fsck statically
Theodore Ts'o [Thu, 23 Jul 2015 16:46:42 +0000 (12:46 -0400)]
android: be able to build dumpe2fs, lsattr, and e2fsck statically

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoMerge branch 'maint' into next
Theodore Ts'o [Wed, 22 Jul 2015 04:18:14 +0000 (00:18 -0400)]
Merge branch 'maint' into next

8 years agodebugfs: handle out of memory condition
Tobias Stoeckmann [Mon, 20 Jul 2015 14:52:28 +0000 (10:52 -0400)]
debugfs: handle out of memory condition

If malloc fails, properly handle the error condition.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoutil: avoid off-by-one on long symlinks
Tobias Stoeckmann [Mon, 20 Jul 2015 14:42:40 +0000 (10:42 -0400)]
util: avoid off-by-one on long symlinks

readlink does not nul terminate its result, therefore one extra byte
has to be taken into account.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoe2fsck: check htree leaf block checksums
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>
8 years agoe2fsck: check for encrypted directory entries with too-short file names
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>
8 years agoe2fsck: check for an encrypted lost+found directory
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>
8 years agoandroid: add add_ext4_encrypt helper program
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>
8 years agodebugfs: cleanup gcc -Wall warnings
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>
8 years agomisc: cleanup gcc -Wall warnings
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>
8 years agoRemove dropped const warning and enable pread/pwrite for Android build
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>
8 years agocreate_inode: remove backup definition of __func__
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>
8 years agoEliminate unused variable and unused label warnings from Android build
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>
8 years agoEliminate unused parameter warnings from Android build
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>
8 years agoEliminate unused function warnings from Android build
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>
8 years agoEliminate doubly defined _LARGEFILE_SOURCE warning
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>
8 years agoMove dict.c from e2fsck to lib/support
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>
8 years agoMove the check_plausibility() function from misc to lib/support
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>
8 years agoSuppress annoying missing field initializer warnings
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>
8 years agoMove the profile parsing functions from e2fsck to lib/support
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>
8 years agotune2fs: allow tune2fs to be built as a static library for Android
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>
8 years agogen-android-files: implement 'Add MODULE_LICENSE and NOTICE files"
Theodore Ts'o [Sun, 12 Jul 2015 20:59:52 +0000 (16:59 -0400)]
gen-android-files: implement 'Add MODULE_LICENSE and NOTICE files"

Sync up with aosp's e2fsprogs commits:

    e1b2879841453d799dc6077f857c5c9db5e83fee
    e64b83185148d359b9b6cc1310172a3c213a61fb
    b823193090c770fe79507df2413a825250b1dcd2
    9652dd6589d10675573c9a0acc90f6df5ac33397
    a5f85097aed09890d03dba31f9d18db75ce50cd7

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoandroid_config: remove HAVE_TERMIO_H
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>
8 years agoAdd fallocate.c to lib/exte2fs/Android.mk
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>
8 years agorename libquota.a to libsupport.a
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>
8 years agoconfigure: remove support to disable quota support
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>
8 years agoconfigure: remove support to disable htree support
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>
8 years agoconfigure: only include libuuid and libblkid in AC_OUTPUT if needed
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>
8 years agoFix "make clean" and "make distclean"
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>
8 years agolibext2fs: fix gcc -Wall nits
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>
8 years agoRevert "debugfs: add the hexdump_block command"
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>
8 years agoupdate config.{guess,sub,rpath} from FSF and gettext
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>
8 years agoMerge branch 'maint' into next
Theodore Ts'o [Sun, 21 Jun 2015 02:01:26 +0000 (22:01 -0400)]
Merge branch 'maint' into next

8 years agotune2fs.8: update maximum journal size
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>
8 years agorename configure.in to configure.ac
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>
8 years agoconfigure: use system libraries for blkid and uuid if present
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>
8 years agodebugfs: add the hexdump_block command
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>
8 years agoMerge branch 'maint' into next
Theodore Ts'o [Sat, 20 Jun 2015 02:01:16 +0000 (22:01 -0400)]
Merge branch 'maint' into next

8 years agodebugfs: fix several errors and add assertions in the set_fields command
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>
8 years agomke2fs: prompt for user verification for "-S"
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>
8 years agomisc: fix alignment warnings on ARM
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>
8 years agotests: skip large filesystem tests on MacOS
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>
8 years agofix diet libc build breaks for e4crypt and fallocate
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>
8 years agoe2fsck: skip checking the journal fields if the file system is mounted
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>
8 years agoMerge branch 'maint' into next
Theodore Ts'o [Tue, 16 Jun 2015 03:16:24 +0000 (23:16 -0400)]
Merge branch 'maint' into next

8 years agomisc: fix bugs which broke misc/Makefile.in's "make depend"
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>
8 years agomisc: remove broken whole device check
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>
8 years agoe4crypt: fix hexidecimal salt parsing
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>
8 years agolibext2fs: remove unnecessary undo file flush calls
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>
8 years agomisc: add fuse2fs, a FUSE server for e2fsprogs
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>
8 years agotests: test debugfs punch command
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>
8 years agodebugfs: implement fallocate
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>
8 years agolibext2fs: use fallocate for creating journals and hugefiles
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>
8 years agolibext2fs: implement fallocate
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>
8 years agolibext2fs: add new hooks to support large allocations
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>
9 years agoAdd fsstress to contrib so it can be built for use in Android
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>
9 years agoAllow debugfs to be built for use in Android
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>
9 years agolibext2fs: fix ext2fs_close() when MMP is not enabled
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>
9 years agolibext2fs, libe2p, misc: git rid of jfs_user.h
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>
9 years agoUpdate Android build files so the 1.43 branch builds on AOSP
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>
9 years agoe2fsprogs: use $DUMPE2FS in resize_test script
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>
9 years agoe2fsck,misc: include ext2fs.h to avoid clang warnings
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>
9 years agodebian: update e2fslibs.symbols for 1.43-WIP release v1.43-WIP-2015-05-18
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>
9 years agoMerge branch 'maint' into next
Theodore Ts'o [Mon, 18 May 2015 06:15:56 +0000 (02:15 -0400)]
Merge branch 'maint' into next

9 years agodebian: remove trailing spaces from control.in file
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>
9 years agoUpdate release notes for a 1.43-WIP release (18-May-2015)
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>
9 years agomke2fs: enable the metadata_csum and 64bit features by default
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>
9 years agoMerge branch 'maint' into next
Theodore Ts'o [Mon, 18 May 2015 01:58:28 +0000 (21:58 -0400)]
Merge branch 'maint' into next

9 years agoUpdate release notes, etc. for final 1.42.13 release v1.42.13
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>
9 years agoMerge remote-tracking branch 'origin/maint' into maint
Theodore Ts'o [Mon, 18 May 2015 01:25:45 +0000 (21:25 -0400)]
Merge remote-tracking branch 'origin/maint' into maint

9 years agoUpdate translation template file
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>
9 years agoAdd the Danish translation file from the Translation Project
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>
9 years agopo: update es.po (from translationproject.org)
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>
9 years agopo: update eo.po (from translationproject.org)
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>
9 years agopo: update de.po (from translationproject.org)
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>
9 years agopo: update ca.po (from translationproject.org)
À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>