Whamcloud - gitweb
tools/e2fsprogs.git
9 years agoe2fsck: try to salvage extent blocks with bad checksums
Darrick J. Wong [Sun, 3 Aug 2014 02:32:11 +0000 (22:32 -0400)]
e2fsck: try to salvage extent blocks with bad checksums

Remove the code that would zap an extent block immediately if the
checksum failed (i.e. strict_csums).  Instead, we'll only do that if
the extent block header shows obvious structural problems; if the
header checks out, then we'll iterate the block and see if we can
recover some extents.

Requires a minor modification to ext2fs_extent_get such that the
extent block will be returned in the buffer even if the return code
indicates a checksum error.  This brings its behavior in line with
the rest of libext2fs.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agolibext2fs: check EA block headers when reading in the block
Darrick J. Wong [Sun, 3 Aug 2014 02:32:11 +0000 (22:32 -0400)]
libext2fs: check EA block headers when reading in the block

When reading an EA block in from disk, do a quick sanity check of the
block header, and return an error if we think we have garbage.  Teach
e2fsck to ignore the new error code in favor of doing its own
checking, and remove the strict_csums bits while we're at it.

(Also document some assumptions in the new ext_attr code.)

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agodumpe2fs: complain when checksum verification fails
Darrick J. Wong [Sun, 3 Aug 2014 02:26:15 +0000 (22:26 -0400)]
dumpe2fs: complain when checksum verification fails

Warn the user to run e2fsck if the superblock or bitmaps fails
checksum verification.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: use root dir for lost+found when really desperate
Darrick J. Wong [Sun, 3 Aug 2014 02:18:30 +0000 (22:18 -0400)]
e2fsck: use root dir for lost+found when really desperate

If we're totally unable to allocate a lost+found directory, ask the
user if he would like to dump orphaned files in the root directory.
Hopefully this enables the user to delete enough files so that a
subsequent run of e2fsck will make more progress.  Better to cram lost
files in the rootdir than the current behavior, which is to fail at
linking them in, thereby leaving them as lost files.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: never free critical metadata blocks in the block found map
Darrick J. Wong [Sun, 3 Aug 2014 02:18:29 +0000 (22:18 -0400)]
e2fsck: never free critical metadata blocks in the block found map

Don't allow critical metadata blocks to be marked free in the block
found map.  This can theoretically happen on an FS where a first
inode's ETB/indirect map block is in the inode table, the first inode
is itself unclonable (and thus gets deleted) and there are enough
crosslinked files before and after the first inode to use up all the
free blocks during pass 1b.

(I do actually have a test FS image but it's 256M and it proved very
difficult to craft a bite-sized test case that actually hit this bug.)

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fuzz: fix fs handle cleanup when closing fails
Darrick J. Wong [Sun, 3 Aug 2014 02:18:29 +0000 (22:18 -0400)]
e2fuzz: fix fs handle cleanup when closing fails

Fix the handling of 'fs' when closing the FS fails so that we don't
dereference a NULL pointer.  Adapt to use ext2fs_close_free while
we're at it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Fixes-Coverity-Bug: 1229241
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoMerge branch 'maint' into next
Theodore Ts'o [Sun, 3 Aug 2014 02:05:03 +0000 (22:05 -0400)]
Merge branch 'maint' into next

Conflicts:
configure
misc/Makefile.in

9 years agodebugfs: fix argument parsing in do_freefrag()
Artemiy Volkov [Sat, 2 Aug 2014 23:53:04 +0000 (19:53 -0400)]
debugfs: fix argument parsing in do_freefrag()

When do_freefrag() is called from debugfs, the value of optind is
not reset. Rectify that by calling reset_getopt().

Signed-off-by: Artemiy Volkov <artemiyv@acm.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agomisc: fix Makefile for profiled build
Theodore Ts'o [Sat, 2 Aug 2014 23:43:10 +0000 (19:43 -0400)]
misc: fix Makefile for profiled build

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agolibext2fs: when appending to a file, don't split an index block in equal halves
Darrick J. Wong [Thu, 1 May 2014 23:15:05 +0000 (16:15 -0700)]
libext2fs: when appending to a file, don't split an index block in equal halves

When we're appending an extent to the end of a file and the index
block is full, don't split the index block into two half-full index
blocks because this leaves us with under utilized index blocks, at
least in the fallocate case.  Instead, copy the last extent from the
full block into the new block.  This isn't perfect utilization, but
there's a lot of work involved in teaching extent.c to be able to goto
a nonexistent node in a newly allocated (and empty) extent block.

This patch does not fix the general problem of keeping the extent tree
balanced.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agolibext2fs: have UNIX IO manager use pread/pwrite
Darrick J. Wong [Sat, 2 Aug 2014 23:18:03 +0000 (19:18 -0400)]
libext2fs: have UNIX IO manager use pread/pwrite

