Whamcloud - gitweb
tools/e2fsprogs.git
7 years agoe2fsprogs: enable project quota reporting in debugfs
Eric Whitney [Mon, 30 Jan 2017 17:34:16 +0000 (12:34 -0500)]
e2fsprogs: enable project quota reporting in debugfs

Make the minor changes required so the list_quota and get_quota commands
can report project quota information.  This also fixes a debugfs
segfault that currently occurs when either list_quota or get_quota is
invoked with an unknown quota_type argument.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibext2fs: translate internal ext4 acl to Posix ACL in ext2fs_xattr_[sg]et()
Theodore Ts'o [Sun, 29 Jan 2017 03:34:16 +0000 (22:34 -0500)]
libext2fs: translate internal ext4 acl to Posix ACL in ext2fs_xattr_[sg]et()

ext2fs_xattr_[sg]et() will now translate the Posix ACL xattrs to and
from the internal ext4 attr format, since the callers of the libext2fs
are much more likely to want to use the public Posix ACL format.

For debugfs and those applications that want to see the on-disk
format, the new ext4fs_xattr_flags() function will allow those callers
to request the raw format.

Addresses-Launchpad-Bug: #1645232

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agodebugfs: improve how we display and parse extended attribute values
Theodore Ts'o [Sat, 28 Jan 2017 18:09:53 +0000 (13:09 -0500)]
debugfs: improve how we display and parse extended attribute values

Use the new C string printing routine, and allow ea_get command to
display the system.data extended attribute.  Also allow the user to
explicitly request that the string be printed using hex values.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibsupport: add C string printing and parsing functions
Theodore Ts'o [Sat, 28 Jan 2017 17:11:46 +0000 (12:11 -0500)]
libsupport: add C string printing and parsing functions

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agotest: add f_mke2fs_baddisk
Dmitry Monakhov [Wed, 7 Dec 2016 14:55:17 +0000 (18:55 +0400)]
test: add f_mke2fs_baddisk

Check what mke2fs will return non zero error on broken device.

This test requires using dmsetup, so it requires running as root; if
root privileges is not available, the test will be skipped.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibext2fs: don't ignore fsync errors
Eric Sandeen [Tue, 20 Dec 2016 15:23:29 +0000 (09:23 -0600)]
libext2fs: don't ignore fsync errors

Today, if mke2fs experiences IO errors (say, on a thin device
which filled up during mkfs), mke2fs is silent and returns
success even though the filesystem was not properly created.

Catch errors from the io_channel_flush() callchain to
fix this up.  Fix formatting of the printed error as
well:

...
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information:
Warning, had trouble writing out superblocks.
# echo $?
5

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolib/et/testcases: checked in imap_err.et from cyrus-imapd version 2.5.10
Theodore Ts'o [Fri, 23 Dec 2016 03:23:58 +0000 (22:23 -0500)]
lib/et/testcases: checked in imap_err.et from cyrus-imapd version 2.5.10

This version of imap_err.et has a 4-clause BSD license, which should
hopefully be more comforting to lawyers than the license with
prohibits non-commercial use --- which shouldn't be a problem since
it's in a test case that would never show up in any binary, and so
license compatibility wouldn't be an issue.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoBring back libext2_profile build rules.
Jeff Sharkey [Fri, 21 Oct 2016 18:44:14 +0000 (12:44 -0600)]
Bring back libext2_profile build rules.

Google-Bug-Id: 27599744
From AOSP commit: 80fcd5bb6dcc130337def60423a5d9e22a5814e7

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agodebugfs, e2fsck, mke2fs: fix miscellaneous memory leaks detected by ASAN
Theodore Ts'o [Sat, 12 Nov 2016 14:31:56 +0000 (09:31 -0500)]
debugfs, e2fsck, mke2fs: fix miscellaneous memory leaks detected by ASAN

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoMake sure test progams free all allocated memory
Theodore Ts'o [Sat, 12 Nov 2016 04:15:56 +0000 (23:15 -0500)]
Make sure test progams free all allocated memory

This eliminates complaints from ASAN's memory leak detector.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoAvoid dereferencing beyond allocated memory in quota handling
Theodore Ts'o [Fri, 11 Nov 2016 23:39:26 +0000 (18:39 -0500)]
Avoid dereferencing beyond allocated memory in quota handling

The quota support code must must not try to handle the project quota
if the the project feature is not enabled.

Problem detected by ASAN.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibext2fs: avoid dereferencing beyond allocated memory in xattr code
Theodore Ts'o [Fri, 11 Nov 2016 23:38:20 +0000 (18:38 -0500)]
libext2fs: avoid dereferencing beyond allocated memory in xattr code

