Commit Graph

572 Commits (master)

Author SHA1 Message Date
Darrick J. Wong eb89a6287d e2fsck: write dir blocks after new inode when reconstructing root/lost+found
If we trash the root directory block, e2fsck will find inode 11 (the
old lost+found) and try to attach it to l+f.  The lost+found checker
also fails to find l+f and tries to add one to the root dir.  The root
dir is not found but is recreated with incorrect checksums, so linking
in the l+f dir fails and the l+f '..' entry isn't set.  Since both
dirs now fail checksum verification, they're both referred to rehash
to have that fixed, but because l+f doesn't have a '..' entry, rehash
crashes because l+f has < 2 entries.

On a checksumming filesystem, the routines in e2fsck that recreate
/lost+found and / must write the new directory block *after* the inode
has been written to disk because the checksum depends on i_generation.
Add a regression test while we're at it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-26 17:14:40 -04:00
Theodore Ts'o 22302aa320 Merge branch 'maint' into next
Conflicts:
	debugfs/debugfs.c
	e2fsck/pass1.c
2014-07-26 15:57:42 -04:00
Darrick J. Wong b729b7dfab e2fsck: reserve blocks for root/lost+found directory repair
If we think we're going to need to repair either the root directory or
the lost+found directory, reserve a block at the end of pass 1 to
reduce the likelihood of an e2fsck abort while reconstructing
root/lost+found during pass 3.

If / and/or /lost+found are corrupt and duplicate processing in pass
1b allocates all the free blocks in the FS, fsck aborts with an
unusable FS since pass 3 can't recreate / or /lost+found.  If either
of those directories are missing, an admin can't easily mount the FS
and access the directory tree to move files off the injured FS and
free up space; this in turn prevents subsequent runs of e2fsck from
being able to continue repairs of the FS.

(One could migrate files manually with debugfs without the help of
path names, but it seems easier if users can simply mount the FS and
use regular FS management tools.)

[ Fixed up an obvious C trap: const char * and const char [] are not
  the same thing when you are taking the size of the parameter.
  People, run your regression tests!  Like spinach, it's good for you.  :-)
  -- tytso ]

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-26 15:45:42 -04:00
Darrick J. Wong 97c607b1a2 libext2fs: provide a function to set inode size
Provide an API to set i_size in an inode and take care of all required
feature flag modifications.  Refactor the code to use this new
function.

[ Moved the function to lib/ext2fs/blk_num.c, which is the rest of
  these sorts of functions live, and renamed it to be
  ext2fs_inode_size_set() instead of ext2fs_inode_set_size() to be
  consistent with the other functions in in blk_num.c -- tytso ]

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-26 14:34:56 -04:00
Theodore Ts'o 50972e1f7d Merge branch 'maint' into next
Conflicts:
	debugfs/debugfs.c
	e2fsck/pass5.c
2014-07-26 09:46:50 -04:00
Theodore Ts'o a30a4e93f3 libext2fs: fix free block accounting for 64-bit file systems
We rely on a nasty hack to adjust the free block count where we pass
signed value into ext2fs_free_blocks_count_add(), which takes an
64-bit unsigned value, and relies on overflow and C's signed->unsigned
semantics to do the subtraction.  This works, so long as a 64-bit
signed value is used.

Unfortunately, ext2fs_block_alloc_stats2() and
ext2fs_block_alloc_stats_range(), this is not true, so on a 64-bit
file system, the free blocks accounting can get screwed up.

A simple way to demonstrate the problem is:

mke2fs -F -t ext4 -O 64bit /tmp/foo.img 1M
e2fsck -fy /tmp/foo.img

... which will result in the following e2fsck complaint:

Pass 5: Checking group summary information
Free blocks count wrong (4294968278, counted=982).
Fix? yes

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-26 09:25:40 -04:00
Theodore Ts'o 188949d7ce tests: use e2fsck -f instead of -p for resize tests
Using e2sck -f provides better debugging information if things go
wrong.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-26 00:48:29 -04:00
Darrick J. Wong cd32129d89 mke2fs: set error behavior at initialization time
Port tune2fs' -e flag to mke2fs so that we can set error behavior at
format time, and introduce the equivalent errors= setting into
mke2fs.conf.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-25 08:58:29 -04:00
Theodore Ts'o e05a05630a Merge branch 'maint' into next
Conflicts:
	e2fsck/pass1.c
	e2fsck/problem.h
2014-07-25 08:58:10 -04:00
Darrick J. Wong 57b7fabc2e e2fsck: clear uninit flag on directory extents
Directories can't have uninitialized extents, so offer to clear the
uninit flag when we find this situation.  The actual directory blocks
will be checked in pass 2 and 3 regardless of the uninit flag.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-25 08:50:23 -04:00
Darrick J. Wong c28c2741ba e2fsck: pass2 should not process directory blocks that are impossibly large
Currently, directories cannot be fallocated, which means that the only
way they get bigger is for the kernel to append blocks one by one.
Therefore, if we encounter a logical block offset that is too big, we
needn't bother adding it to the dblist for pass2 processing, because
it's unlikely to contain a valid directory block.  The code that
handles extent based directories also does not add toobig blocks to
the dblist.

Note that we can easily cause e2fsck to fail with ENOMEM if we start
feeding it really large logical block offsets, as the dblist
implementation will try to realloc() an array big enough to hold it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-25 08:41:11 -04:00
Darrick J. Wong 0733835bf7 e2fsck: always submit logical block 0 of a directory for pass 2
Always iterate logical block 0 in a directory, even if no physical
block has been allocated.  Pass 2 will notice the lack of mapping and
offer to allocate a new directory block; this enables us to link the
directory into lost+found.

Previously, if there were no logical blocks mapped, we would fail to
pick up even block 0 of the directory for processing in pass 2.  This
meant that e2fsck never allocated a block 0 and therefore wouldn't fix
the missing . and .. entries for the directory; subsequent e2fsck runs
would complain about (yet never fix) the problem.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-25 08:39:45 -04:00
Theodore Ts'o 60203cb171 Merge branch 'maint' into next
Conflicts:
	e2fsck/pass1.c
2014-07-25 08:38:39 -04:00
Darrick J. Wong 9f005a90f8 e2fsck: collapse holes in extent-based directories
If we notice a hole in the block map of an extent-based directory,
offer to collapse the hole by decreasing the logical block # of the
extent.  This saves us from pass 3's inefficient strategy, which fills
the holes by mapping in a lot of empty directory blocks.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-25 08:30:11 -04:00
Darrick J. Wong 203e13cf9c libext2fs: fix bounds check of the bitmap test range in get_free_blocks2
In the loop in ext2fs_get_free_blocks2, we ask the bitmap if there's a
range of free blocks starting at "b" and ending at "b + num - 1".
That quantity is the number of the last block in the range.  Since
ext2fs_blocks_count() returns the number of blocks and not the number
of the last block in the filesystem, the check is incorrect.

Put in a shortcut to exit the loop if finish > start, because in that
case it's obvious that we don't need to reset to the beginning of the
FS to continue the search for blocks.  This is needed to terminate the
loop because the broken test meant that b could get large enough to
equal finish, which would end the while loop.

The attached testcase shows that with the off by one error, it is
possible to throw e2fsck into an infinite loop while it tries to
find space for the inode table even though there's no space for one.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-25 07:11:57 -04:00
Darrick J. Wong 35c8faaffc e2fsck: don't clobber critical metadata during check_blocks
If we encounter an inode with IND/DIND/TIND blocks or internal extent
tree blocks that point into critical FS metadata such as the
superblock, the group descriptors, the bitmaps, or the inode table,
it's quite possible that the validation code for those blocks is not
going to like what it finds, and it'll ask to try to fix the block.
Unfortunately, this happens before duplicate block processing (pass
1b), which means that we can end up doing stupid things like writing
extent blocks into the inode table, which multiplies e2fsck'
destructive effect and can render a filesystem unfixable.

To solve this, create a bitmap of all the critical FS metadata.  If
before pass1b runs (basically check_blocks) we find a metadata block
that points into these critical regions, continue processing that
block, but avoid making any modifications, because we could be
misinterpreting inodes as block maps.  Pass 1b will find the
multiply-owned blocks and fix that situation, which means that we can
then restart e2fsck from the beginning and actually fix whatever
problems we find.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-23 12:11:23 -04:00
Darrick J. Wong 7ba5cc744b debugfs: fix printing of inline data during symlink inode dump
When we're dumping a fast symlink inode, we print some odd things to
stdout.  To clean this up, first don't print inline data EA, since the
inode dump doesn't display file and directory contents.  Then, teach
the inode dump function how to print out either an inline data fast
symlink or a non-inline data fast symlink.

