Commit Graph

572 Commits (master)

Author SHA1 Message Date
Theodore Ts'o 047d5d774f 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>
2016-09-04 17:41:20 -04:00
Theodore Ts'o a7b27f11a1 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>
2016-09-04 16:34:49 -04:00
Theodore Ts'o a2143b5160 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>
2016-09-01 22:25:22 -04:00
Theodore Ts'o bbd2f78cf6 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>
2016-09-01 11:37:59 -04:00
Theodore Ts'o 4d4335323e 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>
2016-09-01 01:01:53 -04:00
Theodore Ts'o 726b21b5d2 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>
2016-06-07 12:46:24 -04:00
Theodore Ts'o 55e8032363 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>
2016-06-07 11:52:25 -04:00
Theodore Ts'o ded919125a 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>
2016-06-07 10:47:20 -04:00
Theodore Ts'o be05f60ecf 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>
2016-06-06 16:49:37 -04:00
Matthias Andree 254c50ff5f 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>
2016-06-06 00:54:11 -04:00
Theodore Ts'o 2dd680f3b9 tests: fix f_pre_1970_date_encoding on systems with a 32-bit time_t
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-29 01:07:40 -04:00
Theodore Ts'o e7d848266a tests: fix filter.sed to filter out version numbers of the form 1.43
The regular expression worked for version numbers such as 1.42.12, but
not if there isn't a third component in the version number.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-20 21:02:09 -04:00
Theodore Ts'o 2520f77178 tests: rename t_mke2fs_errors and t_mke2fs_offset
The 't' prefix is for tune2fs tests.  The 'm' prefix is for mke2fs
tests.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-17 00:58:34 -04:00
Marcus Huewe cc090a3634 tests: testcases for the offset handling in e2undo and undo_io.c
The testcase "u_offset" tests/defines e2undo's new UI and offset
handling code. The testcase "u_mke2fs_opt_offset" documents some
issues with undo_io.c's old offset handling code (e.g., backup of
fs block 0, key extension (tdb_data_size != block_size) etc.).

Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-12 15:26:09 -04:00
Marcus Huewe 093d9b4006 tests: test "mke2fs -E offset=N" filesystem size calculation
If "mke2fs -E offset=N ..." is called without a specified filesystem size,
the offset should be subtracted from the default filesystem size (see
commit 87d9b2fb). If "mke2fs -E offset=N ..." is called with an
explicitly specified filesystem size, the specified filesystem size
should be used.

Also, call dd with the "iflag=fullblock" option, if it is going to read
from a pipe.

Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-12 15:08:46 -04:00
Theodore Ts'o 19df3aed71 tests: rename e2image related tests
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-04-25 12:02:38 -04:00
Darrick J. Wong 7dd0dfca04 e2image: ignore checksum errors
Since e2image is used to capture broken fs images for debugging,
ignore checksum errors when creating the image.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-04-25 11:03:09 -04:00
Theodore Ts'o d530271fb3 e2fsck: clean up error messages when journal is corrupted
Update the tests to match with the new behavior and error messages

Also fix test_one so that it doesn't print the failed test output in
the case where the script does not exist.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-04-17 00:44:06 -04:00
Marcus Huewe c66a3bbe83 tests: add testcase for "mke2fs -E offset=N..."
Test that mke2fs does not modify any data before the offset and
after the end of the filesystem.

Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-26 22:24:51 -04:00
Theodore Ts'o 3bf56ef624 Merge branch 'maint' into next 2016-03-22 00:03:09 -04:00
Theodore Ts'o 8ef71d873c tests: fix Makefile so it is portable to gmake 3.x
In commit 0355d6d047 we used a Makefile shell assignment syntax
which is compatible with pmake and gmake 4.x, but which breaks on
gmake 3.x.  So only use the pmake-compatible construction if we are
not using GNU make.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-22 00:01:19 -04:00
David Turner 082ed5dcd9 e2fsck: correct ext4 dates generated by old kernels
Older kernels on 64-bit machines would incorrectly encode pre-1970
ext4 dates as post-2311 dates.  Detect and correct this (assuming the
current date is before 2242).

Include tests for this, as well as changes to debugfs to correctly
set crtimes.

Signed-off-by: David Turner <novalis@novalis.org>
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-14 13:57:33 -04:00
Eric Whitney 5b7afaf181 e2fsck: fix problem report typo
Remove the stray left parenthesis.  Observed while testing bigalloc_1k
filesystems with shared/298 on 32 bit ARM running 4.3 kernels.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
2016-03-06 22:05:43 -05:00
Theodore Ts'o 96fae8869c tests: fix missing cleanup of temporary files
A number of tests weren't properly cleaning their temp files.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 21:44:43 -05:00
Theodore Ts'o 6d4bb11487 Merge branch 'maint' into next 2016-03-06 21:30:07 -05:00
Theodore Ts'o 82af19ea20 tests: cleanup tmpfile for the f_extent_htree
The interim hack to allow this test to work for the maint branch ends
up leaving the tmpfile around.  Clean this up.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 21:22:13 -05:00
Theodore Ts'o dcb8e1fa04 Merge branch 'maint' into next 2016-03-06 20:37:49 -05:00
Darrick J. Wong c864b9eb50 tune2fs: recover the journal
If the journal needs to be recovered to avoid clobbering whatever
changes tune2fs makes, do so.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 20:08:53 -05:00
Darrick J. Wong 62e0d34b51 tune2fs: confirm dangerous operations
Give admins a short amount of time to confirm that they want to
proceed with a dangerous operation.  Refuse to perform the op
unless the filesystem is freshly checked.