Detected by ASAN.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe2fsck: avoid dereferencing beyond allocated memory with 128 byte inodes
Theodore Ts'o [Fri, 11 Nov 2016 23:34:35 +0000 (18:34 -0500)]
e2fsck: avoid dereferencing beyond allocated memory with 128 byte inodes

Detected by ASAN when the inode size is 128 bytes.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agomke2fs: Avoid crashes / infinite loops for absurdly large devices
Jan Kara [Tue, 25 Oct 2016 18:08:59 +0000 (14:08 -0400)]
mke2fs: Avoid crashes / infinite loops for absurdly large devices

When a device reports absurdly high size, some arithmetics in mke2fs can
overflow (e.g. number of block descriptors) and we end in an infinite
loop. Fix that by checking and refusing insanely large devices.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopartinfo: fix some build errors
Darrick J. Wong [Tue, 25 Oct 2016 17:28:13 +0000 (13:28 -0400)]
partinfo: fix some build errors

Fix some missing header files and library link targets.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibsupport: fix compilation on RHEL 5.x due to missing magic define
Thomas De Schampheleire [Tue, 25 Oct 2016 17:22:39 +0000 (13:22 -0400)]
libsupport: fix compilation on RHEL 5.x due to missing magic define

RHEL 5.x does have magic.h, but it does not define all expected symbols. In
particular, the NO_CHECK symbols were only added in file 4.20 and RHEL 5.x
is using 4.17.

Add substitute defines to allow continued usage of magic but without the
requested exclude checks.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoresize2fs: fix resizing large file systems when block size != page size
Theodore Ts'o [Tue, 25 Oct 2016 17:18:14 +0000 (13:18 -0400)]
resize2fs: fix resizing large file systems when block size != page size

Reported by: Jerry Lee <jerrylee@qnap.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoandroid: fix Mac build
Theodore Ts'o [Mon, 24 Oct 2016 19:18:09 +0000 (15:18 -0400)]
android: fix Mac build

Disable building debugfs and e4crypt on mac.
Add missing time.h include in ext2fs.h for time_t.

From AOSP commit: f2b2d2c0a6af8bd1e1a19150cf9d41d8f2b0e39a

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agomke2fs.conf: add back missing uninit_bg feature flag
Theodore Ts'o [Mon, 24 Oct 2016 18:15:43 +0000 (14:15 -0400)]
mke2fs.conf: add back missing uninit_bg feature flag

Commit 0da058af9f88: "mke2fs.conf: don't enable metadata_csum by
default" removed metadata_csum without adding back the uninit_bg flag
--- which had the net result of causing file systems to take a long
time to mke2fs, since this caused all of the block group metadata to
be initialized.

Addresses-Google-Bug: 32342524

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibext2fs: unix_io: reflect error from read/write calls to caller
Theodore Ts'o [Fri, 21 Oct 2016 14:21:54 +0000 (10:21 -0400)]
libext2fs: unix_io: reflect error from read/write calls to caller

If the read(2) or write(2) system calls fail, return the error to the
caller instead of returning "short read" or "short write", which is
just misleading.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibext2fs: force DIO alignment FreeBSD when operating on a block device
Theodore Ts'o [Tue, 13 Sep 2016 22:39:22 +0000 (18:39 -0400)]
libext2fs: force DIO alignment FreeBSD when operating on a block device

FreeBSD (and possibly BSD systems) requires that reads and writes to
block devices must be aligned, even when the O_DIRECT flag is not
specified.  Previously this was hard-coded to 512 bytes, but in order
to properly handle Advanced Format HDD's, query the BSD kernel to
determine the proper alignment to use.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibext2fs: add FreeBSD support to getsectsize.c
Theodore Ts'o [Tue, 13 Sep 2016 22:31:20 +0000 (18:31 -0400)]
libext2fs: add FreeBSD support to getsectsize.c

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibext2fs: fix short-read bugs in unix_io's bounce buffer handling
Matthias Andree [Tue, 13 Sep 2016 20:34:33 +0000 (16:34 -0400)]
libext2fs: fix short-read bugs in unix_io's bounce buffer handling

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibext2fs: add test facility UNIX_IO_FORCE_BOUNCE in unix_io.c
Theodore Ts'o [Tue, 13 Sep 2016 18:34:59 +0000 (14:34 -0400)]
libext2fs: add test facility UNIX_IO_FORCE_BOUNCE in unix_io.c

