Commit Graph

6285 Commits

Author SHA1 Message Date
Darrick J. Wong
4aece3281e enable link time optimization, if requested
Enable link time optimization (LTO) if the builder requests it.  The
extra link optimization results in smaller binaries.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-08 11:16:03 -04:00
Theodore Ts'o
b905cd4f8f debian: use dh_installsystemd instead of manual handling in the scripts
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-08 10:43:44 -04:00
Darrick J. Wong
a2df58945c e2scrub: add service (cron, systemd) support
Add the ability to run the e2scrub utilities as a periodically scheduled
system service.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-05 14:59:40 -04:00
Darrick J. Wong
a089aec341 e2scrub: create a script to scrub all ext* filesystems
Create an e2scrub_all command to find all ext* filesystems
and run an online scrub against them all.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-05 14:43:12 -04:00
Darrick J. Wong
5ce368f07c e2scrub: create online fsck tool of sorts
Implement online fsck for ext* filesystems which live on LVM-managed
logical volumes.  The basic strategy mirrors that of e2croncheck --
create a snapshot, fsck the snapshot, report whatever errors appear,
remove snapshot.  Unlike e2croncheck, this utility accepts any LVM
device path, knows about snapshots running out of space, and can call
fstrim having validated that the fs metadata is ok.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-05 14:43:12 -04:00
Darrick J. Wong
2b17b98e41 tune2fs: allow setting the filesystem error bit
Allow the administrator to mark the filesystem's error bit to force a
fsck at the next mount.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-05 14:43:12 -04:00
Isaac Chen
f4f701db32 AOSP: ODR violation in e2fsck during host build
Signed-off-by: Theodore Ts'o <tytso@mit.edu>

Bug: 112062612
Test: $ m SANITIZE_HOST=address $OUT_DIR/host/linux-x86/bin/e2fsck $OUT_DIR/host/linux-x86/bin/llvm-symbolizer
      $ $OUT_DIR/host/linux-x86/bin/e2fsck

Change-Id: I3f1a18d6d72116d864a79f0acef37625124f4c1a
From AOSP commit: 3271c69c97f486914fea833a36eaf5d86938c76d
2018-08-05 14:17:16 -04:00
David Anderson
aa975a572d AOSP: Fix macOS build.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>

Bug: 111839488
Test: e2fsprogs builds on macOS.
Change-Id: I4ddf332cc244fa44f928cba68470b7f9aa48a556
From AOSP commit: 4dc2456f0e6d10c73372e829e1875ec4095e8fa6
2018-08-05 13:58:26 -04:00
David Anderson
0958bc6327 AOSP: Update Android.bp files.
debugfs now links to a new libext2_support library, which only includes
cstring.c (Android separates other pieces of libsupport into separate
libraries).

e2fsck now builds with -Wno-unused-variable to work around an unused
variable introduced by cabde4999d.

libext_e2p builds the new ljs.c file, and links to ws2_32 on Windows for
ntohl().

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

Change-Id: I42edce0478f1529f44acdbef1495ec5270e3a61e
From AOSP commit: af14814afe0cb3389ecc4b9e9422bd7e8962e0ed
2018-08-05 13:54:26 -04:00
David Anderson
8f1b0898ac AOSP: e2fsck: Remove unused variable.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>

Bug: N/A
Test: e2fsck builds
Change-Id: I48e33920d8aa369808fb47143f2a46ecaa03f6c3
From AOSP commit: 4d2e95e15a4df94e556c2bfbf77b7b1d8e43b446
2018-08-05 13:42:18 -04:00
David Anderson
c4062e7acf AOSP: Always define HAVE_SYS_SYSMACROS_H on Android.
This is needed after 3fb715b554 which
conditionally included sysmacros.h.

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

Change-Id: I52e3da4d9ea0f5efbf685a9c4a266f33357f8d8c
From AOSP commit: a5deff7b7ee15a5ba5d65516326ce4c42daa1027
2018-08-05 12:22:42 -04:00
David Anderson
dfae277e8b AOSP: Conditionally define __bitwise__ on Android.
bionic does not define _LINUX_TYPES_H but does define __bitwise, so we
conditionally define it here.

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