If pread/pwrite are present, have the UNIX IO manager use them for
aligned IOs (instead of the current seek -> read/write), thereby
saving us a (minor) amount of system call overhead.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agofilefrag: minor code fixes and cleanups
Andreas Dilger [Wed, 30 Jul 2014 20:25:49 +0000 (14:25 -0600)]
filefrag: minor code fixes and cleanups

Print filefrag_fiemap() error message to stderr instead of stdout.

Only call ioctl(EXT3_IOC_GETFLAGS) for ext{2,3,4} filesystems to
decide if the ext2 indirect block allocation heuristic shold be used.

Properly handle the the force_bmap (-B) option.

Exit with a positive error number instead of a negative one.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agotests: fix f_badcluster output formatting
Andreas Dilger [Tue, 29 Jul 2014 23:30:40 +0000 (17:30 -0600)]
tests: fix f_badcluster output formatting

The f_badcluster output format depends on how libreadline formats
and outputs the commands read from stdin.  Instead of trying to
handle these differences, use an input command file, which does
not depend on external components to be consistent.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agomisc: quiet signed/unsigned charactr compiler warnings
Andreas Dilger [Tue, 29 Jul 2014 23:30:39 +0000 (17:30 -0600)]
misc: quiet signed/unsigned charactr compiler warnings

Quiet warnings about signed vs. unsigned character mismatch.
Use __u8 for storing UUIDs instead of char to match the superblock
s_uuid field.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agotune2fs: fix uninitialized variable in remove_journal_device
Theodore Ts'o [Thu, 31 Jul 2014 15:49:48 +0000 (11:49 -0400)]
tune2fs: fix uninitialized variable in remove_journal_device