If the UNIX_IO_FORCE_BOUNCE environment is set, all I/O will be sent
through the bounce buffer code paths for debugging / testing purposes.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoFix spurious error when both gmake and makeinfo are not available
Theodore Ts'o [Mon, 12 Sep 2016 03:30:25 +0000 (23:30 -0400)]
Fix spurious error when both gmake and makeinfo are not available

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoFix reversed FORCE_NATIVE_MAKE test in acinclude.m4
Theodore Ts'o [Mon, 12 Sep 2016 03:11:31 +0000 (23:11 -0400)]
Fix reversed FORCE_NATIVE_MAKE test in acinclude.m4

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibext2fs: fix unaligned, multiblock writes in the unix_io handler
Theodore Ts'o [Sun, 11 Sep 2016 04:25:48 +0000 (00:25 -0400)]
libext2fs: fix unaligned, multiblock writes in the unix_io handler

The read-modify-write code for the unaligned fallback code wasn't
working for multi-block writes.  This was unmasked by FreeBSD 11-rc2,
since its malloc() is returning unaligned memory regions for large
memory regions.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoUpdate release notes, etc., for 1.43.3 release v1.43.3
Theodore Ts'o [Mon, 5 Sep 2016 01:31:21 +0000 (21:31 -0400)]
Update release notes, etc., for 1.43.3 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe2fsck: enforce that the extra isize fields in the superblock are sane
Theodore Ts'o [Sun, 4 Sep 2016 21:31:07 +0000 (17:31 -0400)]
e2fsck: enforce that the extra isize fields in the superblock are sane

Invalid extra isize fields can cause crashes in e2fsprogs and possibly
in the kernel for some architectures due to unaligned accesses.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe2fsck: enforce that extra_isize must be a multiple of four
Theodore Ts'o [Sun, 4 Sep 2016 20:29:12 +0000 (16:29 -0400)]
e2fsck: enforce that extra_isize must be a multiple of four

We need to prevent unaligned accesses, so treat any extra_isize which
is not a multiple of four as an bug.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoAvoid crashing on unaligned pointers from corrupted file systems
Theodore Ts'o [Sun, 4 Sep 2016 19:06:32 +0000 (15:06 -0400)]
Avoid crashing on unaligned pointers from corrupted file systems

On platforms that don't permit unaligned pointer dereferences,
corrupted file systems will as used by the regression test suite can
cause e2fsck and debugfs to crash.  Avoid those crashes caused by
corrupted file systems.  With this commit the full set of regression
test suites will pass on the sparc64 platform.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoFix FreeBSD pmake support
Theodore Ts'o [Sun, 4 Sep 2016 04:16:35 +0000 (00:16 -0400)]
Fix FreeBSD pmake support

Fix a typo in the @ifNotGNUmake@ case of MCONFIG.in.

Also allow the FORCE_NATIVE_MAKE to force the use of the non-GNU make
optimized Makefile.  The resulting makefile will work with GNU Make
4.2.1, although "make V=1" won't be honored.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe2fsck: fix timestamps logic for 32-bit systems
Theodore Ts'o [Sun, 4 Sep 2016 03:33:11 +0000 (23:33 -0400)]
e2fsck: fix timestamps logic for 32-bit systems

Commit 35a4e1b1c5cbb introduced a regression which caused e2fsck on
32-bit systems to think all timestamps were legacy pre-1970
timestamps.  Fix the bug.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agodebian: update changelog
Theodore Ts'o [Fri, 2 Sep 2016 04:49:31 +0000 (00:49 -0400)]
debian: update changelog

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agodebian: don't hide the linker flags for e2fsck.static
Theodore Ts'o [Fri, 2 Sep 2016 03:48:03 +0000 (23:48 -0400)]
debian: don't hide the linker flags for e2fsck.static

The linker command needs to be visible so the blhc scanner can work
correctly.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agodebian: fix build reproducibility problems in the rules file
Theodore Ts'o [Fri, 2 Sep 2016 03:13:04 +0000 (23:13 -0400)]
debian: fix build reproducibility problems in the rules file

The configure file needs to be run using a relative pathname so that
when $(srcdir) gets introduced into binary file, the location of the
build directory doesn't find its way into the binaries.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoFix build reproducibility for mk_cmds and compile_et
Theodore Ts'o [Fri, 2 Sep 2016 02:25:22 +0000 (22:25 -0400)]
Fix build reproducibility for mk_cmds and compile_et