(This is a follow-up to the earlier patch "debugfs: Only print the
first 60 bytes from i_block on a fast symlink")

[ Modified by tytso so that the d_inline_dump test works when build
  directory is different from the source directory --- i.e., when
  doing a VPATH build. ]

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-22 18:44:33 -04:00
Theodore Ts'o 7f7d1cb462 Merge branch 'maint' into next
Conflicts:
	debugfs/set_fields.c
	tests/f_mmp/script
	tests/f_mmp_garbage/script
	tests/m_mmp/script
	tests/t_mmp_1on/script
	tests/t_mmp_2off/script
2014-07-06 00:09:27 -04:00
Theodore Ts'o bdeb2dba29 tests: avoid using mktemp -t
The -t option is documented as deprecated in GNU's mktemp, and
FreeBSD's mktemp doesn't support it at all.

Replace it with the construct "mktemp ${TMPDIR:-/tmp}/foo.XXXXXX"

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-04 16:39:49 -04:00
Theodore Ts'o 0b5610e0fa tests: clean up the temp file if test_one is interrupted
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-04 16:39:49 -04:00
Theodore Ts'o 358c94ab33 tests: fix left-over e2fsprogs-tmp files not getting clean up
In addition, incorporate the test name into the e2fsprogs-tmp to make
it easier to debug left-over temp files in the future.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-04 16:39:49 -04:00
Benno Schulenberg 9e9e7b4a02 tests: for mktemp the exes must be the final characters of the name
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-07-04 16:39:49 -04:00
Benno Schulenberg 1301def84c e2fsck: make a prompt message simpler and thus translatable
It can be made simpler because there is no need to differentiate between
having an internal journal inode and having an external journal device.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-06-03 22:04:28 -04:00
Theodore Ts'o 6bb8845953 Merge branch 'maint' into next
Conflicts:
	debugfs/debugfs.c
2014-05-27 12:38:23 -04:00
Eric Sandeen 2eb0ed09d9 e2fsprogs: don't run quota test if quota is not enabled
The default configuration still has quota disabled, but
runs the f_quota test unconditionally, so we fail by
default.

Fix that...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-05-27 12:12:05 -04:00
Andreas Dilger 90c5b4c9de debugfs: fix string_to_time for MacOS strptime()
The strptime() function does not update fields in struct tm that are
not specified in the input format.  The glibc implementation sets the
tm_yday field (%j) when any of the year (%Y), month (%m), or day (%d)
fields are changed, but the MacOS strptime() does not set tm_yday in
this case.  This caused string_to_time() to calculate the wrong Unix
epoch on MacOS. If tm_yday is unset, compute it in string_to_time().

This also fixes test regression failures for FreeBSD.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-05-22 17:52:23 -04:00
Theodore Ts'o ba08cb996a Merge branch 'maint' into next
Conflicts:
	debugfs/Makefile.in
	debugfs/debug_cmds.ct
	debugfs/debugfs.c
	debugfs/debugfs.h
	e2fsck/Makefile.in
	misc/Makefile.in
	misc/mke2fs.c
2014-05-13 11:01:07 -04:00
Theodore Ts'o 1c358e6e12 quota: remove mke2fs's and tune2fs's warning messages regarding quota
We no longer need to reference https://ext4.wiki.kernel.org/index.php/Quota
since we've fixed the nasty bugs associated with e2fsck and the quota
feature.  The wiki page will be updated once we've done a release that
includes these fixes indicated the verison which these problems have
been fixed.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
2014-05-13 10:13:33 -04:00
Theodore Ts'o 133d9fbff3 tests: add basic e2fsck regression test for fixing the quota inode
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
2014-05-13 10:13:26 -04:00
Darrick J. Wong a1ff15f83b debugfs: teach logdump to deal with 64bit revoke tables
The logdump command doesn't know how to deal with revoke tables in
64bit journals, so teach it to do this.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-05-11 21:04:17 -04:00
Darrick J. Wong a46300fe70 misc: create better-packaged static analysis reports
Fix some minor bugs relating to passing CFLAGS to cppcheck, and
package the cppcheck output into nicer looking reports.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-05-11 18:32:07 -04:00
Theodore Ts'o c9bc7484cc Merge branch 'maint' into next
Conflicts:
	e2fsck/pass1.c
2014-05-11 18:30:11 -04:00
Theodore Ts'o 45a78b88db resize2fs: refine minimum required blocks for flex_bg file systems
The previous commit exposed bugs in the calculation for flex_bg file
systems.  The problem is that since (by default) we keep the metadata
blocks for the flex_bg in the first block group of the flex_bg, and
because we don't want to overwrite metadata blocks used by the
original file system with data blocks make life easier in case the
resize is aborted for some reason, we need to treat all of the
metadata blocks in the existing flex_bg has in use for the purposes of
calculate_minimum_resize_size().

Even though this means we need to reserve more data blocks to avoid
running out of space, the net result of these two commits is a net
savings in how much we can shrink a file system.

Using the following test sequence:

	mke2fs -F -t ext4 /tmp/foo.img 2T
	resize2fs -M /tmp/foo.img
	resize2fs -M /tmp/foo.img
	resize2fs -M /tmp/foo.img

Here is the comparison in the resulting file systems between the old
and new resize2fs (units are in 4k blocks):

                resize #1  resize #2   resize #3
old resize2fs    1117186     45679       43536
new resize2fs      48784     37413       37392

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-05-04 23:15:49 -04:00
Theodore Ts'o 6d82e1f4c7 mke2fs: only print the low-level file system stats in verbose mode
Also print the file system UUID if it is non-NULL.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-05-04 23:15:29 -04:00
Theodore Ts'o 71715a5a9a Merge branch 'maint' into next 2014-04-20 08:31:24 -04:00
Andreas Dilger 5bb66e37d6 tests: fix resize test tmpfs max-file-size checking
Old distros may not have the "truncate" tool, so use "dd" instead.

If tmpfs cannot handle a 2GB temp file (e.g. old RHEL5 and SLES 11
kernels) then skip the test instead of failing it.  If this fails,
try to report better error messages instead of failing silently.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-04-14 13:51:24 -04:00
Darrick J. Wong 28b966d7c6 e2fsck: print runs of duplicate blocks instead of all of them
When pass1 finds blocks that are mapped to multiple files, it will
print every duplicated block.  If there are long sequences of
duplicate blocks (e.g. the e_pblk field is wrong in an extent), this
can cause a gigantic flood of output when a range could convey the
same information.  Therefore, teach pass1b to print ranges when
possible.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-03-15 12:12:37 -04:00
Darrick J. Wong f1605243a4 all: Introduce cppcheck static checking for make C=1
Introduce more static checking via cppcheck.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-03-14 09:32:50 -04:00
Darrick J. Wong 227239b10b debugfs: create commands to edit extended attributes
Enhance debugfs to be able to display and modify extended attributes, and
create some simple tests for the extended attribute editing functions.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-03-11 23:50:08 -04:00
Zheng Liu 356b448701 tests: change result in f_bad_disconnected_inode
In this test, inode flag is some random data, and after we apply inline
data patch set we should need to handle it.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-03-04 08:46:15 -05:00
Darrick J. Wong 5beff1c0cf debugfs: dump all extended attributes
Use the new extended attribute APIs to display all extended attributes
(current code does not look in the EA block) and display full names
(current code ignores name index too).

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-02-23 23:08:48 -05:00
Theodore Ts'o 3ba59bf649 Merge branch 'maint' into next 2014-02-23 23:07:38 -05:00
Theodore Ts'o fedfb27fe5 Add coverage testing using gcov
To check the coverage of e2fsprogs's regression test, do the
following:

	configure --enable-gcov
	make -j8 ; make -j8 check ; make coverage.txt

The coverage information will be the coverage.txt and *.gcov files in
the build directories.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-02-23 00:17:09 -05:00
Theodore Ts'o dc084ab7b1 Merge branch 'maint' into next 2014-02-20 21:39:29 -05:00
Andreas Dilger 3b97799c74 tests: skip unsupported tests on MacOS systems
The "mkswap" program is not available on MacOS, so just use the
existing swap0.img.bz2 and swap1.img.bz2 files directly.

Because MacOS HFS+ doesn't support sparse files (welcome to the 80's)
the m_bigjournal test takes forever to zero out the whole 42GB test
filesystem.  Skip this test for Darwin kernels for now.

Unfortunately, neither "df -T" nor "stat -f -c %T" is available on
MacOS to directly determine the filesystem type, and I'm too lazy
to parse the output of "mount" and match it to the path of the test
directory in shell, so it just checks the kernel type and assumes
the filesystem type is HFS and skips the test.