Change-Id: I500ccd469ea7de2e53ab8bd75720a412c86cf18b
From AOSP commit: 77f2eea2717e18e80a31d80c7721b9e0ed8e0cba
2018-08-05 12:20:39 -04:00
Jaco Kroon
4a30e2ae7c debugfs: fix ncheck so it handles hard links correctly
Due to hard links inodes can have multiple names (except for folders),
ncheck should find all of the names (equal to the number of links to the
inodes, directories excepted), not names to the count of the provided
inodes.

Signed-off-by: Jaco Kroon <jaco@uls.co.za>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-05 12:07:20 -04:00
Theodore Ts'o
31ee367e97 debian: stop using symlinks to save space on *-dev packages
Using symlinks to save space on duplicate copies of the
/usr/share/doc/*/changelog.Debian.gz is a bit of a mess, since when
the foo-dev package is removed, the files in /usr/share/doc/libfoo/*
get removed, which means the copyright file gets removed.

So stop doing this altogether, and set up maintainer scripts to clean
up the mess so that the symlinks are removed when the packages get
upgraded.

Addresses-Debian-Bug: #905195
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-08-04 21:06:19 -04:00
Lukas Czerner
94f20cd515 resize2fs: Remove the real kilobytes rant from man page
Remove the rant about the "real" kilobytes from the man page and just
make it more clear that the suffixed units are representing power-of-two
units as we do in mke2fs man page. Also add terabytes to the list.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-07-22 15:03:03 -04:00
David Anderson
4eca2aef6a AOSP: e2fsdroid: Fix crash with invalid command line args
If a sparse file fails to load, an inconsistent channel pointer will be
returned, causing e2fsdroid to crash on exit.

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

Bug: 64109868
Change-Id: If1606c7c49d5569323db5b5fce4826f24ba76383
From AOSP commit: 0f31d29a968eed6dc3c96eb47fd34e8608a2580c
2018-07-20 18:49:35 -04:00
Lonnie Abelbeck
59c2913cb4 e2fsprogs: fix non-three-char month in version.h
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-07-20 10:57:09 -04:00
Li Dongyang
fddc423dc6 Fix compile error and warnings for old gcc versions
-Wimplicit-fallthrough option was added in gcc7 and
-Wpedantic was added in gcc4.8, while #pragma GCC diagnostic
support was not available until gcc4.6

We got following warnings:
../lib/ext2fs/fiemap.h:35: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’
../lib/ext2fs/fiemap.h:36: warning: unknown option after ‘#pragma GCC diagnostic’ kind
../lib/ext2fs/fiemap.h:38: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’

and error:
filefrag.c: In function ‘main’:
filefrag.c:577: error: #pragma GCC diagnostic not allowed inside functions
filefrag.c:578: error: #pragma GCC diagnostic not allowed inside functions
filefrag.c:595: error: #pragma GCC diagnostic not allowed inside functions

when compiling latest e2fsprogs with a gcc older than 4.6
e.g. on CentOS 6.9

Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-07-14 20:46:30 -04:00
Theodore Ts'o
e96393142c blkid: avoid FPE crash when probing a HFS+ superblock with a zero blocksize
This problem was reported by Adam Buchbinder.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-07-10 18:12:54 -04:00
Theodore Ts'o
85e53f42f9 Update release notes, etc., for the 1.44.3 release
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-07-10 01:40:38 -04:00
Theodore Ts'o
ffb192c06b debian: update standards version to 4.1.5
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-07-10 01:14:26 -04:00
Theodore Ts'o
8dd6953923 libext2fs: install hashmap.h since it is needed by libext2fs.h
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-07-08 11:52:53 -04:00
Theodore Ts'o
a3f2d97657 Update release notes, etc., for the 1.44.3-rc2 release
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-07-04 09:46:45 -04:00
Yuri Chornoivan
b027a865bf po: update uk.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-07-04 09:11:41 -04:00
Göran Uddeborg
d509aec75c po: update sv.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-07-04 09:11:41 -04:00
Jakub Bogusz
475de4554d po: update pl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-07-04 09:11:41 -04:00
Samuel Thibault
9f721fb9fe po: update fr.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-07-04 09:11:40 -04:00
Petr Pisar
3bf42bfde9 po: update cs.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-07-04 09:11:40 -04:00
Theodore Ts'o
e8236b49d0 libext2fs: call fsync(2) to clear stale errors for a new a unix I/O channel
Newer versions of Linux will retain errors and allow them to be
returned by fsync() or close(), even if the error happened before the
file descriptor was opened.  This was to accomodate Postgres's
"interesting" method of error collection.

Unfortunately, for e2fsck, we never want to see stale errors, as this
can cause xfstests (such generic/347) to fail with a false positive.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-07-04 00:23:10 -04:00
Theodore Ts'o
d8cbb80348 e2fsck: fix kernel compat functions to use kernel error return conventions
Fix journal_bmap() and sync_blockdev() to use the kernel error
convetions (e.g., -EIO instead of EIO) since they are called by
reovery.c, which is shared userspace / kernel code.

Without this, e2fsck might print an error message like this:

/sbin/e2fsck: Unknown code ____ 251 while recovering journal of /dev/mapper/thin-vol

instead of what it should have printed which was this:

/sbin/e2fsck: Input/output error while recovering journal of /dev/mapper/thin-vol

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-07-04 00:18:30 -04:00
Andreas Dilger
6e2863e445 tests: make generated test scripts read-only
Make generated test scripts read-only, to avoid errors by developers
editing the generated test scripts and then having them accidentally
clobbered when "make" is run again.

Change-Id: I60d417b816b7c559b5e05baf4167fc2cf2a871cf
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-07-02 17:28:25 -04:00
Theodore Ts'o
867ffd4744 e2fsck: if user declines to fix s_inodes_acount, abort
A recent commit, d74eb7ef: "e2fsck: handle s_inodes_count corruption
properly" tries to fix s_inodes_count.  However, if the user declines
to fix the invalid s_inodes_count, e2fsck needs to abort since
otherwise we can crash due to the insane s_inodes_count.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-29 11:35:58 -04:00
Lukas Czerner
cabde4999d e2fsck: do not allow initialized blocks pass i_size
We do not allow initialized blocks to exist past i_size as this could
lead to stale data exposure.

Remove test f_pgsize_gt_blksize because it is testing for the scenario
that not allowed. f_eofblocks is already testing for this.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-28 17:22:06 -04:00
Theodore Ts'o
73b69a891e e2fsck: fix hang in readahead code if last block in fs is metadata
If the last block the file system is metadata (very rare, but it can
happen, especially if e2fsck needs to relocate a bitmap block), e2fsck
will hang while trying to do readahead.

This problem was reported by Adam Buchbinder.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-28 11:10:58 -04:00
Jiyong Park
722b9ca4ca AOSP: e2fsdroid and mke2fs are dynamic executable in recovery partition
The two utilities are now converted to dynamic executables as shared
libraries are supported in recovery mode.

As part of the conversion, shared libraries that are depended from them
are also marked as recovery_available: true.

Bug: 79146551
Test: adb reboot recovery, and select 'Wipe data/factory reset'. The
data partition is formatted and there is no selinux denial.

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

Change-Id: I22fbc83a4ff0496096efca90721b0db1237c32cd
From AOSP commit: df1f088849ed3336bb4f6f200c29b30682f15948
2018-06-27 23:51:40 -04:00
Theodore Ts'o
8cec4acdc0 tests, mke2fs: add option to suppress xattr copying to fix f_extent_htree
If the developer is running with SELinux enabled on /tmp, the
f_extent_htree regression test will fail because mke2fs by default
copies the extended attributes into the newly created file system (if
a directory hierarchy is specified via the -d option).

Fix this by adding a new extended option to mke2fs, -E no_copy_xattrs
and using it in f_extent_htree's test script.

Reported-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-26 15:21:28 -04:00
Theodore Ts'o
74430052bc tests: explicitly force resize2fs's use of lazy (or not)
Resize2fs will not enable lazy_itable if the kernel apparently does
not support that feature.  This will cause spurious test failures when
the tests are running on such a system (or where sysfs is not
mounted).

So for the purposes of the regression test we need to force the use of
lazy_itable so that the results conform to expected golden output.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-26 09:59:19 -04:00
Theodore Ts'o
47e6105264 debugfs: fix mknod command on some 32-bit platforms due to LFS
On some platforms the layout of struct stat changes if
_FILE_OFFSET_BITS is set to 64 (which force the use of 64-bit types
and 64-bit variants for system calls such as stat, lseek, etc.)

This is not true (mercifully) on i386, but it is true for the 32-bit
mips platform on Linux.  This caused debugfs's mknod command to fail,
since it used struct stat to pass the desired st_mode and st_rdev
fields for the to-be-created device file or FIFO, and this would be
different for create_inode.c and debugfs.c.

Linking together different object files together compiled with
different values of _FILE_OFFSET_BITS is perilous, but for now, let's
fix the specific problem by passing the two fields in the stat
structure that we really care about.  This fixes two regression tests
on the 32-bit MIPS platform: d_special_files and r_move_itable.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-26 09:02:46 -04:00
Theodore Ts'o
ae3a1d571b Update release notes, etc., for the 1.44.3-rc1 release
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-25 10:16:38 -04:00
Theodore Ts'o
574b714d58 Update Makefile.in files using "make depend"
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-25 10:10:39 -04:00
Theodore Ts'o
7ac2cc40f9 debian: update libext2fs.symbol to reflect new hashmap functions
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-25 10:04:12 -04:00
Theodore Ts'o
ebbf86a118 debian: update standards version to 4.1.4
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-25 10:03:20 -04:00
Theodore Ts'o
579e9ae1dd tests: fix up f_detect_junk and f_detect_xfs
The golden output files for these two tests were out of date.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-25 09:43:18 -04:00
Theodore Ts'o
8951fd9f51 resize: remove calculation of unused variable
Fix-Coverty-Bug: 1398367
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-24 21:27:42 -04:00
Theodore Ts'o
5f63e5c4f9 debugfs: suppress spurious "checksum errors" message for unrelated failures
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-24 21:21:49 -04:00
Theodore Ts'o
51a3b0b3dc e2fsck: only retry to open the file system when the superblock is corrupt
Previously we were always retrying the ext2fs_open2() call with the
EXT2_FLAG_IGNORE_SB_ERRORS flag.  It only makes sense to do this if
the superblock is reported as corrupt.  Otherwise, it's a waste of
time, and results in printing an extra set of error messages to annoy
the user.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-24 21:09:59 -04:00
Theodore Ts'o
10b6e089e5 e4crypt: remove unneeded stat(2) call in do_get_policy()
We don't need to conditionally use O_DIRECTORY when opening a
directory.  Remove the unneeded stat, and a TOCTOU complaint from
Coverity.

Fixes-Coverity-Bug: 1293497
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-24 19:28:13 -04:00
Theodore Ts'o
0790bf05a2 tests: fix i_qcow test to properly test e2image's qcow-to-raw functionality
The test script was not properly checking e2image's ability to convert
a qcow2 image back to a raw image.  Fix this, and also change it to
use /tmp for the temporary files to speed things up systems with a
ramdisk for /tmp.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-24 18:30:50 -04:00
Theodore Ts'o
1ff009af1a e2image, libext2fs: check for corrupted qcow2 image
If the qcow2 image is corrupted, qcow2_write_image() will now return
an indication of this to e2image (the only current user of
qcow2_write_image).

Also fix how e2image prints an error message it can't understand the
qcow2 image.

Addresses-Coverity-Bug: 1297511
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-24 18:29:23 -04:00
Theodore Ts'o
e97319e259 libext2fs: explicitly ignore a possible unlink failure in ext2fs_free_icount
There's not much we can do if the unlink of the tdb file fails, and we
don't want to print a warning message from a library.

Fixes-Coverity-Bug: 1308364
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2018-06-24 14:32:15 -04:00