The mk_cmds and compile_et scripts include the build directory, which
breaks the build reproducibility goal of Debian.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoUpdate release notes, etc. for 1.43.2 release v1.43.2
Theodore Ts'o [Thu, 1 Sep 2016 19:33:11 +0000 (15:33 -0400)]
Update release notes, etc. for 1.43.2 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoconfig: update config.{guess,sub}
Theodore Ts'o [Thu, 1 Sep 2016 19:34:37 +0000 (15:34 -0400)]
config: update config.{guess,sub}

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibext2fs: allow the default journal size to go as large as a gigabyte
Theodore Ts'o [Thu, 1 Sep 2016 15:37:59 +0000 (11:37 -0400)]
libext2fs: allow the default journal size to go as large as a gigabyte

Recent research has shown that for a metadata-heavy workload, a 128 MB
is journal be a bottleneck on HDD's, and that the optimal journal size
is proportional to number of unique metadata blocks that can be
modified (and written into the journal) in a 30 second window.  One
gigabyte should be sufficient for most workloads, which will be used
for file systems larger than 128 gigabytes.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe2fsck: fix logic for deciding when to repair legacy timestamp encodings
Theodore Ts'o [Thu, 1 Sep 2016 04:13:38 +0000 (00:13 -0400)]
e2fsck: fix logic for deciding when to repair legacy timestamp encodings