Cc: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 20:08:53 -05:00
Darrick J. Wong ba380eea99 libext2fs: sort keys for xattr blocks
Richard Purdie reports that libext2fs doesn't sort attribute keys in
the xattr block correctly, causing the kernel to return -ENODATA when
querying attributes that should be there.  Therefore, sort attributes
so that whatever ends up in the xattr block is sorted according to
what the kernel expects.

Cc: Darren Hart <dvhart@linux.intel.com>
Reported-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Tested-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 20:08:53 -05:00
Darrick J. Wong 2b8772f522 tests: check proper operation of metadata_csum_seed
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 20:08:53 -05:00
Darrick J. Wong 2ed0adbce6 libext2fs: store checksum seed in superblock
Allow the filesystem to store the metadata checksum seed in the
superblock and add an incompat feature to say that we're using it.
This enables tune2fs to change the UUID on a mounted metadata_csum
FS without having to (racy!) rewrite all disk metadata.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 20:08:52 -05:00
Theodore Ts'o f3d9ac36a0 debugfs: add support for the project id field
Teach the stat and set_inode_field commands to support the project ID
field.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 20:08:52 -05:00
Li Xi 080e09b46f Add project quota support
This patch adds project quota support. An new quota type PRJQUOTA(2)
is added. EXT4_PRJ_QUOTA_INO(11) is reserved for project quota inode.
The super block reservers an field s_prj_quota_inum for saving
project quota inode. And each inode adds an internal field i_projid
for saving its project ID.

Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 17:33:39 -05:00
Theodore Ts'o 0355d6d047 Fix build system to be compatible with BSD pmake
This fixes a number of incompatibilities which caused maint branch to
fail to build on on FreeBSD.  Also fix the Makefile in the tests
directory so that "make -jN check" works correctly on FreeBSD.

Previously the Makefile in the tests directory used a construct which
was specific to GNU Make, which which silently expanded to an empty
list, which caused "make check" to be a no-op when running using BSD's
pmake.  This Makefile has been changed to use the != macro assignment
syntax which is common to GNU make and BSD pmake.  It's technically
not completely portable (it will not be recognized by Solaris's ccs
make, for example), but most other operating systems ship GNU make
(Solaris, AIX), or BSD pmake (*BSD, Mac OS) as either the primary or
alternative make utility that this should an acceptable compromise,
since it makes running all of tests using something like "make -j8
check" or "make -j16 check" run *much* faster.

There are still some caveats if using BSD pmake; in particular, if the
configure script is run on a system which has GNU make (installed as
gmake on FreeBSD for example), the configure script will find it, and
enable some GNU make features in the Makefile, and the generated
makefiles *must* be built using gmake.  However, if isolated build
jail / chroot is used which only has pmake, the Makefiles should now
work with pmake.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-01-02 01:29:55 -05:00
Theodore Ts'o 94676ef2b3 Merge branch 'maint' into next 2015-11-30 18:16:36 -05:00
Andreas Dilger 19961cd000 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>
2015-11-30 15:26:35 -05:00
Darrick J. Wong f680db654b 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>
2015-11-30 15:22:07 -05:00
Darrick J. Wong 95eca2e922 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>
2015-07-22 00:06:43 -04:00
Theodore Ts'o e3dd5c6f1a 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>
2015-07-16 18:02:58 -04:00
Theodore Ts'o 4ecd63d786 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>
2015-07-16 15:07:59 -04:00
Theodore Ts'o 9e8fcd6e01 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>
2015-07-03 22:02:30 -04:00
Theodore Ts'o 149640fabc 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>
2015-07-03 16:29:35 -04:00
Andreas Dilger 23cb84c547 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>
2015-06-19 21:31:26 -04:00
Theodore Ts'o dc810decfa Merge branch 'maint' into next 2015-06-15 23:16:24 -04:00
Darrick J. Wong 117f9d03a6 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>
2015-06-10 20:02:39 -04:00
Darrick J. Wong 2f8c0d028c 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>
2015-06-10 20:01:24 -04:00
Darrick J. Wong 4f868703f6 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>
2015-06-10 19:57:52 -04:00
Eric Sandeen 7cb2ed25b1 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>
2015-05-23 18:39:04 -04:00
Theodore Ts'o 66eb45b965 tests: clean up the script for m_hugefile_slack
This test doesn't require resize2fs or debugfs, so remove those
checks.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-05-17 00:19:29 -04:00