Since this test runs on Linux the majority of the time, the loss of
test coverage is minimal.  If MacOS should ever get a real filesystem,
this can be revisited.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-02-18 18:30:00 -05:00
Theodore Ts'o f0996c12d5 Merge branch 'maint' into next
Conflicts:
	lib/ext2fs/alloc.c
	misc/mke2fs.c
2014-01-30 19:05:16 -05:00
Darrick J. Wong 454e6e0c74 tests: adjust test output to reflect block_uninit calculated block bitmaps
Now that libext2fs marks group metadata in the fs block bitmap, adjust
the expected test output to reflect expanded use of block_uninit and
the fact debugfs no longer prints block bitmap data that fails to
account for group data blocks.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2014-01-11 14:15:52 -05:00
Theodore Ts'o bc82f39437 Merge branch 'maint' into next
Conflicts:
	e2fsck/pass1.c
	lib/ext2fs/csum.c
2014-01-09 12:25:37 -05:00
Theodore Ts'o 5a1d25a7b2 Fix up workarounds for dietlibc breakage
The dietlibc doesn't support the TZ environment variable, which is
required by the standard.  Work around this so that we can run the
regression test suite when building with dietlibc.  (This is useful
for finding problems.)

With this change, the only thing which doesn't work as far as dietlibc
is concerned is the posix_memalign test, and the MMP support tests
(because posix_memalign isn't provided by dietlibc, sigh.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-01-09 12:22:03 -05:00
Theodore Ts'o d2dce124dd Merge branch 'maint' into next
Conflicts:
	debian/changelog
	e2fsck/Makefile.in
2014-01-06 06:58:58 -05:00
Theodore Ts'o 6c59a665da configure: fix --with-diet-libc
Newer versions of autoconf pull in AC_PROG_GCC as part of
AC_CANONICAL_HOST.  So we need check for WITH_DIET_LIBC earlier in
configure.in.

Also, e2fsprogs now needs functions which are found in diet libc's
compat library.  So add support for autoconf's LIBS function, and
automatically set libs to include -lcompat.

Finally, disable compiling e4defrag by deault if --with-diet-libc is
specified because the program has too many glibc dependencies.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-01-05 22:58:16 -05:00
Theodore Ts'o c32409aec6 e2fsck: improve the "superblock corrupt" message
Previously, this message used 8193 as the example alternate
superblock.  But for most file systems, the backup superblock is
located at 32768 (since most file systems have a block size of 4k, and
not 1k).

Addresses-Debian-Bug: #719185

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2014-01-04 19:11:30 -05:00
Theodore Ts'o 9c846766fd Merge branch 'maint' into next
Conflicts:
	RELEASE-NOTES
	debian/changelog
	version.h
2013-12-28 23:27:39 -05:00
Theodore Ts'o 9f90b2e632 tests: fix stray newline printed when running r_min_itable
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-12-26 00:37:09 -05:00
Theodore Ts'o 2ffccc82c4 Merge branch 'maint' into next
Conflicts:
	lib/ext2fs/csum.c
2013-12-26 00:30:56 -05:00
Phillip Susi 22b83f6280 e2image: perform in-place move
If given at least one offset and only one file, assume source
and dest are the same, and do an in place move.

Signed-off-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-12-26 00:20:40 -05:00
Theodore Ts'o aafd361550 tests: use the in-tree binaries in the test f_extent_oobounds
Fix the f_extent_oobounds test so that it uses binaries built in the
tree, instead of the binaries in the system PATH (which might not
exist in a chroot environment) when creating the test image.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-12-24 22:50:23 -05:00
Andreas Dilger 2bc3041754 debugfs, e2fsck: fix s_desc_size handling
The s_desc_size in the superblock specifies the group descriptor
size in bytes, but in various places the EXT4_FEATURE_INCOMPAT_64BIT
flag implies that the descriptor size is EXT2_MIN_DESC_SIZE_64BIT
(64 bytes) instead of checking the actual size.  In other places,
the s_desc_size field is used without checking for INCOMPAT_64BIT.

In the case of ext2fs_group_desc() the s_desc_size was being ignored,
and assumed to be sizeof(struct ext4_group_desc), which would result
in garbage for any but the first group descriptor.  Similarly, in
ext2fs_group_desc_csum() and print_csum() they assumed that the
maximum group descriptor size was sizeof(struct ext4_group_desc).
Fix these functions to use the actual superblock s_desc_size if
INCOMPAT_64BIT.

Conversely, in ext2fs_swap_group_desc2() s_desc_size was used
without checking for INCOMPAT_64BIT being set.

The e2fsprogs behaviour is different than that of the kernel,
which always checks INCOMPAT_64BIT, and only uses s_desc_size to
determine the offset of group descriptors and what range of bytes
to checksum.

Allow specifying the s_desc_size field at mke2fs time with the
"-E desc_size=NNN" option.  Allow a power-of-two s_desc_size
value up to s_blocksize if INCOMPAT_64BIT is specified.  This
is not expected to be used by regular users at this time, so it
is not currently documented in the mke2fs usage or man page.

Add m_desc_size_128, f_desc_size_128, and f_desc_bad test cases to
verify mke2fs and e2fsck handling of larger group descriptor sizes.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-12-24 22:50:19 -05:00
Andreas Dilger fd5e00e1d0 tests: delete temporary resize test files
Since commit 5ad07acad if $TMP cannot hold large test filesystems
for resize testing the resize_test creates temporary test files
in the local working directory.  Since it overrides TMPFILE locally
the calling program does not delete the generated file correctly.

Delete the large $TMPFILE within resize_test if it passes, but leave
it for debugging if the test failed.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-12-23 16:01:56 -05:00
Theodore Ts'o 2fae17697a Merge branch 'maint' into next
Conflicts:
	e2fsck/pass2.c
	e2fsck/pass3.c
2013-12-03 00:24:39 -05:00
Andreas Dilger 5ad07acadc tests: check backing filesystem can handle large file
The new resize tests create 2TB test files, but tmpfs in kernels
before 3.1 have a max file size of 256GB.  Ext3 may also have
a size limit for smaller blocksize filesystems.

Fix the resize_test script to verify that $TMPFILE can be resized
to the final test size, and if that fails try creating the file on
the local filesystem instead of in $TMPDIR.  If that cannot hold
the large filesystem, skip the test.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Tested-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-12-03 00:11:55 -05:00
Theodore Ts'o 1586850bcd Merge branch 'maint' into next 2013-10-14 09:57:23 -04:00
Niu Yawei 43075b42bd quota: fix disabling quota, add quota tests
Update all superblock copies when disabling the quota feature.

Added basic tests for the quota feature.

Signed-off-by: Niu Yawei <niu@whamcloud.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-10-14 09:54:28 -04:00
Theodore Ts'o e7619b71c0 tests: add new test t_uninit_bg_rm
This test checks tune2fs's support for removing the uninit_bg feature
flag.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-10-12 23:08:02 -04:00
Theodore Ts'o e337e7fad8 Merge branch 'maint' into next
Conflicts:
	e2fsck/problem.c
	e2fsck/rehash.c
	e2fsck/super.c
2013-10-12 22:26:28 -04:00
Theodore Ts'o 128c943ef2 tests: remove version number dependency in r_min_itable
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-10-12 22:25:29 -04:00
Darrick J. Wong 832cb612f8 e2fsprogs: add (optional) sparse checking to the build
Run sparse against source files when building e2fsprogs with 'make C=1'.  If
instead C=2, it configures basic ext2 types for bitwise checking with sparse,
which can help find the (many many) spots where conversion errors are
(possibly) happening.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-10-11 23:12:40 -04:00
Theodore Ts'o 7447da02f0 tests: add test for resize2fs -M with inode table in middle of block group
Eric Sandeen reported that Fedora's mke2fs when compiled for ppc was
creating a file system which caused problems with resize2fs -M.
Closer examination showed that the problem was file system which
looked like this:

Filesystem features:      ext_attr dir_index filetype sparse_super
Inode count:              512
Block count:              1247
   ...

Group 0: (Blocks 1-1024)
  Primary superblock at 1, Group descriptors at 2-2
  Block bitmap at 66 (+65), Inode bitmap at 67 (+66)
  Inode table at 68-99 (+67)

Group 1: (Blocks 1025-1246)
  Backup superblock at 1025, Group descriptors at 1026-1026
  Block bitmap at 1090 (+65), Inode bitmap at 1091 (+66)
  Inode table at 1092-1123 (+67)

It's not obvious to me why Fedora's ppc mke2fs is creating file
systems like this (I can't reproduce this on debian ppc systems), but
resize2fs -M should be able to deal with such file systems, which is
what this test is designed to check.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-09-30 23:07:27 -04:00
Eric Whitney d45170717a tests: add another test for uninit extents past eof
Commit d3f32c2db8 was intended to detect extents found outside their
proper location in the extent tree, including invalid extents at the
end of an extent block.  However, it incorrectly reported legal
uninitialized extents created by fallocate() at the end of file with
the FALLOC_FL_KEEP_SIZE flag as false positives.  xfstests
generic/263 (among others) caught this problem, while the e2fsprogs
test f_uninit_ext_past_eof did not.  The latter test failed to
detect the problem in part because it uses a test file whose i_size
is 0.

Add a test derived from the fsx-based test case in xfstests
generic/263 consisting of a file with non-zero length, more than
four extents total, and two uninitialized extents past EOF to
reliably reproduce commit d3f32c2db8's false positive behavior.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-09-26 20:17:09 -04:00
Theodore Ts'o fc9f162eea Merge branch 'maint' into next 2013-09-09 20:49:49 -04:00
Theodore Ts'o c8ec2bad18 e2fsck: correctly deallocate invalid extent-mapped symlinks
The function deallocate_inode() in e2fsck/pass2.c was buggy in that it
would clear out the inode's mode and flags fields before trying to
deallocate any blocks which might belong to the inode.

The good news is that deallocate_inode() is mostly used to free inodes
which do not have blocks: device inodes, FIFO's, Unix-domain sockets.

The bad news is that if deallocate_inode() tried to free an invalid
extent-mapped inode, it would try to interpret the root of the extent
node as block numbers, and would therefore mark various file system
metadata blocks (the superblock, block group descriptors, the root
directory, etc.) as free and available for allocation.  This was
unfortunate.

(Try running an older e2fsck against the test file system image in the
new test f_invalid_extent_symlink, and then run e2fsck a second time
on the fs image, and weep.)

Fortunately, this kind of file system image corruption appears to be
fairly rare in actual practice, since it would require a very unlucky
set of bits to be flipped, or a buggy file system implementation.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-07-28 22:03:01 -04:00
Theodore Ts'o dd50ef8743 e2fsck: check extent-mapped directories with really large logical blocks
E2fsck was missing a check for directories with logical blocks so
large that i_size > 2GB.  Without this check the test image found in
the new test f_toobig_extent_dir will cause e2fsck to die with a
memory allocation failure:

Error storing directory block information (inode=12, block=0, num=475218819): Memory allocation failed
e2fsck: aborted

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: Andrey Melnikov <temnota.am@gmail.com>
2013-07-28 21:03:00 -04:00
Theodore Ts'o 38cc555a5f Merge branch 'maint' into next 2013-07-08 12:14:45 -04:00
Theodore Ts'o 42b61c50e5 libext2fs, tests: allow /etc/mtab file to be missing
The environment variable EXT2FS_NO_MTAB_OK will suppress the error
code EXT2_NO_MTAB_FILE when the /etc/mtab file can not be found.  This
allows the e2fsprogs regression test suite to be run in chroots which
might not have an /etc/mtab file.

By default will still want to complain if the /etc/mtab file is
missing, since we really don't want to discourage distributions and
purveyors of embedded systems from running without an /etc/mtab file.
But if it's missing it only results in a missing sanity check that
might cause file system corruption if the file system is mounted when
programs such as e2fsck, tune2fs, or resize2fs is running, so there is
no potential security problems that might result if this environment
variable is set inappropriately.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-07-08 12:08:44 -04:00
Theodore Ts'o 8b9eb12807 Merge branch 'maint' into next
Conflicts:
	RELEASE-NOTES
	e2fsck/Makefile.in
	lib/config.h.in
	version.h
2013-06-16 18:54:01 -04:00
Andreas Dilger dc9cc7006a mke2fs: don't set root dir UID/GID automatically
Don't change the root directory's UID/GID automatically just because
mke2fs was run as a non-root user.  This can be confusing for users,
and is not flexible for non-root installation tools that need to
create a filesystem with different ownership from the current user.

Add the "-E root_owner[=uid:gid]" option to mke2fs so that the user
and group can be explicitly specified for the root directory.  If
the "=uid:gid" argument is not specified, the current UID and GID
are extracted from the running process, as was done in the past.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-06-15 21:51:33 -04:00
Andreas Dilger 2a83b3c374 mke2fs: sort option parsing, deprecate "-R"
A minor cleanup to order the command-line option parsing in
alphabetical order, except for "-E" and "-R", which need to
be co-located.

Print a message that the "-R" option is deprecated.  It has
been deprecated since 2005 (commit c6a44136b9).

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-06-15 18:47:30 -04:00
Andreas Dilger f9fd342e56 tests: clean up sed filtering of test output
The sed filters for test outputs that are used to remove build and
test specific information (such as version strings, dates, times,
UUIDs) were unconditionally deleting the first line of output.  This
would normally contain the tool version string, but in some cases
contained other information that was being lost.  This can lead to
difficulty debugging test failures.

The sed filtering has been changed to only remove the actual version
strings.  As well, similar filter strings were duplicated throughout
many scripts, and "sed" and "tr" were often called multiple times in
a pipeline.  These have been consolidated into a single filter.sed
file to avoid having to maintain these filters in multiple places.

In a few cases, accidentally deleted messages have been restored to
the expect output for the tests.  In other cases, trivial whitespace
has been changed in the expect files.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-06-15 18:44:09 -04:00
Theodore Ts'o e07b71f294 Merge branch 'maint' 2013-06-08 17:02:54 -04:00
Theodore Ts'o e2e389a1d5 tests: add new test f_extent_oobounds
This tests creates a file system where the last entry in one leaf
block overlaps with logical block range in the first entry of the next
leaf block.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-06-06 23:53:31 -04:00
Theodore Ts'o 29f6dfea52 Merge branch 'maint' into next 2013-05-16 11:05:37 -04:00
Theodore Ts'o 5dfd5ef88d tests: add new test f_zero_xattr
E2fsck previously was complaining with zero-length extended attributes
if they appeared in the in-inode xattr space.  Test to make sure
e2fsck is now happy with such xattrs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-04-25 00:29:09 -04:00
Theodore Ts'o 07bcd90f3d Merge branch 'maint' into next 2013-04-22 00:07:08 -04:00
Theodore Ts'o 9bd95a472c crcsum: remove the -b option since ext2fs_crc32c_be is dropped in 1.43.x
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-04-22 00:04:36 -04:00
Theodore Ts'o e79a9395b3 tests: add more tests for off-line resizing
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-03-31 20:41:23 -04:00
Theodore Ts'o 28e6662403 tests: create crcsum progam to support resizing tests
The only checksum program which we can reliably count upon being
installed on all systems is "sum", which is not a particular robust
checksum.  The problem with using md5sum or sha1sum is it hat it may
not be installed on all systems.  So create a crcsum program which is
used so we can validate that a data file on a resized file system has
not been corrupted.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-03-31 20:41:23 -04:00
Theodore Ts'o 7b68fa38b8 Merge branch 'maint' into next
Conflicts:
	RELEASE-NOTES
	lib/ext2fs/ext2_err.et.in
	version.h
2013-01-16 14:14:09 -05:00
Theodore Ts'o 390e49aab7 tests: create test for debugfs creating special files
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-16 14:09:20 -05:00
Theodore Ts'o ab83252174 Merge branch 'maint' into next
Conflicts:
	e2fsck/problem.c
	e2fsck/problem.h
2012-12-24 10:50:20 -05:00
Theodore Ts'o b4944f654c tests: add test of an incorrect interior node in an extent tree
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-12-20 21:48:08 -05:00
Theodore Ts'o 2f2a048b1d Merge branch 'maint' into next 2012-09-22 21:35:46 -04:00
Theodore Ts'o c498cb11d3 mke2fs: fix progress suppression to make regression tests reliable
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-09-22 21:26:48 -04:00
Theodore Ts'o 43c67c4f73 Merge branch 'maint' into next
Conflicts:
	debian/changelog
	version.h
2012-09-21 12:55:45 -04:00
Theodore Ts'o b2f5ce5516 mke2fs: throttle allocating groups progress as well
Throttle updates for the "Allocating Groups" progress updates to once
a second as well.  We now do this throttling in libext2fs, so we don't
have to do this for each of mke2fs's progress updates, and because the
updates from ext2fs_allocate_tables() come from within libext2fs
anyway.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-09-21 12:50:04 -04:00
Theodore Ts'o 32dd6cdbe5 Merge branch 'maint' into next
Conflicts:
	resize/resize2fs.c
2012-09-16 22:06:29 -04:00
Andreas Dilger 12f48b0caa tests: kill debugfs on interrupted MMP test
If the f_mmp test is interrupted during its test run, then it can
leave debugfs busy-looping in the background.  Since f_mmp is a
relatively long-running test, and is likely to be running during
a parallel test run, this can happen fairly often.

Set a signal trap for the f_mmp test script being killed, so that
the background debugfs command will always be killed by the test.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-09-16 22:05:21 -04:00
Theodore Ts'o a3e87bcc32 mke2fs: disable progress reporting in mke2fs.conf for regression tests
Add a configuration knob so the regression tests can disable progress
reporting.  This fixes a potential lack of predictability since the
progress reports are now time based (once a second) which is
problematic for regression tests which are comparing the expected
output of mke2fs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-09-16 20:43:07 -04:00
Andreas Dilger 03b10639e7 tests: remove unused temporary files for MMP tests
The MMP tests need to be run on a real disk instead of tmpfs, since
the MMP block access is using O_DIRECT.  As such, they create their
own test files in the local testing directory instead of using the
temporary file created in /tmp by the test_one script.  Delete the
tempfs file before clobbering TMPFILE, otherwise it will leave the
unused file in /tmp after the test is completed.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-08-15 16:44:59 -04:00
Andreas Dilger ff07d436fc tests: allow e2fsck tests to run on OS/X
The "mktemp" program requires a template on OS/X.  Allow the test
TMPFILE to be created in the local /tmp directory for both OS/X
and Linux.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-06-12 13:59:56 -04:00
Theodore Ts'o e130a16e83 tests: add two more tests of orphaned inode handling
Add two tests, f_orphan_indirect_inode, and f_orphan_extents_inode,
which tests the bug fixes in the two previous commits:

e2fsck: update global free blocks/inodes count when truncating orphan inodes
libext2fs: fix block iterator for extents when truncating inodes

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-06-12 01:38:57 -04:00
Tao Ma 8d12c46a22 tests: add new test f_zero_extent_length
If all of the extents in the last extent tree block (ETB) in a
non-trivial extent tree contain uninitialized extents which are after
the end of the file as defined by i_size, the hueristics will
incorrectly estimate the last entry (and hence the node's e_len field)
in the last entry of each level of the extent tree.

As Tao Ma has noted, since e2fsck was requiring that the length
(e_len) field of interior nodes be non-zero, this was causing false
failures where e2fsck would declare that the extent tree was
corrupted.

This was fixed in commit 9c40d14841: "e2fsck: only check for
zero-length leaf extents".  Add a regression test case to ensure that
this issue remains fixed.

Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-06-11 01:06:50 -04:00
Theodore Ts'o eb92f5741f tests: fix the e2fsck test script to handle a missing test name
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-05-31 20:13:51 -04:00
Theodore Ts'o be1b8c6fe8 tests: add new test to validate errno handling in the journal superblock
Add a new regression test f_jnl_errno

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-05-31 20:12:35 -04:00
Andreas Dilger f3331df6bb tests: use make rules to run tests in parallel
Change the e2fsck/mke2fs/tune2fs/e2image/debugfs regression tests to
be driven by Makefile rules instead of by a script loop.  This allows
the tests to be run in parallel like a build and reduces testing time
significantly.

One major change to the tests themselves is to printing the test name,
description, and status together after the test has passed or failed,
to avoid mixing lines from the tests.  The other major change is to
use unique temporary filenames for each test, which was mostly handled
already via b4db1e4c74, but in some
cases temporary files are changed to use $test_name.tmp to avoid any
collision between running tests.

On my old 2-CPU system it reduced the testing time from 160s to 40s.
Much of the savings is from the MMP test delays running in parallel.
It still takes the time of the slowest test, f_mmp_garbage, though
there will be ongoing benefit in the future as more tests are added
since the wallclock time will not increase linearly for each test.

Tests were run with various combinations of "make -j", and "make -j2"
through "make -j44" repeatedly without any test failures.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-05-29 08:41:26 -04:00
Theodore Ts'o 108e6581fc tests: fix f_jnl_64bit so that it actually has a 64-bit journal
The previous image did not have a 64-bit journal so it wouldn't
properly test the 64-bit journal format.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-05-21 11:03:16 -04:00
Matthias Andree 21af16f404 Fix bashisms
These break the self-test suite on *BSD, and on some Linux distros
where /bin/sh is not implemented by bash.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-05-11 22:13:21 -04:00
Theodore Ts'o 65ee799fbe tests: add new tests f_jnl_32bit and f_jnl_64bit
Add regression tests which make sure e2fsprogs understands the current
32-bit and 64-bit journal format.  If a patch breaks the on-disk
format, these tests should warn us about that.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-05-02 16:28:48 -04:00
Theodore Ts'o 7a069f1ca9 tests: add new test f_eofblocks
Since we have changed the eofblocks handling in e2fsck (by removing
the need for the EOFBLOCKS_FL flag), we should have a test to check
out how we handle uninitialized and initialized blocks which are exist
beyond i_size, with files that have (and don't have) the EOFBLOCKS_FL.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-04-10 23:50:37 -04:00
Lukas Czerner 010dc7b90d e2fsck: remove EXT4_EOFBLOCKS_FL flag handling
We've decided to remove EOFBLOCKS_FL from the ext4 file system entirely,
because it is not actually very useful and it is causing more problems
than it solves. We're going to remove it from e2fsprogs first and then
after the new e2fsprogs version is common enough we can remove the
kernel part as well.

This commit changes e2fsck to not check for EOFBLOCKS_FL. Instead we
simply search for initialized extents past the i_size as this should not
happen. Uninitialized extents can be past the i_size as we can do
fallocate with KEEP_SIZE flag.

Also remove the EXT4_EOFBLOCKS_FL from lib/ext2fs/ext2_fs.h since it is
no longer needed.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-03-22 19:42:11 -04:00
Theodore Ts'o 010c49cf49 e2fsck: report ext2fs_open2() and ext2fs_check_desc() errors
Print the actual errors returned by ext2fs_open2() and
ext2fs_check_desc() before we fall back to the backup block group
descriptors so that it's easier to see if there is some obscure
failure that is causing e2fsck to think that it should use the backup
block group descriptors.

Addresses-Google-Bug: #6208183

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-03-21 23:40:24 -04:00
Andreas Dilger 0f30deb3b0 tests: have "make testnew" target use local mke2fs
The "make testnew" target in the tests/ subdirectory (used to
help create new test cases) should use the locally-built mke2fs
binary instead of the installed system binary, to avoid cases
where the system binary does not support some new functionality
being tested.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-03-18 23:48:45 -04:00
Theodore Ts'o b9a64a519a e2fsck: print the current and expected block group checksums
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-03-15 19:29:19 -04:00
Theodore Ts'o 26c09eb814 e2fsck: check for zero length extent
If an extent has e_len set to zero, the kernel will oops with a
BUG_ON.  Unfortunately, e2fsck wasn't catching this case.  The kernel
needs to be fixed to notice this case and call ext4_error() instead of
failing an assertion check, but e2fsck should catch this case and
repair it (by deleting the errant extent).

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-03-11 23:31:38 -04:00
Andreas Dilger 454ac9d56a libext2fs: quiet spurious group checksum errors
If we have to read the backup group descriptor checksums, the UNINIT
flags are cleared to ensure that all of the inodes in the filesystem
are scanned.  However, the code that reset the UNINIT flags did not
reset the group checksum, and this produced many spurious error
messages in e2fsck.

Group descriptor 0 checksum is invalid.  FIXED.
Group descriptor 1 checksum is invalid.  FIXED.
:
:

Recompute checksums after modifying group descriptors to avoid these
error messages.  Remove expected error messages in f_illitable_flexbg.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-02-07 21:11:21 -05:00
Theodore Ts'o 1f572d1f88 libext2fs: display partial path if fs corrupted in ext2fs_get_pathname()
The function ext2fs_get_pathname() used to return EXT2_ET_NO_DIRECTORY
if one of the directories in an inode's pathname is not a directory.
This is not very useful in an emergency, when the file system is
corrupted.  This commit will cause ext2fs_get_pathname() to return a
partial pathname, which should help system administrators trying to
use debugfs to investigate a corrupted file system.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-01-17 15:38:31 -05:00
Theodore Ts'o 499d5ec558 Update Release Notes, Changelogs, version.h, etc. for 1.42 release
Also fixed depfix.sed

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-29 16:48:14 -05:00
Theodore Ts'o ebd0a16a24 tests: add test case for multiply claimed blocks with bigalloc
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-28 11:03:08 -05:00
Eric Sandeen 6d26887991 tests: fix mmp tests on hard 4k devices
Several of the mmp tests were failing on an s390 guest because
direct IO cannot be done on sub-sector sizes, and they were
doing 1k IOs to files on a 4k logical/physical device.

A few tests could just be changed to 4k, but others
needed fixed up output as well.

With this I have all tests passing on s390 again.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-11 21:11:43 -05:00
Theodore Ts'o 0c80c44bd0 libext2fs: ext2fs_[set_]file_acl_block needs to check for 64-bit feature flag
The ext2fs_file_acl_block() and ext2fs_set_file_acl_block() needs to
only check i_file_acl_high if the 64-bit flag is set.  This is needed
because otherwise we will run into problems on Hurd systems which
actually use that field for h_i_mode_high.

This involves an ABI change since we need to pass ext2_filsys to these
functions.  Fortunately these functions were first included in the
1.42-WIP series, so it's OK for us to change them now.  (This is why
we have 1.42-WIP releases.  :-)

Addresses-Sourceforge-Bug: #3379227

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-16 20:46:49 -04:00
Theodore Ts'o 86db36abfb e2fsck: avoid unnecessary reboots in some cases when checking the root fs
If e2fsck modifies certain superblock fields which the kernel doesn't
look at, mark the superblock as dirty without marking the file system
as changed.  This will avoid e2fsck signalling the init scripts that a
reboot is necessary.  This is safe, because the kernel doesn't
actually look at these superblock fields.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-30 23:12:37 -04:00
Theodore Ts'o 96a8afa7c1 e2fsck: check for invalid bad block inode
In some cases the bad block inode gets corrupted.  If it looks insane,
offer to clear it before trying to interpret it does more harm than
good.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-28 18:34:33 -04:00
Andreas Dilger d9c60e04b3 e2fsck: regression tests for INCOMPAT_MMP feature
Add tests for the MMP feature - creating a filesystem with mke2fs
and MMP enabled, enable/disable MMP with tune2fs, disabling the
e2fsck MMP flag with tune2fs after a failed e2fsck, and e2fsck
checking and fixing a corrupt MMP block.

The MMP tests need to be run from a real disk, not tmpfs, because
tmpfs doesn't support O_DIRECT reads, which MMP uses to ensure
that reads from the MMP block are not filled from the page cache.
Using a local disk does not slow down the tests noticably, since
they wait to detect if the MMP block is being modified.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-25 01:55:28 -04:00
Andreas Dilger d90d6a7146 tune2fs: kill external journal if device not found
Continue to remove the external journal device even if the device
cannot be found.

Add a test to verify that the journal device/UUID are actually removed
from the superblock.  It isn't possible to use a real journal device
for testing without loopback devices and such (it must be a block device)
and this would invite complexity and failures in the regression test.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-24 14:34:47 -04:00
Theodore Ts'o d1154eb460 Shorten compile commands run by the build system
The DEFS line in MCONFIG had gotten so long that it exceeded 4k, and
this was starting to cause some tools heartburn.  It also made "make
V=1" almost useless, since trying to following the individual commands
run by make was lost in the noise of all of the defines.

So fix this by putting the configure-generated defines in lib/config.h
and the directory pathnames to lib/dirpaths.h.

In addition, clean up some vestigal defines in configure.in and in the
Makefiles to further shorten the cc command lines.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-18 17:34:37 -04:00
Eric Sandeen 2bf0739dc0 test_icount: fclose() before exit
Just to be tidy.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-16 19:55:55 -04:00
Lukas Czerner 2fa1679adb tests: Print out list of failed tests
Currently we need to grep, list or just search for failed tests when
running 'make check' which is annoying. This commit simply prints out
the list of failed test names at the end of the output.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-15 23:54:49 -04:00
Lukas Czerner d2bfdc7ff1 e2fsprogs: Use punch hole as "discard" on regular files
If e2fsprogs tools (mke2fs, e2fsck) is run on regular file instead of
on block device, we can use punch hole instead of regular discard
command which would not work on regular file anyway. This gives us
several advantages. First of all when e2fsck is run with '-E discard'
parameter it will punch out all ununsed space from the image, hence
trimming down the file system image. And secondly, when creating an
file system on regular file (with '-E discard' which is default), we
can use punch hole to clear the file content, hence we can skip inode
table initialization, because reads from sparse area returns zeros. This
will result in faster file system creation (without the need to specify
lazy_itable_init) and smaller images.

This commit also fixes some tests that would fail due to mke2fs showing
discard progress, hence the output would differ.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-15 23:49:20 -04:00
Lukas Czerner faa2dcdad0 mke2fs: Use ext2fs_flush() only once
We are doing ext2fs_flush() twice right now at the end of the mke2fs.
First by directly calling ext2fs_flush() which is intended to write
superblock and fs accounting information. And then it is invoked again
when we are calling ext2fs_close(), only this time, because the fs is
not dirty, we are writing out only superblock.

I think it is bad to call it twice because even when writing only super
block it takes some time on bigger file systems and moreover
ext2fs_close() can fail without any reasonable explanation for the user.
Also ext2fs_flush() is printing out progress and it is confusing for the
users.

Fix all this by removing the ext2fs_flush() and leaving it all to
ext2fs_close(). However we need to introduce new variables to store
check interval and max mount count, because fs structure is freed on
ext2fs_close() and we really want to print those information as the last
info for the user.

[ Fixed type mismatch in a printf format statement -tytso]

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-13 22:42:19 -04:00
Theodore Ts'o 906a1cf9b6 tests: skip tests that require debugfs if debugfs has not been built
Avoid lots of tests failing if e2fsprogs is compiled with
--disable-debugfs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-03 10:04:37 -04:00
Theodore Ts'o f305fd7f0c tests: fix i_e2image so it works with valgrind
Since e2image can be optionally compiled out, we tested to see if
e2image was built; but using "test -x $E2IMAGE" fails if e2image is
something like "valgrind --simhints=lax-ioctls ../misc/e2image".
Define and use $E2IMAGE_EXE, much like we have done with e2undo and
resize2fs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-03 10:02:34 -04:00
Theodore Ts'o 92122d324d tests: add missing m_mkfs_overhead/expect
This file was accidentally dropped during the recent tests /tmp
overhual.  Re-adding.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-07-12 15:22:14 -04:00
Theodore Ts'o b4db1e4c74 tests: use /tmp for scratch files
The /tmp directory is often a memory based file system, and using this
can speed up running the regression test suite.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-07-09 12:08:10 -04:00
Theodore Ts'o a3efe48420 e2fsck: fix mysterious "FILE SYSTEM WAS MODIFIED" with no changes
Commit 2a77a784a3 (firest released in e2fsprogs 1.33) compared
superblock summary free blocks and inode counts with the allocation
bitmap counts before starting the file system check proper, and if
they differed, set the superblock and marked it as dirty.  If no other
file systme changes were required, this would cause a "*** FILE SYSTEM
WAS MODIFIED ***" message without any explanation of what e2fsck had
changed.

We fix this by only setting the superblock summary free block/inodes
counts if we are skipping a full check, and in non-preen mode, e2fsck
will now print an explicit message stating how the superblock had been
updated.

In a full check, any updates to the superblock free blocks/inodes
fields will be noted in pass5.

This change requires changing a few test results (essentially
reversing the changes made in commit 2a77a784a3).

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-06-16 01:22:02 -04:00
Theodore Ts'o 8f36e6925f Merge branch 'maint' into next 2011-06-11 12:55:26 -04:00
Andreas Dilger 177cb5c7e2 e2fsprogs: ignore generated files for "git status"
Ignore files generated by "make" or "make check" in "git status".
Ignore backup files from editing files and generated tags files.
Delete a temporary file in tests/d_loaddump/script at test cleanup.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-06-11 12:51:44 -04:00
Andreas Dilger 9b4d06b8de mke2fs: add extent-mapped journal regression test
All of the regression tests in e2fsprogs still use a block-mapped
journal (if any journal at all).  Add a simple regression test that
tests extent-mapped journals for both mke2fs and e2fsck.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-06-11 12:22:36 -04:00
Andreas Dilger ec50834203 mke2fs: add test for large journal with lazy init
Add test for internal journal over 4GB in size, using the
lazy_journal_init and lazy_itable_init features.  Otherwise
the filesystem metadata would be too large to reliably run on
test systems, and take too long to create/check the filesystem.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-06-11 12:19:25 -04:00
Lukas Czerner 9e713505ab tests: New i_e2image test to validate image creation/conversion
This commit adds new regression test called i_e2image which should
validate expected behaviour of e2image raw and qcow2 image creation
and qcow2 -> raw image conversion. You can run it with "make check" as
the rest of regression tests.

Testing is performed on three filesystem images with different block
sizes (1024, 2048, 4096). It creates raw and qcow2 images from the
original and then convert qcow2 image back to raw image. The results are
checksummed and compared with pre-prepared results. All md5sums should
stay the same and raw image created from original and qcow2 image should
be the same as well (just for the record).

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-05-18 12:19:41 -04:00
Aditya Kali d3859af33f mke2fs: Allow specifying reserved_ratio via mke2fs.conf
This patch adds support for specifying 'reserved_ratio' (percent blocks
reserved for super user, same as '-m' command line option) in mke2fs.conf.
It adds profile_get_double function in profile.c that allows reading
floating point values from profile files.

Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-05-14 23:34:48 -04:00
Theodore Ts'o 214580a339 Merge branch 'maint' into next
Conflicts:
	misc/mke2fs.conf.5.in
2011-02-20 21:54:43 -05:00
Eric Sandeen 6a426c97ec e2fsprogs: enable user namespace xattrs by default
User namespace xattrs are generally useful, and I think extN
is the only filesystem requiring a special mount option to
enable them, when xattrs are otherwise available.  So this
change sets that mount option into the defaults, via a
mke2fs.conf option.

Note that if xattrs are config'd off, this will lead to a
mostly-harmless:

   EXT4-fs (sdc1): (no)user_xattr options not supported

message at mount time...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-02-20 21:36:26 -05:00
Eric Sandeen 3daf592646 e2fsprogs: turn off enforced fsck intervals by default
The forced fsck often comes at unexpected and inopportune moments,
and even enterprise customers are often caught by surprise when
this happens.  Because a filesystem with an error condition will
be marked as requiring fsck anyway, I submit that the time-based
and mount-based checks are not particularly useful, and that
administrators can schedule fscks on their own time, or tune2fs
the enforced intervals if they so choose.  This patch disables the
intervals by default, and I've added a new mkfs.conf option to
turn on the old behavior of random, unexpected, time-consuming
fscks at boot time.  ;)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-02-20 20:45:12 -05:00
Theodore Ts'o da2a5a4bae Merge branch 'maint' into next
Conflicts:
	resize/resize2fs.c
2010-12-22 19:00:21 -05:00
Theodore Ts'o a4fdf09414 libext2fs: Don't use the extended rec_len encoding for standard file systems
If the file system has a blocksize less than 64k, then don't use the
extended rec_len encoding, to be consistent with what the kernel will
do.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-12-22 13:53:02 -05:00
Theodore Ts'o 0358c9f9a4 Merge branch 'maint' into next
Conflicts:
	e2fsck/pass4.c
	misc/dumpe2fs.c
	resize/online.c
2010-12-13 09:16:09 -05:00
Theodore Ts'o e994dc99fe Disable lazy inode table initialization when running regression tests
This avoids test failures when running on new kernels that allow lazy
itable initialization.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-11-22 16:16:05 -05:00
Theodore Ts'o db0bdb49f4 Merge branch 'maint' into next
Conflicts:
	resize/extent.c
2010-07-19 02:37:41 -04:00
Mike Frysinger b887f08f95 e2freefrag: Fix getopt bug on machines with unsigned chars
The getopt() function returns an int, not a char.  On systems where the
default char is unsigned (like ppc), we get weird behavior where -1 is
truncated to 0xff but compared to (int)-1.

Also fix this same bug for two test programs, test_rel and iscan,
which aren't currently used at the moment.

Addresses-Gentoo-Bug: #299386

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-07-05 14:53:58 -04:00
Theodore Ts'o 97d26ce9e3 Merge branch 'maint' into next
Conflicts:
	e2fsck/journal.c
	e2fsck/pass1.c
	e2fsck/pass2.c
	misc/mke2fs.c
2010-06-07 12:42:40 -04:00
Theodore Ts'o edc1894e60 tests: Use our own mke2fs.conf file
Use a standard, fixed mke2fs.conf file so that if downstream
distributions want to change the mke2fs.conf which is distributed in
the RPM or dpkg file, it won't screw up the regression tests.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-05-14 20:18:11 -04:00
Theodore Ts'o 53499e86c5 tests: Add new test f_unused_itable
Add test to make sure e2fsck doesn't end up detaching and sending to
lost+found inodes which are in an bg_itable_unused_region (e.g. if
there was a power failure and bg_itable_unused wasn't updated because
journaling wasn't enabled).

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-05-11 21:10:12 -04:00
Theodore Ts'o 2291fbb035 e2fsck: Check for cases where EOFBLOCKS_FL is unnecessarily set
Some kernels will crash if EOFBLOCKS_FL is set when it is it not
needed, and this if it is left set when it isn't needed, it is a sign
of a kernel bug.

Addresses-Google-Bug: #2604224

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-05-10 10:29:14 -04:00
Theodore Ts'o c5b23f6c0e Merge branch 'maint' into next 2010-03-15 18:53:45 -04:00
Theodore Ts'o ec65fa57a6 tests: Add new test f_rehash_dir
Add a new test which tests to make sure e2fsck -D works correctly.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-03-15 00:14:12 -04:00
Theodore Ts'o 2d07b3ad98 Merge branch 'maint' into next
Conflicts:
	configure
	lib/ext2fs/alloc_tables.c
	misc/mke2fs.c
2010-01-31 18:49:08 -05:00
Theodore Ts'o 785f939046 tests: Add new test f_holedir2
This tests e2fsck's handling of both direct and extent-mapped
directoris containing holes when the i_size is 0.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-11-29 01:28:14 -05:00
Theodore Ts'o f4e14505ed e2fsck: Don't rehash directories which can fit in a single directory block
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-11-29 01:22:44 -05:00
Theodore Ts'o b71e01835f e2fsck: Fix duplicate directory entries for non-indexed directories
Duplicate directory entries were not necessarily getting found and
fixed for non-indexed directories, since we were sorting these
directories by inode number, and the duplicate entry code assumed the
entries were getting sorted by name or directory name hash.

Addresses-Sourceforge-Bug: #2862551

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-11-16 21:56:24 -05:00
Theodore Ts'o 95bcea9fc1 Merge branch 'maint' into next
Conflicts:
	configure
	configure.in
	misc/mke2fs.c
2009-10-04 20:40:46 -04:00
Theodore Ts'o 695706ca21 e2fsck: Interpret negative blkcount in file system problem reports
Non-expert users get confused when they see messages like this:

Illegal block #-1 (2291965952) in inode 176. CLEARED.

So change it to be something a little bit more understandable:

Illegal indirect block (2291965952) in inode 176.  CLEARED.

Addresses-SourceForge-Bug: #2871782

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-04 18:02:24 -04:00
Theodore Ts'o a321afa8b7 tests: Account for new mke2fs topology information
The previous commit adds a new line printed by mke2fs with the
filesystem/device topology information.  Update the regression test's
expected output to account for this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-04 16:21:13 -04:00
Valerie Aurora Henson 4efbac6fed Convert uses of super->s_*_blocks_count to ext2fs_*_blocks_count()
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: Nick Dokos <nicholas.dokos@hp.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07 20:46:34 -04:00
Valerie Aurora Henson a63745e81c Use ext2fs_file_acl_block() instead of using .i_file_acl directly
This provides support for 48-bit file acl blocks.

Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07 22:29:45 -04:00
Valerie Aurora Henson 95fd65bb7f libext2fs: create generic numeric progress meters and use them
With 64-bit file systems, mke2fs can take a long time to do things
other than write inode tables.  I exported the mke2fs numeric progress
meter and used it for allocating group tables and the final file
system flush.

Signed-off-by: Valerie Aurora (Henson) <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-08-23 19:20:03 -04:00
Theodore Ts'o edc9e25634 f_illitable_flexbg: Add new test
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-08-19 01:16:47 -04:00
Theodore Ts'o f4240c8d56 libext2fs: Treat uninitialized parts of bitmaps as unallocated
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-08-09 23:22:32 -04:00
Theodore Ts'o c13351f6c5 Add support for configure --enable-verbose-makecmds
Some people don't want to see the concise "kernel-style" make output.
This configure option allows build engines that want to see the full
set of commands executed by the makefile to get what they want.  Most
people will find this more distracting than useful, unless they need
to debug the Makefiles.

(It is not necessary to rerun configure to enable this verbose make
output temprarily; if a developer wants to do a quick debug of a
directory's makefile, he or she can simply edit the definition of the
$(E) and $(Q) variables in the Makefile; instructions can be found in
the MCONFIG file which is included in at the beginning of every
Makefile.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-07-02 00:11:17 -04:00
Theodore Ts'o a6a1c0815c Fix Makefile dependencies for libcom_err
The e2fsprogs makefiles were using the same Makefile variable
LIBCOM_ERR for the link-line arguments as well as the dependencies.
Since LIBCOM_ERR can now include non-file arguments such as
"-lpthread", we need to use a separate DEPLIBCOM_ERR variable that
only has build file dependencies.

Do the same thing for STATIC_LIBCOM_ERR and PROFILED_LIBCOM_ERR.

Addresses-Sourceforge-Patches: #2813809

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-07-01 22:06:51 -04:00
Theodore Ts'o 8a48035095 Fix encoding for rec_len in directories for >= 64k blocksize file systems
Previously e2fsprogs interpreted 0 for a rec_len of 65536 (which could
occur if the directory block is completely empty in 64k blocksize
filesystems), while the kernel interpreted 65535 to mean 65536.  The
kernel will accept both to mean 65536, and encodes 65535 to be 65536.
This commit changes e2fsprogs to match.

We add the encoding agreed upon for 128k and 256k filesystems, but we
don't enable support for these larger block sizes, since they haven't
been fully tested.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-06-21 21:07:38 -04:00
Theodore Ts'o 58d29ed48a tests: Add --valgrind-leakcheck option to the test_script program
Add an option which runs valgrind with the appropriate options for
finding memory leaks.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-06-15 01:33:26 -04:00
Theodore Ts'o 911ec62615 e2fsck: On a 32-bit filesystem, make sure i_file_acl_high is zero
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-04-23 21:31:16 -04:00
Theodore Ts'o 9af62fde65 tests: Filter out "Lifetime writes" from the dumpe2fs display
The Lifetime writes field will probably not be stable as we add new
features to e2fsprogs, so filter it out to avoid spurious test failures.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-03-08 19:01:03 -04:00
Theodore Ts'o 5299580c1c Use format strings directly to prevent -Werror=format-security failures
Gcc is too stupid to realize that:

    const char *usage="String which has no percent signs";

    com_err(progname, 0, usage);

is OK.  I refuse to bow to stupidity with:

   com_err(progname, 0, "%s", usage);

but I will use the string directly for the sake of people who like to
build with -Werror=format-security.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-01-20 13:05:25 -05:00
Theodore Ts'o dd04d05f70 e2fsck: Remove "ext3" from problem descriptions of the journal
The ext4 filesystem uses journals too, so remove "ext3" from the
problem descriptions involving journals.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-01-01 23:10:40 -05:00
Theodore Ts'o a558d5dc22 Add e2fsck regression test case f_extent_bad_node
This test case is designed to test e2fsck's ability to deal with a
corrupted interior node in an extent tree.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-12-25 22:47:03 -05:00
Theodore Ts'o 7dca4c88f1 e2fsck: When repacking directories, leave slack space for more efficiency
If the directory is packed with no slack space, as soon as any new
directory entries are added, leaf nodes end up getting split and
directory ends up getting very inefficient.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-12-25 17:59:36 -05:00
Theodore Ts'o d5a74ff10b e2fsck: Fix double-counting of non-contiguous extent-based inodes
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-12-22 01:23:59 -05:00
Theodore Ts'o 0eeec8ac61 Fix compiling under diet libc
Some recent changes had caused diet libc support to bitrot.  Fix up
missing header files and other portability fixups needed for dietlibc.
(Many of these changes also improve general portability.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-09-12 09:10:39 -04:00
Theodore Ts'o d1070d91b4 tune2fs, mke2fs: Change default directory hash algorithm to half_md4
The half_md4 algorithm is faster and more collision resistant.  Let's
switch to it as the default.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-29 20:02:50 -04:00
Theodore Ts'o efc6f628e1 Remove trailing whitespace for the entire source tree
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 23:07:54 -04:00
Theodore Ts'o 674c0cc4cb ext2fs_mkjournal(): Don't allocate an extra block to the journal
Addresses-Sourceforge-Bug: 1483791

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 17:03:37 -04:00
Theodore Ts'o 0f3c108363 Remove trailing space from the description of the r_move_itable test
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-24 21:58:03 -04:00
Andreas Dilger e5e12db959 fix e2fsck error message for bad htree depth
Fix error message to print the depth of a corrupt htree directory.

Signed-off-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: Kalpak Shah <kalpak.shah@sun.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-08-24 21:57:31 -04:00
Theodore Ts'o 63b5e354d9 e2fsck: Fix check to see if an extent-based file is fragmented
Also added support for "e2fsck -E fragcheck" which issues a
comprehensive report of discontiguous file extents.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-10 22:43:24 -04:00
Theodore Ts'o 2a7bfe8353 Flush stdio buffers before calling setbuf()
On Solaris setbuf() will discard any pending output to the stream, so
make we call fflush() before calling setbuf().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-07-13 16:06:57 -04:00
Theodore Ts'o 318824c1bb Fix Solaris shell script portability issues
Solaris ships with a pathetically ancient shell in /bin/sh,
so fix various shell scripts to accomodate.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-07-13 16:06:56 -04:00
Theodore Ts'o 009c02baf9 Make ext2fs_check_desc() more stringent to force use of backup superbocks
E2fsck could to do more damage to a filesystem by trying to relocate
inode tables due to corrupted block group descriptors, and the
relocation could seriously damage the filesystem.

This patch enhances ext2fs_check_desk() so it detects more
self-inconsistent block group descriptors, including the cases where
e2sck might be tempted to relocate the inode table, and reports the
block group descriptors as invalid; this will cause e2fsck to attempt
to use the backup superblocks, which hopefully have not been trashed.

Addresses-Sourceforge-Bug: #1840291

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-07-10 17:25:33 -04:00
Theodore Ts'o 71ff129e9f Merge branch 'maint'
Conflicts:

	README
	resize/online.c
	version.h
2008-06-17 23:54:51 -04:00
Theodore Ts'o 9ff8ece57d mke2fs, tune2fs, resize2fs: Use floating point to calculate percentages
When calculating the number reserved blocks, use floating point for
better accuracy, since for big filesystems it really makes a
difference.  In addition, mke2fs and tune2fs accepts a floating point
number from the user, so they should provide that level of accuracy.

Addresses-Debian-Bug: #452639

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-06-17 21:08:49 -04:00
Theodore Ts'o 123b880846 Update tests to reflect undoe2fs -> e2undo rename
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-06-07 22:30:22 -04:00
Theodore Ts'o 81f6857b15 Fix LIBSS dependency problem for tests/test_icount and lib/ss/test_ss
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-06-07 22:19:52 -04:00
Theodore Ts'o dfb1d42a56 f_extents2: Add new test case testing e2fsck's support for extents
This test case tests blocks claimed by multiple inodes, as well as
other forms of invalid extents.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-06-02 20:36:52 -04:00
Theodore Ts'o 7609f54d7e Fix m_large_file and r_inline_xattr tests to match with recent changes
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-05-24 19:10:49 -04:00
Aneesh Kumar K.V 2ec408ef40 Add test cases for undoe2fs: u_undoe2fs_mke2fs and u_undoe2fs_tune2fs
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-04-27 20:07:50 -04:00
Aneesh Kumar K.V 91803d8879 Fix the resize inode test case
With the new mke2fs changes the output of the
command differs if we run mke2fs on a device that
already have the file system. So erase the file system
before running mke2fs so that output remain as expected.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-04-27 20:06:27 -04:00
Theodore Ts'o da292aa9af Merge branch 'maint'
Conflicts:

	tests/m_raid_opt/expect.1
2008-04-27 07:59:28 -04:00
Theodore Ts'o d94cc2eaa6 mke2fs: Don't allow the combination of the meta_bg and resize_inode features
The combination of meta_bg and resize_inode leads to a corrupt
filesystem, and it's not really clear it makes any logical sense.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-04-27 00:08:14 -04:00
Theodore Ts'o 16b851cdae Remove LAZY_BG feature
This simplifies the code, and using the uninit_bg with the inode table
lazily initialized is just as good.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-04-20 23:33:34 -04:00
Theodore Ts'o 41a5afa87b libe2p: Print the s_min_extra_isize and s_wanted_extra_isize fields
Make dumpe2fs and debugfs print out the s_min_extra_isize and
s_wanted_extra_isize fields from the superblock.

Update tests expect files as appropriate.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-04-20 16:10:07 -04:00
Theodore Ts'o 2930dad2b2 Rename the feature uninit_groups to uninit_bg
Allow the old name of uninit_groups when converting feature names for
backwards compatibility for scripts running mke2fs and tune2fs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-04-17 23:31:44 -04:00