A static code checker noticed that we had a redundant condition:

    if (((sizeof(time_t) <= 4) ||
         ((sizeof(time_t) > 4) &&

which was caused by the parenthesis were in the wrong place.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopo: Add Hugarian and Serbian translations
Theodore Ts'o [Thu, 1 Sep 2016 03:33:42 +0000 (23:33 -0400)]
po: Add Hugarian and Serbian translations

Also update the .gmo files.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopo: update zh_CN.po (from translationproject.org)
Tianze Wang [Thu, 1 Sep 2016 03:14:17 +0000 (23:14 -0400)]
po: update zh_CN.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopo: update uk.po (from translationproject.org)
Yuri Chornoivan [Thu, 1 Sep 2016 03:14:17 +0000 (23:14 -0400)]
po: update uk.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopo: update sv.po (from translationproject.org)
Göran Uddeborg [Thu, 1 Sep 2016 03:14:17 +0000 (23:14 -0400)]
po: update sv.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Thu, 1 Sep 2016 03:14:17 +0000 (23:14 -0400)]
po: update pl.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopo: update nl.po (from translationproject.org)
Benno Schulenberg [Thu, 1 Sep 2016 03:14:17 +0000 (23:14 -0400)]
po: update nl.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopo: update fr.po (from translationproject.org)
Samuel Thibault [Thu, 1 Sep 2016 03:14:17 +0000 (23:14 -0400)]
po: update fr.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopo: update de.po (from translationproject.org)
Philipp Thomas [Thu, 1 Sep 2016 03:14:17 +0000 (23:14 -0400)]
po: update de.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopo: update da.po (from translationproject.org)
Joe Hansen [Thu, 1 Sep 2016 03:14:17 +0000 (23:14 -0400)]
po: update da.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopo: update ca.po (from translationproject.org)
Angel Mompo [Thu, 1 Sep 2016 03:14:17 +0000 (23:14 -0400)]
po: update ca.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agotune2fs: tell the user that e2fsck -f is required
Theodore Ts'o [Thu, 1 Sep 2016 02:53:07 +0000 (22:53 -0400)]
tune2fs: tell the user that e2fsck -f is required

The message requesting that the user run e2fsck doesn't include the -f
option, and this is needed to force a file system check.

Addresses-Debian-Bug: #828022

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe2fsck: fix an alignment problem which causes sparc64 in the journal code
Theodore Ts'o [Thu, 1 Sep 2016 00:46:49 +0000 (20:46 -0400)]
e2fsck: fix an alignment problem which causes sparc64 in the journal code

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agodebugfs: fix typo when printing out the dtime label
Theodore Ts'o [Wed, 31 Aug 2016 22:37:50 +0000 (18:37 -0400)]
debugfs: fix typo when printing out the dtime label

If the inode has extended timestamps, the dtime was printed with a
label of "crtime".  Fix this.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agodebugfs: add the debugfs copy_inode subcommand
Theodore Ts'o [Wed, 31 Aug 2016 22:13:16 +0000 (18:13 -0400)]
debugfs: add the debugfs copy_inode subcommand

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoMerge branch 'maint' into next
Theodore Ts'o [Wed, 10 Aug 2016 22:53:14 +0000 (18:53 -0400)]
Merge branch 'maint' into next

7 years agofsck: fix strange logic
Andreas Dilger [Wed, 10 Aug 2016 22:21:19 +0000 (18:21 -0400)]
fsck: fix strange logic

llvm warns about the confusingly written comparison:

                              !strncmp(argv[i+1], "-", 1) == 0) {
    misc/fsck.c:1178 col 9: warning: logical not is only applied to
      the left hand side of comparison [-Wlogical-not-parentheses]
    misc/fsck.c:1178 col 9: note: add parentheses after the '!' to
      evaluate the comparison first
    misc/fsck.c:1178 col 9: note: add parentheses around left hand
      side expression to silence this warning

It makes sense to simplify this to a character comparison rather
than using strncmp() to check only one character.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibext2fs: add unixfd_io_manager
Adrien Schildknecht [Wed, 10 Aug 2016 21:08:16 +0000 (17:08 -0400)]
libext2fs: add unixfd_io_manager

This new manager is similar to the unix_io_manager except it takes a
file descriptor as first argument instead of a filename.

Some programs may want libext2fs to directly use a fd instead of
letting it opening the file.
The use case for such a io_manager would be to let programs use
a fd even if the filename is unknown:
  - the fd comes from a temporary file (O_TMPFILE);
  - the fd comes from a unix socket...

Refactoring unix_open() also fix a bug when the IO_DIRECT flag was
specified: ext2fs_get_dio_alignment() was called before the file was
actually opened, resulting in an alignment of 0.

Signed-off-by: Adrien Schildknecht <adriens@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibext2fs: replace 'unsigned long' by 'uintptr_t'
Adrien Schildknecht [Wed, 10 Aug 2016 21:07:00 +0000 (17:07 -0400)]
libext2fs: replace 'unsigned long' by 'uintptr_t'

This is needed for win64:
    sizeof(unsigned long) != sizeof(void*)

Signed-off-by: Adrien Schildknecht <adriens@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibext2fs: reset the size of the zeroing buffer
Adrien Schildknecht [Wed, 10 Aug 2016 20:43:25 +0000 (16:43 -0400)]
libext2fs: reset the size of the zeroing buffer

When a ext2_filsys is freed, ext2fs_zero_blocks2() frees the buffer but
does not reset its size.
If this function is later called with a new ext2_filsys, the code
assumes that the buffer is still valid and return a NULL pointer.

Valgrind output:
==188948== Syscall param pwrite64(buf) points to unaddressable byte(s)
==188948==    at 0x4E46D03: __pwrite_nocancel (syscall-template.S:81)
==188948==    by 0x1254EC: raw_write_blk (unix_io.c:240)
==188948==    by 0x124AAB: unix_write_blk64 (unix_io.c:850)
==188948==    by 0x122893: ext2fs_zero_blocks2 (mkjournal.c:204)

Signed-off-by: Adrien Schildknecht <adriens@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoresize2fs: fix crash when there is an ea block and no blocks to migrate
Theodore Ts'o [Wed, 10 Aug 2016 19:49:35 +0000 (15:49 -0400)]
resize2fs: fix crash when there is an ea block and no blocks to migrate

This fixes a bug introduced in 1.43 by commit fb47b94fffc: "resize2fs:
rewrite extent/dir/ea block checksums when migrating".  If there is an
extended attribute block and there are no blocks that need to migrate,
we will crash.

The bug was caused by a botched De Morgan's transformation.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibext2fs: fix infinite loop if copying in an empty directory
Matthias Andree [Thu, 21 Jul 2016 23:20:10 +0000 (01:20 +0200)]
libext2fs: fix infinite loop if copying in an empty directory

In m_minrootdir, on FreeBSD 9.3, try_lseek_copy() fails on an empty file
because errcode is uninitialized and the while() loop never executes,
and the errcode garbage is returned.

Initialize errcode = 0 in try_lseek_copy() to avoid a "fail" result when
there was nothing to copy.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe2fsck: update j_tail_sequence after recovery
Daeho Jeong [Wed, 6 Jul 2016 00:10:39 +0000 (09:10 +0900)]
e2fsck: update j_tail_sequence after recovery

When journal is released, s_sequence is set to j_tail_sequence.
But, currently, even if the recovery process is successfully completed,
the j_tail_sequence and, finally, s_sequence are never changed. By this,
when we repeat doing power-off the device suddenly and executing e2fsck
without full scan before mount, the s_sequence number will never change
and, in a very rare case, newly generated journal logs will be
surprisingly grafted to the old journal logs. In this case, out-of-date
metadata log can be replayed on the filesystem area and the filesystem
can be crashed unintentionally by journal recovery process. Therefore,
we need to update j_tail_sequence after recovery process is successfully
completed in e2fsck.

Youngjin had repeated this test and found the problem. With our test,
the filesystem crash occurred within 4 hours.

Signed-off-by: Youngjin Gil <youngjin.gil@samsung.com>
Signed-off-by: Daeho Jeong <daeho.jeong@samsung.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agofuse2fs: needs SYSLIBS
Gustavo Zacarias [Wed, 22 Jun 2016 23:58:53 +0000 (20:58 -0300)]
fuse2fs: needs SYSLIBS

It otherwise leads to build failure when using an unbundled libintl.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoUpdate configure script to reflect changes from commit 62bc243f1bf
Theodore Ts'o [Wed, 22 Jun 2016 03:16:39 +0000 (23:16 -0400)]
Update configure script to reflect changes from commit 62bc243f1bf

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe2undo: fix endian issues
Eric Sandeen [Thu, 16 Jun 2016 22:51:04 +0000 (17:51 -0500)]
e2undo: fix endian issues

Two new e2undo issues exist in the latest release on big endian
machines.

From sparse check:

undo_io.c:157:26: warning: invalid assignment: |=
undo_io.c:157:26:    left side has type restricted __le32
undo_io.c:157:26:    right side has type int
undo_io.c:161:26: warning: invalid assignment: &=
undo_io.c:161:26:    left side has type restricted __le32
undo_io.c:161:26:    right side has type int

e2undo.c:211:16: warning: cast to restricted __le64
e2undo.c:211:16: warning: cast from restricted blk64_t
e2undo.c:212:16: warning: cast to restricted __le64
e2undo.c:212:16: warning: cast from restricted blk64_t

Addresses-RedHat-Bugzilla: 1344636
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agodebugfs: fix logdump to work on files > 2GB
Theodore Ts'o [Mon, 13 Jun 2016 01:42:47 +0000 (21:42 -0400)]
debugfs: fix logdump to work on files > 2GB

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agomisc: don't unconditionally install manual page for fuse2fs
Ingo Brückl [Thu, 9 Jun 2016 20:56:50 +0000 (16:56 -0400)]
misc: don't unconditionally install manual page for fuse2fs

Only install the manual page if fuse2fs itself will be installed.

Signed-off-by: Ingo Brückl <ib@wupperonline.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agofuse2fs: might need librt
Gustavo Zacarias [Thu, 9 Jun 2016 20:56:15 +0000 (16:56 -0400)]
fuse2fs: might need librt

It uses clock_gettime() which in older glibc versions is in librt.

Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoUpdate release notes, etc. for 1.43.1 release v1.43.1
Theodore Ts'o [Wed, 8 Jun 2016 19:45:26 +0000 (15:45 -0400)]
Update release notes, etc. for 1.43.1 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibblkid: avoid DIOCGDINFO where missing.
Matthias Andree [Wed, 8 Jun 2016 18:26:38 +0000 (14:26 -0400)]
libblkid: avoid DIOCGDINFO where missing.

FreeBSD 11 will remove the DIOCGINFO ioctl(), so check if it is defined
before referencing it.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoRemove the last of behaviour-specific checks on EXT2_OS_LINUX
Theodore Ts'o [Tue, 7 Jun 2016 17:36:47 +0000 (13:36 -0400)]
Remove the last of behaviour-specific checks on EXT2_OS_LINUX

If there is a feature check, we can just depend on the feature check.
If it is something that can't be checked via a feature flag, then
instead of checking for EXT2_OS_LINUX, we should instead check for
*NOT* EXT2_OS_HURD. since HURD is the special case.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agotests: suppress use of libmagic when running the regression test suite
Theodore Ts'o [Tue, 7 Jun 2016 16:46:24 +0000 (12:46 -0400)]
tests: suppress use of libmagic when running the regression test suite

How libmagic will behave is not necessarily stable across different
operating systems of versions of libmagic (or the magic number
database).  So suppress it to avoid false test failures.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agotests: disable some tests for FreeBSD
Theodore Ts'o [Tue, 7 Jun 2016 15:52:25 +0000 (11:52 -0400)]
tests: disable some tests for FreeBSD

Unfortunately, FreeBSD doesn't support sparse files in their tmpfs,
and they generlaly don't mount a tmpfs on /tmp anyway.  As a result
certain tests will either OOM kill a FreeBSD (if tmpfs is in use) or
will take forever (if it is not in use).

So let's turn off some tests for FreeBSD (m_hugefile is disabled on
MacOS already, for similar reasons).  We need to find a better
solution in the long term, but for now, these tests are guaranteed to
be a disaster on FreeBSD, so suppress them for now.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agotune2fs,resize2fs: special case HURD only when testing s_creator_os
Theodore Ts'o [Tue, 7 Jun 2016 15:47:40 +0000 (11:47 -0400)]
tune2fs,resize2fs: special case HURD only when testing s_creator_os

The s_creator_os field was a mistake, given how Hurd has been
ab(using) certain file system fields.  We should skip support for
certain advanced features (64-bit support, metadata checksums) for
file systems created on the Hurd OS only, instead of only supporting
them for file systems created on Linux.  This fixes various regression
test failures for FreeBSD.

(The regression tests are probably mostly hopeless for Hurd anyway,
but given the HURD abuse's of various file system fields, the HURD is
going to have to be given second-class treatment in any case, given
what they decided to do with ext2 support, which locks them out of the
more advanced file system features, anyway.)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibext2fs: fix EXT2FS_PRETEND_* on non-Linux systems
Theodore Ts'o [Tue, 7 Jun 2016 15:44:54 +0000 (11:44 -0400)]
libext2fs: fix EXT2FS_PRETEND_* on non-Linux systems

The debugging environment variables EXT2FS_PRETEND_* were implemented
in check_mntent_file(), and this function isn't called on all
operating systems.  Lift this code up to ext2fs_check_mount_point(),
so that these environment variables (which are used in the regression
test suite) will work on all platforms.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoFix dbg_print() format for unsigned long long.
Matthias Andree [Tue, 7 Jun 2016 14:50:12 +0000 (10:50 -0400)]
Fix dbg_print() format for unsigned long long.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agotests: teach test_script the --failed option
Theodore Ts'o [Tue, 7 Jun 2016 14:47:20 +0000 (10:47 -0400)]
tests: teach test_script the --failed option

Teach test_script the --failed option, which asks it to rerun the
tests that had previously failed.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibext2fs: don't use $(LDFLAGS_STATIC) when linking test programs
Theodore Ts'o [Tue, 7 Jun 2016 04:16:17 +0000 (00:16 -0400)]
libext2fs: don't use $(LDFLAGS_STATIC) when linking test programs

The tst_* progams aren't intended to be linked 100% stically; they
just link against some of the static libraries.  So use $(ALL_LDFLAGS)
and not $(LDFLAGS_STATIC).

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoconfigure: fix detection of dlopen() for BSD systems
Theodore Ts'o [Tue, 7 Jun 2016 04:14:35 +0000 (00:14 -0400)]
configure: fix detection of dlopen() for BSD systems

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoMerge branch 'maint' into next
Theodore Ts'o [Tue, 7 Jun 2016 05:01:22 +0000 (01:01 -0400)]
Merge branch 'maint' into next

8 years agolibext2fs: fix Direct I/O fallback code so it implements RMW correctly
Theodore Ts'o [Tue, 7 Jun 2016 03:04:43 +0000 (23:04 -0400)]
libext2fs: fix Direct I/O fallback code so it implements RMW correctly

There is a bug in Unix I/O manager where if an aligned I/O is
required, it does not correctly do the read-modify-write cycle
correctly.  Specifically, it was not doing an lseek between the read
and the write calls, so the update was going to block N+1 instead of
block N.  Oops.

Fortunately in practice we almost never use this fallback path, so
file systems weren't getting horribly corrupted, because (a) we almost
never use Direct I/O in e2fsprogs, at least not by default, and (b)
when we do the buffers end up being aligned anyway, so it's OK.

We only noticed this because the new Undo I/O manager in e2fsprogs
1.43 was doing unaligned I/O and FreeBSD requires that I/O requests be
aligned even if you are not doing Direct I/O, and the e2undo
regression tests were all failing as a result.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agotests,debugfs: ea_set's "-f <value_file" needs to be before the other args
Theodore Ts'o [Mon, 6 Jun 2016 20:49:37 +0000 (16:49 -0400)]
tests,debugfs: ea_set's "-f <value_file" needs to be before the other args

For systems that don't use GNU's getopt(3), options have to be before
all non-option arguments.  So change the usage message for debugfs's
ea_set command, and then fix the d_xattr_sorting test.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoe2undo: #include <libgen.h> since we use basename()
Theodore Ts'o [Mon, 6 Jun 2016 20:19:11 +0000 (16:19 -0400)]
e2undo: #include <libgen.h> since we use basename()

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agotests: use tar xf -, some tars default to tape dev.
Matthias Andree [Mon, 6 Jun 2016 04:54:11 +0000 (00:54 -0400)]
tests: use tar xf -, some tars default to tape dev.

FreeBSD's tar defaults to reading from /dev/sa0 when no -f option is
given, so turn "tar x" into "tar xf -" on j_corrupt_ext_jnl_sb_*.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agomke2fs: warn if user provides a label which is too long
Theodore Ts'o [Mon, 6 Jun 2016 03:18:30 +0000 (23:18 -0400)]
mke2fs: warn if user provides a label which is too long

Addresses-Debian-Bug: #791630

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agodebugfs: clarify man page for the -b and -s options
Theodore Ts'o [Sat, 4 Jun 2016 03:37:28 +0000 (23:37 -0400)]
debugfs: clarify man page for the -b and -s options

Addresses-Debian-Bug: #766379

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoAdd clarifications to the e4defrag and resize2fs man pages
Theodore Ts'o [Sat, 4 Jun 2016 03:28:33 +0000 (23:28 -0400)]
Add clarifications to the e4defrag and resize2fs man pages

Addresses-Debian-Bug: #761144
Addresses-Debian-Bug: #770750

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
by 1 commit.

8 years agoDocument when ext2/3/4 features were added to the kernel
Theodore Ts'o [Sat, 4 Jun 2016 03:09:58 +0000 (23:09 -0400)]
Document when ext2/3/4 features were added to the kernel

Document when ext2/3/4 features were added to the kernel in the
ext4(5) man page.

Addresses-Debian-Bug: #428361

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoClarify and clean up the ext4(5) man page
Pete Haddow [Fri, 3 Jun 2016 09:45:41 +0000 (10:45 +0100)]
Clarify and clean up the ext4(5) man page

Signed-off-by: Pete Haddow <pete@leptonyx.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agodebugfs.8, e2fsck.8: clarify man pages these programs can operate on files
Theodore Ts'o [Fri, 3 Jun 2016 03:26:57 +0000 (23:26 -0400)]
debugfs.8, e2fsck.8: clarify man pages these programs can operate on files

Addresses-Debian-Bug: #766127

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agodebugfs: fix rdump so it can start from the root directory
Theodore Ts'o [Fri, 3 Jun 2016 03:05:11 +0000 (23:05 -0400)]
debugfs: fix rdump so it can start from the root directory

Previously "rdump / /tmp/out" would fail with the error message:

rdump: File exists while making directory /tmp/out/

Also fix the fast symlink detection logic so that it works when a
symlink has one or more extended attributes.

Addresses-Debian-Bug: #766125

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agomisc: fix gcc -Wall complaints
Theodore Ts'o [Fri, 3 Jun 2016 02:40:41 +0000 (22:40 -0400)]
misc: fix gcc -Wall complaints

Especially when compiling for a 32-bit architecture.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agodebian: disable tdb when building the binaries for the udebs
Theodore Ts'o [Tue, 31 May 2016 06:05:50 +0000 (02:05 -0400)]
debian: disable tdb when building the binaries for the udebs

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agodebian: change e2fsprogs to Suggests, instead of Recommends fuse2fs
Theodore Ts'o [Tue, 31 May 2016 05:49:46 +0000 (01:49 -0400)]
debian: change e2fsprogs to Suggests, instead of Recommends fuse2fs

Recommends is too strong of a dependency to use here.

Addresses-Debian-Bug: #825868

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agodebian: don't build the fuse2fs package for the Hurd OS
Theodore Ts'o [Tue, 31 May 2016 05:48:18 +0000 (01:48 -0400)]
debian: don't build the fuse2fs package for the Hurd OS

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agodebian: adjust how we build hardened binaries to avoid blhc complaints
Theodore Ts'o [Tue, 31 May 2016 05:27:24 +0000 (01:27 -0400)]
debian: adjust how we build hardened binaries to avoid blhc complaints

Avoid false positives for blhc.  Also, build the object files for the
static library using -fPIE so they can be linked with a shared
executable linked with -pie.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolib: build elf shared libraries using -fPIC -shared
Theodore Ts'o [Tue, 31 May 2016 05:25:58 +0000 (01:25 -0400)]
lib: build elf shared libraries using -fPIC -shared

Make sure we use "-fPIC -shared" consistently on linker and compiler
command lines when building or linking the shared objects for the ELF
shared library.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoFix Android build warnings
Theodore Ts'o [Mon, 30 May 2016 03:35:13 +0000 (23:35 -0400)]
Fix Android build warnings

Also fix some additional gcc -Wall build warnings in a traditional
Linux environment.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoAdd configure --disable-tdb which disables e2fsck's scratch_files feature
Theodore Ts'o [Mon, 30 May 2016 00:48:54 +0000 (20:48 -0400)]
Add configure --disable-tdb which disables e2fsck's scratch_files feature

The scratch_files feature is not really needed except on 32-bit
platforms, since tdb's performance is pretty awful given how we are
using it.  Maybe SQLite would be faster, but for 64-bit platforms,
enabling swap works fairly well, especially using the rbtree for the
bitmap abstraction.

We leave tdb for Android since it's unlikely that someone will be
trying to connect petabyte+ sized file systems to a mobile handset.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>