This bug was introduced by commit 7dfefaf413bbd ("tune2fs: update
journal super block when changing UUID for fs").

Fixes-Coverity-Bug: 1229243

Reported-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoMerge branch 'next'
Theodore Ts'o [Tue, 29 Jul 2014 14:56:34 +0000 (10:56 -0400)]
Merge branch 'next'

9 years agoMerge branch 'maint' into next
Theodore Ts'o [Tue, 29 Jul 2014 14:53:49 +0000 (10:53 -0400)]
Merge branch 'maint' into next

9 years agotune2fs: update journal users while updating fs UUID (with external journal)
Azat Khuzhin [Mon, 28 Jul 2014 07:43:25 +0000 (11:43 +0400)]
tune2fs: update journal users while updating fs UUID (with external journal)

When we have fs with external journal device, and updating it's UUID, we
should update UUID in users list for that external journal device.

Before:
$ tune2fs -U clear /tmp/dev
tune2fs 1.42.10 (18-May-2014)
$ dumpe2fs /tmp/dev | fgrep UUID
dumpe2fs 1.42.10 (18-May-2014)
Filesystem UUID:          <none>
Journal UUID:             da1f2ed0-60f6-aaaa-92fd-738701418523
$ dumpe2fs /tmp/journal | fgrep users -A10
dumpe2fs 1.42.10 (18-May-2014)
Journal number of users:  2
Journal users:            0707762d-638e-4bc6-944e-ae8ee7a3359e
                          0ad849df-1041-4f0a-b1c1-2f949d6a1e37

After:
$ sudo tune2fs -U clear /tmp/dev
tune2fs 1.43-WIP (18-May-2014)
$ dumpe2fs /tmp/dev | fgrep UUID
dumpe2fs 1.42.10 (18-May-2014)
Filesystem UUID:          <none>
Journal UUID:             da1f2ed0-60f6-aaaa-92fd-738701418523
$ dumpe2fs /tmp/journal | fgrep users -A10
dumpe2fs 1.42.10 (18-May-2014)
Journal number of users:  2
Journal users:            0707762d-638e-4bc6-944e-ae8ee7a3359e
                          00000000-0000-0000-0000-000000000000

Also add some consts to avoid *magic numbers*:
- UUID_STR_SIZE
- UUID_SIZE
- JFS_USERS_MAX
- JFS_USERS_SIZE

Proposed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Azat Khuzhin <a3at.mail@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agotune2fs: update journal super block when changing UUID for fs.
Azat Khuzhin [Mon, 28 Jul 2014 07:43:24 +0000 (11:43 +0400)]
tune2fs: update journal super block when changing UUID for fs.

Using -U option you can change the UUID for fs, however it will not work
for journal device, since it have a copy of this UUID inside jsb (i.e.
journal super block). So copy UUID on change into that block.

Here is the initial thread:
http://comments.gmane.org/gmane.comp.file-systems.ext4/44532

You can reproduce this by executing following commands:
$ fallocate -l100M /tmp/dev
$ fallocate -l100M /tmp/journal
$ sudo /sbin/losetup /dev/loop1 /tmp/dev
$ sudo /sbin/losetup /dev/loop0 /tmp/journal
$ mke2fs -O journal_dev /tmp/journal
$ tune2fs -U da1f2ed0-60f6-aaaa-92fd-738701418523 /tmp/journal
$ sudo mke2fs -t ext4 -J device=/dev/loop0 /dev/loop1
$ dumpe2fs -h /tmp/dev | fgrep UUID
dumpe2fs 1.43-WIP (18-May-2014)
Filesystem UUID:          8a776be9-12eb-411f-8e88-b873575ecfb6
Journal UUID:             e3d02151-e776-4865-af25-aecb7291e8e5
$ sudo e2fsck /dev/vdc
e2fsck 1.43-WIP (18-May-2014)
External journal does not support this filesystem

/dev/loop1: ********** WARNING: Filesystem still has errors **********

Reported-by: Chin Tzung Cheng <chintzung@gmail.com>
Signed-off-by: Azat Khuzhin <a3at.mail@gmail.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agotune2fs: remove_journal_device(): use the correct block to find jsb
Azat Khuzhin [Mon, 28 Jul 2014 07:43:23 +0000 (11:43 +0400)]
tune2fs: remove_journal_device(): use the correct block to find jsb

Signed-off-by: Azat Khuzhin <a3at.mail@gmail.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agojournal: use consts instead of 1024 and add helper for journal with 1k blocksize
Azat Khuzhin [Mon, 28 Jul 2014 07:43:22 +0000 (11:43 +0400)]
journal: use consts instead of 1024 and add helper for journal with 1k blocksize

Use EXT2_MIN_BLOCK_SIZE, JFS_MIN_JOURNAL_BLOCKS, SUPERBLOCK_SIZE, and
SUPERBLOCK_OFFSET instead of hardcoded 1024 when it is okay, and also
add a helper ext2fs_journal_sb_start() that will return start of
journal sb with special case for fs with 1k block size.

Signed-off-by: Azat Khuzhin <a3at.mail@gmail.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoMerge branch 'maint' into next
Theodore Ts'o [Mon, 28 Jul 2014 19:39:24 +0000 (15:39 -0400)]
Merge branch 'maint' into next

9 years agotests: add the f_badcluster test
Darrick J. Wong [Mon, 28 Jul 2014 19:37:03 +0000 (15:37 -0400)]
tests: add the f_badcluster test

This should have been part of commit 9a1d614df21 ("e2fsck: fix
rule-violating lblk->pblk mappings on bigalloc filesystems") but it
accidentally got dropped when the patch was applied.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agomisc: copy extended attributes in populate_fs
Ross Burton [Thu, 10 Jul 2014 16:44:38 +0000 (17:44 +0100)]
misc: copy extended attributes in populate_fs

When creating a file system using a source directory, also copy any extended
attributes that have been set.

[ Add configure tests for Linux-specific xattr syscalls and add fallback
  when compiling on non-Linux systems. --tytso ]

Signed-off-by: Ross Burton <ross.burton@intel.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agofilefrag: fix block size value
Rakesh Pandit [Mon, 28 Jul 2014 00:04:48 +0000 (20:04 -0400)]
filefrag: fix block size value

ioctl(FIGETBSZ) was used to get block size earlier but 2508eaa7
(filefrag: improvements to filefrag FIEMAP handling) moved to fstatfs
f_bsize which doesn't work well for many files systems.

Block size returned using fstatfs isn't block size but "optimal
transfer block size" as per man page.  Even stat st_blksize is
"preferred I/O block size" and in may file systems it may even vary
from file to file (POSIX).  This patch changes filefrag to use
FIGETBSZ preferentially over f_bsize.

[ Modified by tytso to add the fallback to f_bsize if FIGETBSZ fails
  for some reason ]

Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agofilefrag: fix -B option and extents calculation for FIBMAP
Rakesh Pandit [Sun, 27 Jul 2014 23:56:27 +0000 (19:56 -0400)]
filefrag: fix -B option and extents calculation for FIBMAP

29758d2 broke -B option which is useful for filesystems not supporting
FIEMAP. Also, fix extents calculation for -B which is broken since
2508eaa7.

Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: don't offer to fix the checksum of fixed extents
Darrick J. Wong [Sun, 27 Jul 2014 23:51:37 +0000 (19:51 -0400)]
e2fsck: don't offer to fix the checksum of fixed extents

If an extent fails checksum and the sanity checks, and the user elects
to fix the extents, don't bother asking (the second time) if the user
would like to fix the checksum.  Refactor some redundant code to make
what's going on a little cleaner.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: make insert_dirent_tail more robust
Darrick J. Wong [Sun, 27 Jul 2014 23:46:15 +0000 (19:46 -0400)]
e2fsck: make insert_dirent_tail more robust

Fix the routine that adds dirent checksum structures to the directory
block to handle oddball situations a bit more robustly.

First, when we're walking the entry array, we might encounter an
entry that ends exactly one byte before where the checksum entry needs
to start, i.e. there's space for the tail entry, but it needs to be
reinitialized.  When that happens, we should proceed until d points to
that space so that the tail entry can be initialized.

Second, it's possible that we've been fed a directory block where the
entries end just short of the end of the block.  In this case, we need
to adjust the size of the last entry to point exactly to where the
dirent tail starts.  The current code requires that entries end
exactly on the block boundary, but this is not always the case with
damaged filesystems.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: leave room for checksum structure when salvaging a directory
Darrick J. Wong [Sun, 27 Jul 2014 23:45:04 +0000 (19:45 -0400)]
e2fsck: leave room for checksum structure when salvaging a directory

When we're salvaging a directory, leave room at the end of the block
for the checksum entry so that e2fsck can write the checksummed dir
block out later.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: clear badblocks inode when checksum fails
Darrick J. Wong [Sat, 26 Jul 2014 00:35:12 +0000 (17:35 -0700)]
e2fsck: clear badblocks inode when checksum fails

If the badblocks inode fails checksum verification, just clear the
inode and move on.  If we don't do this, we can end up importing a lot
of garbage into the badblocks list, which will then cause fsck to try
to regenerate anything that was sitting atop the supposedly damaged
blocks.  Given that most hardware will remap bad sectors transparently
from ext4, the number of people this could affect adversely is pretty
low.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: write dir blocks after new inode when reconstructing root/lost+found
Darrick J. Wong [Sat, 26 Jul 2014 21:14:40 +0000 (17:14 -0400)]
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>
9 years agoe2fsck: insert a missing dirent tail for checksums if possible
Darrick J. Wong [Sat, 26 Jul 2014 21:13:31 +0000 (17:13 -0400)]
e2fsck: insert a missing dirent tail for checksums if possible

If e2fsck is writing a block of directory entries to disk, it should
adjust the dirents to add the dirent tail if one is missing.  It's not
a big deal if there's no space to do this since rehash (pass 3A) will
reconstruct directories for us.  However, we may as well avoid
unnecessary work.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: fix the various checksum error messages
Darrick J. Wong [Sat, 26 Jul 2014 00:34:28 +0000 (17:34 -0700)]
e2fsck: fix the various checksum error messages

Make the "EA block passes checks but fails checksum" message less
strange, and make the other checksum error messages actually print a
period at the end of the sentence.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoMerge branch 'maint' into next
Theodore Ts'o [Sat, 26 Jul 2014 20:53:37 +0000 (16:53 -0400)]
Merge branch 'maint' into next

Conflicts:
e2fsck/pass1b.c

9 years agoe2fsck: during pass1b delete_file, only free a cluster once
Darrick J. Wong [Sat, 26 Jul 2014 20:28:58 +0000 (16:28 -0400)]
e2fsck: during pass1b delete_file, only free a cluster once

If we're forced to delete a crosslinked file, only call
ext2fs_block_alloc_stats2() on cluster boundaries, since the block
bitmaps are all cluster bitmaps at this point.  It's safe to do this
only once per cluster since we know all the blocks are going away.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: fix rule-violating lblk->pblk mappings on bigalloc filesystems
Darrick J. Wong [Sat, 26 Jul 2014 00:34:04 +0000 (17:34 -0700)]
e2fsck: fix rule-violating lblk->pblk mappings on bigalloc filesystems

As far as I can tell, logical block mappings on a bigalloc filesystem are
supposed to follow a few constraints:

 * The logical cluster offset must match the physical cluster offset.
 * A logical cluster may not map to multiple physical clusters.

Since the multiply-claimed block recovery code can be used to fix these
problems, teach e2fsck to find these transgressions and fix them.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: perform implied cluster allocations when filling a directory hole
Darrick J. Wong [Sat, 26 Jul 2014 00:33:57 +0000 (17:33 -0700)]
e2fsck: perform implied cluster allocations when filling a directory hole

If we're filling a directory hole, we need to perform an implied
cluster allocation to satisfy the bigalloc rule of mapping only one
pblk to a logical cluster.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: fix merge error in "clear uninit flag on directory extents"
Darrick J. Wong [Sat, 26 Jul 2014 20:03:10 +0000 (16:03 -0400)]
e2fsck: fix merge error in "clear uninit flag on directory extents"

In the original patch (against -next), the hunk to fix uninit dirs was
just prior to the hunk labelled "Corrupt but passes checks?".  The
hunks are ordered this way so that if e2fsck obtains permission to fix
a failed-csum extent (which in turn fixes the checksum), it will not
subsequently ask to (re)fix the checksum.

Due to a merge error the hunk moved to the wrong place, so put it
back.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoMerge branch 'maint' into next
Theodore Ts'o [Sat, 26 Jul 2014 19:57:42 +0000 (15:57 -0400)]
Merge branch 'maint' into next

Conflicts:
debugfs/debugfs.c
e2fsck/pass1.c

9 years agoe2fsck: reserve blocks for root/lost+found directory repair
Darrick J. Wong [Sat, 26 Jul 2014 00:33:45 +0000 (17:33 -0700)]
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>
9 years agolibext2fs: provide a function to set inode size
Darrick J. Wong [Sat, 26 Jul 2014 18:34:56 +0000 (14:34 -0400)]
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>
9 years agoMerge branch 'maint' into next
Theodore Ts'o [Sat, 26 Jul 2014 13:45:19 +0000 (09:45 -0400)]
Merge branch 'maint' into next

Conflicts:
debugfs/debugfs.c
e2fsck/pass5.c

9 years agolibext2fs: fix free block accounting for 64-bit file systems
Theodore Ts'o [Sat, 26 Jul 2014 13:25:40 +0000 (09:25 -0400)]
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>
9 years agoFix 32/64-bit overflow when multiplying by blocks/clusters per group
Theodore Ts'o [Sat, 26 Jul 2014 11:40:36 +0000 (07:40 -0400)]
Fix 32/64-bit overflow when multiplying by blocks/clusters per group

There are a number of places where we need convert groups to blocks or
clusters by multiply the groups by blocks/clusters per group.
Unfortunately, both quantities are 32-bit, but the result needs to be
64-bit, and very often the cast to 64-bit gets lost.

Fix this by adding new macros, EXT2_GROUPS_TO_BLOCKS() and
EXT2_GROUPS_TO_CLUSTERS().

This should fix a bug where resizing a 64bit file system can result in
calculate_minimum_resize_size() looping forever.

Addresses-Launchpad-Bug: #1321958

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agolibext2fs: use C99 initializers for the io_manager structure
Theodore Ts'o [Sat, 26 Jul 2014 04:49:14 +0000 (00:49 -0400)]
libext2fs: use C99 initializers for the io_manager structure

Using C99 initializers makes the code a bit more readable, and it
avoids some gcc -Wall warnings regarding missing initializers.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoresize2fs: radically reduce memory utilization by using rbtree bitmaps
Theodore Ts'o [Fri, 25 Jul 2014 17:38:50 +0000 (13:38 -0400)]
resize2fs: radically reduce memory utilization by using rbtree bitmaps

When resizing an empty 21T file system to 28T, resize2fs was using
this much CPU time and memory:

216.98user 19.77system 4:02.92elapsed 97%CPU (0avgtext+0avgdata 4485664maxresident)k
8inputs+1068680outputs (0major+800745minor)pagefaults 0swaps

After this one-line change:

222.29user 0.49system 3:48.79elapsed 97%CPU (0avgtext+0avgdata 30080maxresident)k
8inputs+1068552outputs (0major+2497minor)pagefaults 0swaps

So this reduces the max memory utilized from 4.2GB to 29MB!

For future work, the primary place where we are spending the most cpu
time (from resize2fs -d 16) are these two places:

blocks_to_move: Memory used: 2508k/25096k (1903k/606k), time: 91.42/91.53/ 0.00

and

calculate_summary_stats: Memory used: 2508k/25612k (1908k/601k), time: 95.33/95.45/ 0.00

The calculate_summary_stats pass can be sped up by using
ext2fs_find_first_{zero,set}_block_bitmap2(), instead of iterating
over the entire block bitmap one bit at a time.

The blocks_to_move pass can be sped up by using a bitmap to store the
location of fs metadata blocks, to avoid an O(N**2) algorithm where N
is the number of groups in the file system.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agolibext2fs: fix rb_resize_bmap to handle the padding bits
Theodore Ts'o [Sat, 26 Jul 2014 04:45:28 +0000 (00:45 -0400)]
libext2fs: fix rb_resize_bmap to handle the padding bits

The bits between end and real_end are set as a safety measure for the
kernel when it uses the bit scan instructions.  We need to take this
into account when shrinking or growing the block allocation bitmap,
before we can safely use rbtree bitmaps in resize2fs.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agotests: use e2fsck -f instead of -p for resize tests
Theodore Ts'o [Sat, 26 Jul 2014 04:47:37 +0000 (00:47 -0400)]
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>
9 years agobuild: fix unused/uninitialized variable warnings
Andreas Dilger [Sat, 26 Jul 2014 01:43:08 +0000 (21:43 -0400)]
build: fix unused/uninitialized variable warnings

Fix a few warnings about unused and uninitialized variables.

Also fix util/subst.c to include <sys/time.h> to avoid using
undeclared functions gettimeofday() and futimes().

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fuzz: Create a tool to fuzz ext* filesystems
Darrick J. Wong [Fri, 25 Jul 2014 13:01:17 +0000 (09:01 -0400)]
e2fuzz: Create a tool to fuzz ext* filesystems

Creates a program that fuzzes only the metadata blocks (or optionally
all in-use blocks) of an ext* filesystem.  There's also a script to
automate fuzz testing of the kernel and e2fsck in a loop.

[ Modified by tytso to add e2fuzz to the clean makefile rule ]

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fuzz: Create a tool to fuzz ext* filesystems
Darrick J. Wong [Fri, 25 Jul 2014 13:01:17 +0000 (09:01 -0400)]
e2fuzz: Create a tool to fuzz ext* filesystems

Creates a program that fuzzes only the metadata blocks (or optionally
all in-use blocks) of an ext* filesystem.  There's also a script to
automate fuzz testing of the kernel and e2fsck in a loop.

[ Modified by tytso to add e2fuzz to the clean target ]

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agomke2fs: set error behavior at initialization time
Darrick J. Wong [Fri, 25 Jul 2014 12:58:29 +0000 (08:58 -0400)]
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>
9 years agoMerge branch 'maint' into next
Theodore Ts'o [Fri, 25 Jul 2014 12:58:10 +0000 (08:58 -0400)]
Merge branch 'maint' into next

Conflicts:
e2fsck/pass1.c
e2fsck/problem.h

9 years agoe2fsck: clear uninit flag on directory extents
Darrick J. Wong [Fri, 18 Jul 2014 22:55:21 +0000 (15:55 -0700)]
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>
9 years agoe2fsck: pass2 should not process directory blocks that are impossibly large
Darrick J. Wong [Fri, 25 Jul 2014 12:41:11 +0000 (08:41 -0400)]
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>
9 years agoe2fsck: always submit logical block 0 of a directory for pass 2
Darrick J. Wong [Fri, 25 Jul 2014 12:39:45 +0000 (08:39 -0400)]
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>
9 years agoMerge branch 'maint' into next
Theodore Ts'o [Fri, 25 Jul 2014 12:38:39 +0000 (08:38 -0400)]
Merge branch 'maint' into next

Conflicts:
e2fsck/pass1.c

9 years agoe2fsck: collapse holes in extent-based directories
Darrick J. Wong [Fri, 18 Jul 2014 22:54:30 +0000 (15:54 -0700)]
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>
9 years agoe2fsck: don't crash during rehash
Darrick J. Wong [Fri, 18 Jul 2014 22:54:15 +0000 (15:54 -0700)]
e2fsck: don't crash during rehash

If a user crafts a carefully constructed filesystem containing a
single directory entry block with an invalid checksum and fewer than
two entries, and then runs e2fsck to fix the filesystem, fsck will
crash when it tries to "compress" the short dir and passes a negative
dirent array length to qsort.  Therefore, don't allow directory
"compression" in this situation.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agomisc: fix problems with strncat
Darrick J. Wong [Fri, 18 Jul 2014 22:54:07 +0000 (15:54 -0700)]
misc: fix problems with strncat

The third argument to strncat is the maximum number of characters to
copy out of the second argument; it is not the maximum length of the
first argument.

Therefore, code in a check just in case we ever find a /sys/block/X
path long enough to hit the end of the buffer.  FWIW the longest path
I could find on my machine was 133 bytes.

Fixes-Coverity-Bug: 1252003
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agolibext2fs: fix bounds check of the bitmap test range in get_free_blocks2
Darrick J. Wong [Fri, 25 Jul 2014 11:11:57 +0000 (07:11 -0400)]
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>
9 years agoe2fsck: fix off-by-one bounds check on group number
Darrick J. Wong [Fri, 25 Jul 2014 02:19:27 +0000 (22:19 -0400)]
e2fsck: fix off-by-one bounds check on group number

Since fs->group_desc_count is the number of block groups, the number
of the last group is always one less than this count.  Fix the bounds
check to reflect that.

This flaw shouldn't have any user-visible side effects, since the
block bitmap test based on last_grp later on can handle overbig block
numbers.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: force all block allocations to use block_found_map
Darrick J. Wong [Fri, 18 Jul 2014 22:53:41 +0000 (15:53 -0700)]
e2fsck: force all block allocations to use block_found_map

During the later passes of efsck, we sometimes need to allocate and
map blocks into a file.  This can happen either by fsck directly
calling new_block() or indirectly by the library calling new_block
because it needs to allocate a block for lower level metadata (bmap2()
with BMAP_SET; block_iterate3() with BLOCK_CHANGED).

We need to force new_block to allocate blocks from the found block
map, because the FS block map could be inaccurate for various reasons:
the map is wrong, there are missing blocks, the checksum failed, etc.

Therefore, any time fsck does something that could to allocate blocks,
we need to intercept allocation requests so that they're sourced from
the found block map.  Remove the previous code that swapped bitmap
pointers as this is now unneeded.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: free ctx->fs, not fs, at the end of fsck
Darrick J. Wong [Fri, 25 Jul 2014 01:03:54 +0000 (21:03 -0400)]
e2fsck: free ctx->fs, not fs, at the end of fsck

When we call ext2fs_close_free at the end of main(), we need to supply
the address of ctx->fs, because the subsequent e2fsck_free_context
call will try to access ctx->fs (which is now set to a freed block) to
see if it should free the directory block list.  This is clearly not
desirable, so fix the problem.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: don't clobber critical metadata during check_blocks
Darrick J. Wong [Wed, 23 Jul 2014 16:11:23 +0000 (12:11 -0400)]
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>
9 years agodebugfs: fix printing of inline data during symlink inode dump
Darrick J. Wong [Tue, 22 Jul 2014 22:01:53 +0000 (18:01 -0400)]
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>
9 years agoMerge branch 'maint' into next
Theodore Ts'o [Tue, 22 Jul 2014 18:57:40 +0000 (14:57 -0400)]
Merge branch 'maint' into next

Conflicts:
debian/changelog
e2fsck/pass1.c
lib/ext2fs/Makefile.in

9 years agoe2fsck: fix inode coherency issue when iterating an inode's blocks
Darrick J. Wong [Fri, 18 Jul 2014 22:53:11 +0000 (15:53 -0700)]
e2fsck: fix inode coherency issue when iterating an inode's blocks

When we're about to iterate the blocks of a block-map file, we need to
write the inode out to disk if it's dirty because block_iterate3()
will re-read the inode from disk.  (In practice this won't happen
because nothing dirties block-mapped inodes before the iterate call,
but we can program defensively).

More importantly, we need to re-read the inode after the iterate()
operation because it's possible that mappings were changed (or erased)
during the iteration.  If we then dirty or clear the inode, we'll
mistakenly write the old inode values back out to disk!

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: check error return from ext2fs_extent_fix_parents in pass 1
Theodore Ts'o [Tue, 22 Jul 2014 18:48:41 +0000 (14:48 -0400)]
e2fsck: check error return from ext2fs_extent_fix_parents in pass 1

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: skip clearing bad extents if bitmaps are unreadable
Darrick J. Wong [Fri, 18 Jul 2014 22:53:04 +0000 (15:53 -0700)]
e2fsck: skip clearing bad extents if bitmaps are unreadable

If the bitmaps are known to be unreadable, don't bother clearing them;
just mark fsck to restart itself after pass 5, by which time the
bitmaps should be fixed.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: don't offer to recreate the journal if fsck is aborting due to bad block...
Darrick J. Wong [Tue, 22 Jul 2014 17:54:54 +0000 (13:54 -0400)]
e2fsck: don't offer to recreate the journal if fsck is aborting due to bad block bitmaps

If e2fsck knows the bitmaps are bad at the exit (probably because they
were bad at the start and have not been fixed), don't offer to
recreate the journal because doing so causes e2fsck to abort a second
time.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: report correct inode number in pass1b
Darrick J. Wong [Tue, 22 Jul 2014 17:52:33 +0000 (13:52 -0400)]
e2fsck: report correct inode number in pass1b

If there's a problem with the inode scan during pass 1b, report the
inode that we were trying to examine when the error happened, not the
inode that just went through the checker.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agodebugfs: allow bmap to allocate blocks
Darrick J. Wong [Tue, 22 Jul 2014 16:44:42 +0000 (12:44 -0400)]
debugfs: allow bmap to allocate blocks

Allow set_inode_field's bmap command in debugfs to allocate blocks,
which enables us to allocate blocks for indirect blocks and internal
extent tree blocks.  True, we could do this manually, but seems like
unnecessary bookkeeping activity for humans.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agodebugfs: create inode_dump command to dump an inode in hex
Darrick J. Wong [Tue, 22 Jul 2014 16:44:42 +0000 (12:44 -0400)]
debugfs: create inode_dump command to dump an inode in hex

Create a command that will dump an entire inode's space in hex.

[ Modified by tytso to add a description to the man page, and to add
  the more formal command name, inode_dump, in addition to short
  command name of "idump". ]

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe4defrag: backwards-allocated files should be defragmented too
Darrick J. Wong [Tue, 22 Jul 2014 16:40:56 +0000 (12:40 -0400)]
e4defrag: backwards-allocated files should be defragmented too

Currently, e4defrag avoids increasing file fragmentation by comparing
the number of runs of physical extents of both the original and the
donor files.  Unfortunately, there is a bug in the routine that counts
physical extents, since it doesn't look at the logical block offsets
of the extents.  Therefore, a file whose blocks were allocated in
reverse order will be seen as only having one big physical extent, and
therefore will not be defragmented.

Fix the counting routine to consider logical extent offset so that we
defragment backwards-allocated files.  This could be problematic if we
ever gain the ability to lay out logically sparse extents in a
physically contiguous manner, but presumably one wouldn't call defrag
on such a file.

Reported-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoe2fsck: free bh on csum verify error in do_one_pass
Eric Sandeen [Tue, 22 Jul 2014 16:40:30 +0000 (12:40 -0400)]
e2fsck: free bh on csum verify error in do_one_pass

Coverity (re-)spotted this; it was triaged as a false positive,
but it seems pretty clear that the bh (which was just checked)
isn't currently freed before the function exits.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agodebian: update changelog for 1.42.10-2 release
Theodore Ts'o [Sun, 13 Jul 2014 20:18:38 +0000 (16:18 -0400)]
debian: update changelog for 1.42.10-2 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agopo: update fr.po (from translationproject.org)
Samuel Thibault [Sun, 13 Jul 2014 17:12:51 +0000 (13:12 -0400)]
po: update fr.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoUse a wildcard for static libs in the git ignore list
Paul Wise [Sat, 12 Jul 2014 15:56:49 +0000 (11:56 -0400)]
Use a wildcard for static libs in the git ignore list

Signed-off-by: Paul Wise <pabs3@bonedaddy.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoAdd more generated files to the git ignore list
Paul Wise [Sat, 12 Jul 2014 15:56:49 +0000 (11:56 -0400)]
Add more generated files to the git ignore list

Signed-off-by: Paul Wise <pabs3@bonedaddy.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agolib/ext2fs: Only build tst_libext2fs for make check
Theodore Ts'o [Thu, 10 Jul 2014 20:26:14 +0000 (16:26 -0400)]
lib/ext2fs: Only build tst_libext2fs for make check

It's only necessary to build tst_libext2fs when running "make check".

Also make sure the links of the tst_* programs are done with
$(ALL_LDFLAGS).

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoUse sys/syscall.h instead of syscall.h
Theodore Ts'o [Thu, 10 Jul 2014 19:54:42 +0000 (15:54 -0400)]
Use sys/syscall.h instead of syscall.h

Most systems have a backwards compatibility symlink in
/usr/include/syscall.h to /usr/include/sys/syscall.h, but
sys/syscall.h is the documented location of the header file.  Fix two
locations where we were using <syscall.h> instead of <sys/syscall.h>.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agomke2fs: fix fencepost error when calling strncat
Theodore Ts'o [Thu, 10 Jul 2014 19:33:57 +0000 (15:33 -0400)]
mke2fs: fix fencepost error when calling strncat

There were other protections which would prevent a buffer overflow
from happening, but we should fix this nevertheless.

Addresses-Coverity-Bug: #1225003
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoMerge remote-tracking branch 'origin/maint' into next
Theodore Ts'o [Thu, 10 Jul 2014 05:07:39 +0000 (01:07 -0400)]
Merge remote-tracking branch 'origin/maint' into next

Conflicts:
RELEASE-NOTES
debian/changelog
version.h

9 years agoUpdate release notes, etc. for final 1.42.11 release v1.42.11
Theodore Ts'o [Thu, 10 Jul 2014 03:44:51 +0000 (23:44 -0400)]
Update release notes, etc. for final 1.42.11 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoFix nroff macro issue in chattr man page
Theodore Ts'o [Thu, 10 Jul 2014 04:47:40 +0000 (00:47 -0400)]
Fix nroff macro issue in chattr man page

The single quote character must not be in the first character in a
line, or else it can get mistaken as a macro call.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoFix up configure so it finds mkinstalldirs
Theodore Ts'o [Thu, 10 Jul 2014 04:17:05 +0000 (00:17 -0400)]
Fix up configure so it finds mkinstalldirs

As an object lesson in why autoreconf is fundamentally unsafe, the
newer version of nls.m4 no longer handles @MKINSTALLDIRS@.  So add
this back, since our Makefiles depend on it.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoUpdate translation files
Theodore Ts'o [Thu, 10 Jul 2014 03:30:49 +0000 (23:30 -0400)]
Update translation files

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agopo: update vi.po (from translationproject.org)
Trần Ngọc Quân [Thu, 10 Jul 2014 03:13:31 +0000 (23:13 -0400)]
po: update vi.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agopo: update uk.po (from translationproject.org)
Yuri Chornoivan [Thu, 10 Jul 2014 03:13:31 +0000 (23:13 -0400)]
po: update uk.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Thu, 10 Jul 2014 03:13:31 +0000 (23:13 -0400)]
po: update pl.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agopo: update nl.po (from translationproject.org)
Benno Schulenberg [Thu, 10 Jul 2014 03:13:31 +0000 (23:13 -0400)]
po: update nl.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agopo: update es.po (from translationproject.org)
Benno Schulenberg [Thu, 10 Jul 2014 03:13:30 +0000 (23:13 -0400)]
po: update es.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agopo: update eo.po (from translationproject.org)
Benno Schulenberg [Thu, 10 Jul 2014 03:13:30 +0000 (23:13 -0400)]
po: update eo.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agopo: update de.po (from translationproject.org)
Philipp Thomas [Thu, 10 Jul 2014 03:13:30 +0000 (23:13 -0400)]
po: update de.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agopo: update cs.po (from translationproject.org)
Petr Pisar [Thu, 10 Jul 2014 03:13:30 +0000 (23:13 -0400)]
po: update cs.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agomke2fs: add support to align hugefiles relative to beginning of the disk
Theodore Ts'o [Wed, 9 Jul 2014 00:02:48 +0000 (20:02 -0400)]
mke2fs: add support to align hugefiles relative to beginning of the disk

Add the mke2fs.conf configuration option which causes the hugefiles to
be aligned to the beginning of the disk.  This is important if the the
reason for aligning the hugefiles is to support hard-drive specific
features such as Shingled Magnetic Recording (SMR).

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agoMerge branch 'maint' into next
Theodore Ts'o [Sun, 6 Jul 2014 04:09:27 +0000 (00:09 -0400)]
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

9 years agoUpdate translation files for upcoming 1.42.11 release
Theodore Ts'o [Sun, 6 Jul 2014 03:44:28 +0000 (23:44 -0400)]
Update translation files for upcoming 1.42.11 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 years agopo: add Esperanto translation
Benno Schulenberg [Sun, 6 Jul 2014 03:39:54 +0000 (23:39 -0400)]
po: add Esperanto translation

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