Whamcloud - gitweb
tools/e2fsprogs.git
10 years agoe2fsck: fully and properly gettextize two error messages
Benno Schulenberg [Sun, 1 Jun 2014 21:27:49 +0000 (23:27 +0200)]
e2fsck: fully and properly gettextize two error messages

The phrases "mounted" and "in use" were filled in untranslated into
the messages.  But it is better to gettextize entire sentences, and
not synthesize them from fragments.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agomke2fs: fix a typo in an error message
Benno Schulenberg [Mon, 2 Jun 2014 01:12:47 +0000 (21:12 -0400)]
mke2fs: fix a typo in an error message

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoFix up minor typo in German translation
Theodore Ts'o [Sat, 31 May 2014 17:37:30 +0000 (13:37 -0400)]
Fix up minor typo in German translation

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: pth@suse.de
10 years agopo: update de.po (from translationproject.org)
Philipp Thomas [Sat, 31 May 2014 17:32:39 +0000 (13:32 -0400)]
po: update de.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agofilefrag: exit with error code if an error is hit
Andreas Dilger [Tue, 27 May 2014 16:56:45 +0000 (12:56 -0400)]
filefrag: exit with error code if an error is hit

If an error is hit during filefrag operation, it will continue to run
(if multiple files are specified on the command-line), but will exit
with a non-zero value, so that callers can determine that some error
was hit.

Clean up the printing of FIEMAP flags and print some newer flags that
were missing.  Also print unknown flags as hex values.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agolib/ext2fs: clean and build ext2_types.h as necessary
Theodore Ts'o [Tue, 27 May 2014 16:24:33 +0000 (12:24 -0400)]
lib/ext2fs: clean and build ext2_types.h as necessary

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agotst_libext2fs: add new debug program which used for libext2fs unit tests
Theodore Ts'o [Fri, 23 May 2014 14:28:04 +0000 (10:28 -0400)]
tst_libext2fs: add new debug program which used for libext2fs unit tests

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agomisc: use unsigned long long for file block count in filefrag
Vitaliy Filippov [Mon, 26 May 2014 16:08:35 +0000 (12:08 -0400)]
misc: use unsigned long long for file block count in filefrag

This patch fixes incorrect reporting of file block count on 32-bit platforms.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoe2fsprogs: don't run quota test if quota is not enabled
Eric Sandeen [Mon, 26 May 2014 15:43:24 +0000 (11:43 -0400)]
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>
10 years agoe2fsck: fix Makefile dependency for quota.o
Theodore Ts'o [Thu, 22 May 2014 22:52:27 +0000 (18:52 -0400)]
e2fsck: fix Makefile dependency for quota.o

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agodebugfs: fix debugfs/quota.c compile warnings
Andreas Dilger [Thu, 22 May 2014 06:38:07 +0000 (00:38 -0600)]
debugfs: fix debugfs/quota.c compile warnings

Fix type mismatch and unused variable warnings.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agodebugfs: fix filehandle leak in copy_file()
Andreas Dilger [Tue, 20 May 2014 22:30:35 +0000 (16:30 -0600)]
debugfs: fix filehandle leak in copy_file()

Fix a file handle leak for the target file in copy_file() when error
handlers return without closing the file.  Instead, clean up at the
end of the function to handle cleanup in normal and error cases.

Minor other code style cleanups.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agodebugfs: fix string_to_time for MacOS strptime()
Andreas Dilger [Tue, 20 May 2014 22:31:10 +0000 (16:31 -0600)]
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>
10 years agomke2fs: use ext2fs_open_file() in check_plausibility()
Eric Sandeen [Wed, 21 May 2014 17:47:44 +0000 (12:47 -0500)]
mke2fs: use ext2fs_open_file() in check_plausibility()

The commit:

802146c mke2fs: create a regular file if necessary

caused a regression on 32-bit machines; the open() fails if
the file size is > 4G.

Using ext2fs_open_file() fixes it.

Addresses-Red-Hat-Bugzilla: #1099892

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoUpdate release notes, etc. for final 1.42.10 release v1.42.10
Theodore Ts'o [Mon, 19 May 2014 01:51:21 +0000 (21:51 -0400)]
Update release notes, etc. for final 1.42.10 release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agodebian: override source-is-missing false positive
Theodore Ts'o [Mon, 19 May 2014 02:51:22 +0000 (22:51 -0400)]
debian: override source-is-missing false positive

See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=748421

Once a new version of Lintian is uploaded with this fixed, we can drop
this override.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agodebian: fix debian/rules compatibility with gmake 4.0
Theodore Ts'o [Mon, 19 May 2014 02:29:01 +0000 (22:29 -0400)]
debian: fix debian/rules compatibility with gmake 4.0

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoUpdate translation files for 1.42.10 release
Theodore Ts'o [Mon, 19 May 2014 01:47:32 +0000 (21:47 -0400)]
Update translation files for 1.42.10 release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoFix obvious typo in German translation
Theodore Ts'o [Mon, 19 May 2014 01:36:52 +0000 (21:36 -0400)]
Fix obvious typo in German translation

Addresses-Debian-Bug: #737800

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agopo: update vi.po (from translationproject.org)
Trần Ngọc Quân [Sun, 18 May 2014 13:46:34 +0000 (09:46 -0400)]
po: update vi.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agopo: update sv.po (from translationproject.org)
Göran Uddeborg [Sun, 18 May 2014 13:46:34 +0000 (09:46 -0400)]
po: update sv.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Sun, 18 May 2014 13:46:34 +0000 (09:46 -0400)]
po: update pl.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agopo: update nl.po (from translationproject.org)
Benno Schulenberg [Sun, 18 May 2014 13:46:34 +0000 (09:46 -0400)]
po: update nl.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agopo: update fr.po (from translationproject.org)
Samuel Thibault [Sun, 18 May 2014 13:46:34 +0000 (09:46 -0400)]
po: update fr.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agopo: update es.po (from translationproject.org)
Benno Schulenberg [Sun, 18 May 2014 13:46:34 +0000 (09:46 -0400)]
po: update es.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agopo: update cs.po (from translationproject.org)
Petr Pisar [Sun, 18 May 2014 13:46:34 +0000 (09:46 -0400)]
po: update cs.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agomke2fs: set gdt csum when creating packed fs
Darrick J. Wong [Mon, 12 May 2014 04:21:29 +0000 (00:21 -0400)]
mke2fs: set gdt csum when creating packed fs

When we're creating a fs with metadata blocks packed at the beginning
(packed_meta_blocks=1 in mke2fs.conf), set the group descriptor
checksum or else we create DOA filesystems with checksum errors.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
10 years agoresize2fs: fix sanity check in reserve_sparse_super2_last_group()
Darrick J. Wong [Mon, 12 May 2014 03:33:08 +0000 (23:33 -0400)]
resize2fs: fix sanity check in reserve_sparse_super2_last_group()

In reserve_sparse_super2_last_group, the old_desc check should only be
performed if ext2fs_super_and_bgd_loc2() gave us a location -- a
return value of 0 means that there is no old-style GDT block.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoquota: remove mke2fs's and tune2fs's warning messages regarding quota
Theodore Ts'o [Sun, 11 May 2014 04:23:49 +0000 (00:23 -0400)]
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>
10 years agotests: add basic e2fsck regression test for fixing the quota inode
Theodore Ts'o [Sun, 11 May 2014 04:01:33 +0000 (00:01 -0400)]
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>
10 years agodebugfs: add commands to query the quota information
Theodore Ts'o [Sun, 11 May 2014 03:28:10 +0000 (23:28 -0400)]
debugfs: add commands to query the quota information

This allows us to verify quota information in an ext4 file systems
with the quota feature.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
10 years agoquota: support storing the quota file handles in the quota context
Theodore Ts'o [Sun, 11 May 2014 03:19:12 +0000 (23:19 -0400)]
quota: support storing the quota file handles in the quota context

This makes memory management easier because when the quota context is
released, all of the quota file handles get released automatically.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
10 years agoquota: integrate mkquota.h into quotaio.h
Theodore Ts'o [Sat, 10 May 2014 22:55:20 +0000 (18:55 -0400)]
quota: integrate mkquota.h into quotaio.h

There are interfaces that are used by mke2fs.c and tune2fs.c which are
in quotaio.h, and some future changes will be much simpler if we can
combine the two header files together.  Also the guard #ifdef for
mkquota.h was incorrect, which caused problems when both header files
needed to be included.

Also remove quota.pc and installation rules for libquota, since this
library is never going to be something that we can export externally
anyway.  Eventually we'll want to clean up the interfaces and move the
external publishable interfaces to the libext2fs library, and then
rename what's left from libquota.a to libsupport.a for internal use
only.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
10 years agoquota: fix memory leak in quota_compare_and_update()
Theodore Ts'o [Sat, 10 May 2014 21:29:18 +0000 (17:29 -0400)]
quota: fix memory leak in quota_compare_and_update()

The quota_handle wasn't getting closed in quota_compare_and_update().
Fix this, and also make sure that quota_file_close() doesn't
unnecessarily modify the quota inode if it's not necessary.  Otherwise
e2fsck will claim that the file system is modified when it didn't need
to be.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
10 years agoquota: fix e2fsck to notice missing quota entries
Theodore Ts'o [Sat, 10 May 2014 05:27:31 +0000 (01:27 -0400)]
quota: fix e2fsck to notice missing quota entries

Previously if there was a missing quota entry --- i.e., if there were
files owned by group "eng", but there was no quota record for group
"eng", e2fsck would not notice the missing entry.  This means that the
usage informtion would not be properly repaired.  This is unfortunate.
Fix this by marking each quota record in quota_dict that has a
corresponding record on disk, and then check to see if there are any
records in quota_dict that have not been marked as having been seen.
In that case, we know we need to update the relevant quota inode.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
10 years agoquota: fix e2fsck so we update the quota file correctly
Theodore Ts'o [Sat, 10 May 2014 05:11:41 +0000 (01:11 -0400)]
quota: fix e2fsck so we update the quota file correctly

In scan_dquota_callback() we were copying dqb_off from the on-disk
dquot structure to the dqot structure that we have constructed in
memory.  This is a bad idea, because if we detect that the quota inode
is corrupted and needs to be replaced, when we later write out the
inode, the fact that we have a non-zero dqb_off value means that quota
routines will not bother updating the quota tree index, since
presumably the quota tree index already has an entry for this dqot.

The problem is that e2fsck, the only user of these functions, has
zapped the quota inode so it can be written from scratch.  So this
means the index for the quota records are not written out, so the
kernel can not find any of the records in the quota inodes.  Oops.

The fix is simple; there is no reason to copy the dqb_off field into
the quota_dict copy of struct dquot.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
10 years agoquota: add debugging code to print the dquot structure
Theodore Ts'o [Sat, 10 May 2014 05:09:44 +0000 (01:09 -0400)]
quota: add debugging code to print the dquot structure

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
10 years agolibquota: fix dict_uint_cmp()
Niu Yawei [Thu, 8 May 2014 02:38:53 +0000 (10:38 +0800)]
libquota: fix dict_uint_cmp()

dict_uint_cmp() returns an usigned int value in int type, which
could mess the dict key comparison when the difference of two
keys is greater than INT_MAX.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoAdd a make variable for the pkgconfig install dir
David Michael [Wed, 7 May 2014 03:05:17 +0000 (23:05 -0400)]
Add a make variable for the pkgconfig install dir

Adding the pkgconfigdir variable allows specifying an installation
location for pkg-config files independent of libdir.

Signed-off-by: David Michael <fedora.dm0@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoFix cross compilation problem in parse-types.sh
Chen Qi [Tue, 6 May 2014 01:08:42 +0000 (21:08 -0400)]
Fix cross compilation problem in parse-types.sh

The checking of types in parse-types.sh doesn't make much sense in a
cross-compilation environment, because the generated binary is
executed on build machine.

So even if asm_types.h has got correct statements for types, it's
possible that the generated binary will report an error, because these
types are for the target machine.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agomke2fs: check for a partition table and warn if present
Theodore Ts'o [Mon, 5 May 2014 05:22:22 +0000 (01:22 -0400)]
mke2fs: check for a partition table and warn if present

This supercedes the "whole disk" check, since it does a better job and
there are times when it is quite legitimate to want to use the whole
disk.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agomke2fs: print extra information about existing ext2/3/4 file systems
Theodore Ts'o [Mon, 5 May 2014 04:20:31 +0000 (00:20 -0400)]
mke2fs: print extra information about existing ext2/3/4 file systems

The basic idea is to provide a bit more context in this situation:

% ./misc/mke2fs -t ext4 /dev/sdc3
mke2fs 1.42.9 (4-Feb-2014)
/dev/sdc3 contains a ext4 file system
Proceed anyway? (y,n)

... by adding this bit of context:

% ./misc/mke2fs -t ext4 /dev/sdc3
mke2fs 1.42.9 (4-Feb-2014)
/dev/sdc3 contains a ext4 file system
last mounted on /SOX-backups on Mon May  5 08:59:53 2014
Proceed anyway? (y,n)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agomke2fs: print a message when creating a regular file
Theodore Ts'o [Mon, 5 May 2014 03:40:58 +0000 (23:40 -0400)]
mke2fs: print a message when creating a regular file

We've added the ability to automatically recreate a file if it doesn't
exist prior to creating the file system, since this is often used (for
example) when managing file system images for use in virtual machines.
We should at least notify the user that this is going on to avoid
surprises in the case of misspelled device/file names.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoresize2fs: fix inode table move for the backwards move case
Theodore Ts'o [Mon, 28 Apr 2014 14:07:16 +0000 (10:07 -0400)]
resize2fs: fix inode table move for the backwards move case

In the case where the new location of the inode table is before the
old inode table, the optimization which tries to optimize zero block
moves breaks.  Fix it.

This fixes a bug that was tickled by the reproduction described in the
previous commit.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agolibext2fs: fix alloc_allocate_group_table() if the flexbg_offset wraps
Theodore Ts'o [Mon, 28 Apr 2014 14:03:12 +0000 (10:03 -0400)]
libext2fs: fix alloc_allocate_group_table() if the flexbg_offset wraps

If the previous block group's inode table ends at the very end of file
system, wrap around to the beginning of the flex_bg.

This fixes a bug was tickled by:

mke2fs.conf:
frontload = {
features = extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize,^resize_inode,sparse_super2
hash_alg = half_md4
num_backup_sb = 0
packed_meta_blocks = 1
inode_ratio = 4194304
flex_bg_size = 262144
}

mke2fs -T frontload /tmp/foo.img 2T
resize2fs -M /tmp/foo.img
resize2fs -M /tmp/foo.img

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoresize2fs: refine minimum required blocks for flex_bg file systems
Theodore Ts'o [Sun, 27 Apr 2014 19:52:48 +0000 (15:52 -0400)]
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>
10 years agoresize2fs: fix overly-pessimistic calculation of minimum size required
Theodore Ts'o [Sun, 27 Apr 2014 02:08:02 +0000 (22:08 -0400)]
resize2fs: fix overly-pessimistic calculation of minimum size required

For extent-mapped file systems, we need to reserve some extra space in
case we need to grow the extent tree.  Calculate the safety margin
more intelligently, so we don't overestimate the amount of space
required.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: Dmitry Monakhov <dmonakhov@openvz.org>
10 years agoe2fsck: if any problems are fixed in pass 0, check the whole file system
Theodore Ts'o [Sun, 27 Apr 2014 03:14:47 +0000 (23:14 -0400)]
e2fsck: if any problems are fixed in pass 0, check the whole file system

If there are any PREEN_OK problems fixed in check_super_block(), don't
skip checking the full file system.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoe2fsprogs/filefrag: print shared extent flag
Mark Fasheh [Sun, 27 Apr 2014 00:23:00 +0000 (20:23 -0400)]
e2fsprogs/filefrag: print shared extent flag

Filefrag doesn't catch and print the shared extent flag. Add this for
users of filefrag on file systems with shared extents (such as btrfs).

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agomke2fs: only print the low-level file system stats in verbose mode
Theodore Ts'o [Sat, 26 Apr 2014 23:00:50 +0000 (19:00 -0400)]
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>
10 years agomke2fs: check for pre-existing file system
Theodore Ts'o [Sat, 26 Apr 2014 22:42:31 +0000 (18:42 -0400)]
mke2fs: check for pre-existing file system

Warn the system administrator if there is an existing file system on
the block device, and give the administrator an opportunity to abort
the mkfs operation.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agomke2fs: add an option in mke2fs.conf to proceed after a delay
Theodore Ts'o [Sat, 26 Apr 2014 21:34:52 +0000 (17:34 -0400)]
mke2fs: add an option in mke2fs.conf to proceed after a delay

If mke2fs needs to ask the user for permission, and the user doesn't
type anything the specified delay in the /etc/mke2fs.conf file,
proceed as if the user had said yes.  The default is to do what we
currently do, which is to wait until the user answers the question one
way or the other.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agomke2fs: create a regular file if necessary
Theodore Ts'o [Sat, 26 Apr 2014 20:17:38 +0000 (16:17 -0400)]
mke2fs: create a regular file if necessary

This is useful when creating a filesystem for use with a VM, for
example.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agomke2fs: don't complain if the regular file is too small
Theodore Ts'o [Sat, 26 Apr 2014 19:12:21 +0000 (15:12 -0400)]
mke2fs: don't complain if the regular file is too small

Don't ask the user if it's OK that a regular file is smaller than the
requested size.  This test only makes sense if we are creating the
file system on a block device.  This allow users to not need to
manually answer the "proceed?" question when creating a file system
backed by a simple file.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agomke2fs, tune2fs: call proceed_question() from check_plausibility()'s caller
Theodore Ts'o [Sat, 26 Apr 2014 17:14:32 +0000 (13:14 -0400)]
mke2fs, tune2fs: call proceed_question() from check_plausibility()'s caller

Move the call to proceed_question() from check_plausibility() to its
caller.  This allows more fine grained control by mke2fs about when it
might want to call check_plausibility().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agomke2fs: don't ask the proceed question using a regular file
Theodore Ts'o [Sat, 26 Apr 2014 16:16:44 +0000 (12:16 -0400)]
mke2fs: don't ask the proceed question using a regular file

Very often people are creating file systems using regular files, so we
shouldn't ask the user to confirm using the proceed question.
Otherwise it encourages users to use the -F flag, which is a bad
thing.

We do need to continue to check if the external journal device is a
block device.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoe2fsck: skip low dtime check if the number of inodes > s_mkfs_time
Theodore Ts'o [Tue, 22 Apr 2014 18:14:56 +0000 (14:14 -0400)]
e2fsck: skip low dtime check if the number of inodes > s_mkfs_time

We already skip the low dtime check if the number of inods is greater
than the last mount or last written time.  However, if a very large
file system is resized sufficiently large that the number of inodes is
greater than when the file system was original created, we can end up
running afoul of the low dtime check.  This results in a large number
of false positives which e2fsck can fix up without causing any
problems, but it can induce a large amount of anxiety for the system
administrator.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: Patrik Horník <patrik@hornik.sk>
10 years agotests: fix resize test tmpfs max-file-size checking
Andreas Dilger [Mon, 14 Apr 2014 16:48:16 +0000 (12:48 -0400)]
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>
10 years agofix miscellaneous build warnings
Andreas Dilger [Mon, 14 Apr 2014 16:20:25 +0000 (12:20 -0400)]
fix miscellaneous build warnings

Fix various unused variable and use-uninitialized warnings.

Add generated files into .gitignore.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoe4defrag: fix error reporting when ext2fs_open fails
Theodore Ts'o [Fri, 11 Apr 2014 03:16:34 +0000 (23:16 -0400)]
e4defrag: fix error reporting when ext2fs_open fails

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoe4defrag: open fs with EXT2_FLAG_64BITS flag
Jon Ernst [Fri, 11 Apr 2014 03:06:35 +0000 (23:06 -0400)]
e4defrag: open fs with EXT2_FLAG_64BITS flag

This allows e4defrag to work with 64-bit and bigalloc file systems.

Signed-off-by: Jon Ernst <jonernst07@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agologsave: make message when process has a non-zero exit code to be less scary
Theodore Ts'o [Sat, 29 Mar 2014 14:25:49 +0000 (10:25 -0400)]
logsave: make message when process has a non-zero exit code to be less scary

Addresses-Debian-Bug: #468821

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agomke2fs: disable resize_inode feature if 64bit feature is enabled
Eryu Guan [Thu, 4 Jul 2013 09:05:10 +0000 (17:05 +0800)]
mke2fs: disable resize_inode feature if 64bit feature is enabled

Since auto_64-bit_support is on by default, resize_inode feature will
be disabled when creating a >16T ext4 according to mke2fs.conf(5).

This should also be done when making ext4 with "-O 64bit" to enable
64bit feature explicitly. Otherwise online resize to enlarge a
over-16T fs to larger would fail.

[root@localhost resize]# truncate -s 50t fs.img
[root@localhost resize]# losetup /dev/loop0 fs.img
[root@localhost resize]# mkfs -t ext4 -O 64bit /dev/loop0 30t
[root@localhost resize]# mount /dev/loop0 mnt
[root@localhost resize]# resize2fs /dev/loop0
resize2fs 1.42.7 (21-Jan-2013)
Filesystem at /dev/loop0 is mounted on /root/resize/mnt; on-line resizing required
old_desc_blocks = 3840, new_desc_blocks = 6400
resize2fs: Invalid argument While checking for on-line resizing support

And dmesg shows
[688378.442623] EXT4-fs (loop0): resizing filesystem from 6710886400 to 13421772800 blocks
[688378.443216] EXT4-fs warning (device loop0): verify_reserved_gdb:700: reserved GDT 3201 missing grp 177147 (5804756097)
[688378.443222] EXT4-fs (loop0): resized filesystem to 8858370048
[688378.528451] EXT4-fs warning (device loop0): ext4_group_extend:1710: can't shrink FS - resize aborted

With this fix resize2fs could do the online enlarge correctly.

Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoe2fsck: don't use e2fsck_global_ctx in e2fsck_set_bitmap_type()
Theodore Ts'o [Wed, 5 Mar 2014 00:10:26 +0000 (19:10 -0500)]
e2fsck: don't use e2fsck_global_ctx in e2fsck_set_bitmap_type()

There is no reason to use e2fsck_global_ctx in
e2fsck_set_bitmap_type(), since we can get the context structure from
fs->priv_data.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoe2fsck: always make sure e2fsck_global_ctx is set
Theodore Ts'o [Wed, 5 Mar 2014 00:05:00 +0000 (19:05 -0500)]
e2fsck: always make sure e2fsck_global_ctx is set

The e2fsck_global_ctx varible was only being set if HAVE_SIGNAL_H is
defined.  There are systems, such as Android, where this is not true.

This was causing e2fsck_set_bitmap_type() to seg fault since
e2fsck_global_ctx was not NULL.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: JP Abgrall <jpa@google.com>
10 years agodebian: fix udeb package support
Filipe Brandenburger [Tue, 25 Feb 2014 06:33:00 +0000 (01:33 -0500)]
debian: fix udeb package support

Previous commit which introduced SKIP_UDEB variable had typos in the
variable name in the m4 macros of control.in (UDEV vs. UDEB.) Fix those
typos and fix m4 quoting problem in "Don't".

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoresize2fs: don't free in-use clusters when moving blocks
Darrick J. Wong [Mon, 24 Feb 2014 01:54:54 +0000 (20:54 -0500)]
resize2fs: don't free in-use clusters when moving blocks

When we're moving blocks around the filesystem, ensure that freeing
the old blocks only frees the clusters if they're not in use by other
metadata.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoresize2fs: during shrink, don't free in-use bg data clusters
Darrick J. Wong [Mon, 24 Feb 2014 01:33:59 +0000 (20:33 -0500)]
resize2fs: during shrink, don't free in-use bg data clusters

When freeing a block group descriptor block, be careful not to free
metadata clusters belonging to other groups!

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoe2fsck: don't add a UUID on a mounted filesystem with csums
Michael Marineau [Sun, 19 Jan 2014 22:09:34 +0000 (14:09 -0800)]
e2fsck: don't add a UUID on a mounted filesystem with csums

This fix is similar to 66457fcb for tune2fs. When booting from a root
filesystem with an empty UUID which fsck fixes the following remount
step reliably fails, leaving the filesystem in an inconsistent state.
Like the tune2fs fix this patch resolves the issue by simply refusing to
update the UUID if the filesystem is mounted.

Signed-off-by: Michael Marineau <michael.marineau@coreos.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoAdd coverage testing using gcov
Theodore Ts'o [Sun, 23 Feb 2014 05:17:09 +0000 (00:17 -0500)]
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>
10 years agoSet pointer to NULL after ext2fs_free
Lukas Czerner [Fri, 21 Feb 2014 01:54:29 +0000 (20:54 -0500)]
Set pointer to NULL after ext2fs_free

ext2fs_free() does not set the ext2_filsys pointer to null so the
caller is responsible to setting it himself if it is needed.

This patch fixes some places where caller did not set ext2_filsys
pointer to NULL after ext2fs_free() which might result in use after
free.  Fix it.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agotune2fs: allow removal of dirty journal with two "-f" options
Eric Sandeen [Fri, 21 Feb 2014 01:18:41 +0000 (20:18 -0500)]
tune2fs: allow removal of dirty journal with two "-f" options

Jim pointed out that "tune2fs -f -O ^has_journal" won't remove the
journal if the needs_recovery flag is set; the manpage seems to indicate
that it should.  And if you've lost an external journal and can no longer
replay it, how should one proceed?

Change tune2fs so that two "-f" options will allow removal of a dirty
journal from a filesystem, even if the filesystem needs recovery.

e2fsck can then do its best to pick up the pieces.

Addresses-Debian-Bug: #559301

Reported-by: Jim Faulkner <james.faulkner@yale.edu>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agolibext2fs: delete unused "handle" variable
jon ernst [Fri, 21 Feb 2014 00:59:24 +0000 (19:59 -0500)]
libext2fs: delete unused "handle" variable

After commit 62f17f36031102a2a40fac338e063c556f73b94a, variable
"handle" has no use.  So delete it.

Signed-off-by: Jon Enrst <jonernst07@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoe4defrag: remove local sync_file_range and fallocate
Baruch Siach [Wed, 19 Feb 2014 01:02:49 +0000 (20:02 -0500)]
e4defrag: remove local sync_file_range and fallocate

The locally defined versions of both sync_file_range and fallocate are broken
on 32bit systems. On these systems two 32bit registers are needed for each
64bit parameter. Also, sync_file_range on MIPS32 needs a dummy parameters
after the fd parameter. Just leave all these subtleties to the C library.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoext2fs: declare struct_io_manager at end of file
Andreas Dilger [Tue, 18 Feb 2014 23:31:36 +0000 (18:31 -0500)]
ext2fs: declare struct_io_manager at end of file

Declare struct_io_manager at the end of unix_io.c, undo_io.c, and
test_io.c files so that there isn't a need to forward declare every
member of this structure.  That avoids a lot of redundant code
at the start of every one of these files.

Move the test_flush() function above test_abort() to avoid the need
for a forward declaration.

Fix a few instances of space before tab in these files.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agotests: skip unsupported tests on MacOS systems
Andreas Dilger [Tue, 18 Feb 2014 23:29:55 +0000 (18:29 -0500)]
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>
10 years agobuild: fix LLVM compiler warnings
Andreas Dilger [Tue, 18 Feb 2014 17:12:32 +0000 (12:12 -0500)]
build: fix LLVM compiler warnings

Fix a number of non-literal string format warnings from LLVM due
to the use of _() that were not fixed in commit 45ff69ffeb.

Fix mismatched int vs. __u64 format warnings in blkmap64_rb.c.
There were also some comparisons of __u64 start or count <= 0.
Change them to be comparisons == 0, or start + count overflow.

Fix operator precedence warning for (value & (value - 1) != 0)
introduced in 11d1116a7c0b.  It seems "&" is lower precedence
than "!=", so the above didn't fail for power-of-two values,
but only odd values.  Fortunately, either s_desc_size nor
s_inode_size is valid if odd.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agochattr: improve the description for 'j' option in manpage
Zheng Liu [Wed, 12 Feb 2014 17:28:29 +0000 (12:28 -0500)]
chattr: improve the description for 'j' option in manpage

Ext4 file system also supports to set/clear 'j' attribute, but it just
say that this option is only useful for ext3 in manpage.  This commit
fixes it.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
10 years agolibe2p: allow libe2p.h to be used in C++ programs
Theodore Ts'o [Fri, 7 Feb 2014 22:25:28 +0000 (17:25 -0500)]
libe2p: allow libe2p.h to be used in C++ programs

In C++, "private" is a reserved keyword, so don't use it in the header
file as a function parameter name.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agolibext2fs: try to roll back when splitting an extent fails
Darrick J. Wong [Thu, 6 Feb 2014 20:34:00 +0000 (15:34 -0500)]
libext2fs: try to roll back when splitting an extent fails

If a client asks us to remap a block in the middle of an extent, we
potentially have to allocate a fair number of blocks to handle extent
tree splits.  A failure in either of the ext2fs_extent_insert calls
leaves us with an extent tree that no longer maps the logical block in
question and everything that came after it!  Therefore, try to roll
back the extent tree changes before returning an error code.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agolibext2fs: don't hang on to unmapped block if extent tree update fails
Darrick J. Wong [Thu, 6 Feb 2014 20:32:18 +0000 (15:32 -0500)]
libext2fs: don't hang on to unmapped block if extent tree update fails

If we're doing a BMAP_ALLOC allocation and the extent tree update
fails, there's no point in hanging on to the newly allocated block.
So, free it to make fsck happy.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agolibext2fs: during punch, fix parent extents after modifying extent
Darrick J. Wong [Thu, 6 Feb 2014 20:30:59 +0000 (15:30 -0500)]
libext2fs: during punch, fix parent extents after modifying extent

When modifying/removing an extent during punch, don't forget to update
the extent's parents.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agolibext2fs: iterate past lower extents during punch
Darrick J. Wong [Thu, 6 Feb 2014 20:29:15 +0000 (15:29 -0500)]
libext2fs: iterate past lower extents during punch

When we're iterating extents during a punch operation, the loop exits
if the punch region is entirely to the right of the extent we're
looking at.  This can happen if the punch region starts in the middle
of a hole and covers mapped extents.  When this happens, we want to
skip to the next extent, because it might be punchable.

Also, if we've totally passed the punch range, stop.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agomke2fs: clean up kernel version tests
Darrick J. Wong [Thu, 6 Feb 2014 20:24:01 +0000 (15:24 -0500)]
mke2fs: clean up kernel version tests

Refactor the running kernel version checks to hide the details of
version code checking, etc.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoe2fsprogs: Disallow tune2fs enabling sparse_super with ext4 meta_bg enabled
Akira Fujita [Thu, 6 Feb 2014 20:11:52 +0000 (15:11 -0500)]
e2fsprogs: Disallow tune2fs enabling sparse_super with ext4 meta_bg enabled

When meta_bg feature is enabled, group descriptor block is allocated
every 128 block group (or every 64 block group if 64bit feature is
enabled).

In such situation, files in block group more than #128 will be removed
if sparse_super feature is enabled with tune2fs and afterwards
necessary e2fsck running.

Because tune2fs does not reallocate group descriptor blocks but just
set sparse_super feature.  If ext4 has sparse_super,
ext2fs_descriptor_block_loc2() called by e2fsck thinks the block group
(e.g. #128) that it has group descriptor block at the head offset. But
that offset is used as backup super block before.  So e2fsck fixes
ext4 based on invalid group descriptor blocks and this cause data
lost.

The patch avoids this problem simply by disallow tune2fs enabling
sparse_super if meta_bg is enabled.

Steps to reproduce:

1. Create ext4 which has meta_bg, ^sparse_super and 129+ block groups.
# mke2fs -t ext4 -O meta_bg,^resize_inode,^sparse_super DEV 17G
# mount DEV /MP

2. Create direcotry and files which use block group #128's metadata.
# echo $((8192*128+1)) > /sys/fs/ext4/DEV/inode_goal
# mkdir /MP/DIR
# for i in $(seq 1 100); do dd if=/dev/urandom of=/MP/DIR/file$i bs=1024 count=10; done

3. Enable sparse_super with tune2fs then execute e2fsck.
   Data in block group #128 will be lost!!
# umount DEV
# tune2fs -O sparse_super DEV
# e2fsck/e2fsck -yf DEV

Signed-off-by: Akira Fujita <a-fujita@rs.jp.ne.cocm>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agodebian: fix spelling typo in debian/control.in
Theodore Ts'o [Thu, 6 Feb 2014 20:00:44 +0000 (15:00 -0500)]
debian: fix spelling typo in debian/control.in

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agodebian: add make variable to prevent building udeb packages
Theodore Ts'o [Thu, 6 Feb 2014 19:59:25 +0000 (14:59 -0500)]
debian: add make variable to prevent building udeb packages

Setting SKIP_UDEBS=yes in rules.custom will prevent the debian/rules
makefile from building the udeb files for the debian installer.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agomke2fs: minor bugfixes for mk_hugefiles
Theodore Ts'o [Thu, 6 Feb 2014 19:34:12 +0000 (14:34 -0500)]
mke2fs: minor bugfixes for mk_hugefiles

Interpret "zero_hugefiles" relation in mke2fs.conf as a boolean value,
as documented in the man page.

If the hugefile is larger than 2GB, set the large_file file system
feature so e2fsck doesn't complain.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoconfigure: support biarch builds with --multiarch=lib64
Theodore Ts'o [Wed, 5 Feb 2014 20:45:36 +0000 (15:45 -0500)]
configure: support biarch builds with --multiarch=lib64

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agodebian: update debian/changelog and e2fslibs.symbols for 1.42.9-3 release
Theodore Ts'o [Wed, 5 Feb 2014 03:59:25 +0000 (22:59 -0500)]
debian: update debian/changelog and e2fslibs.symbols for 1.42.9-3 release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agodebian: fix dpkg-buildpackage for Debian Squeeze
Theodore Ts'o [Wed, 5 Feb 2014 02:45:51 +0000 (21:45 -0500)]
debian: fix dpkg-buildpackage for Debian Squeeze

Commit becb01ce84d breaks building e2fsprogs with dpkg 1.15.8 which is
used in Debian 6.0 (Squeeze), since it doesn't support package
specifications qualified with an architecture (i.e., "dpkg-query -W
libblkid1:amd64").

Debian only needs to use its own version of libblkid and libuuid for
versions of Debian 5.0 (Lenny) or before.  So default to using
util-linux-ng, instead of trying to test the version number of
libblkid1.

Lenny was released in February, 2009, and the current stable Debian
release is 7.x, so it is two stable releases back as of February 2014.
In the unlikely case someone needs to build a modern version of
e2fsprogs on a version of Debian which is five years old or older, can
create the file Debian/rules.custom with the line:

UTIL_LINUX_NG = no

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agomke2fs: add support for hugefiles_align
Theodore Ts'o [Tue, 4 Feb 2014 17:30:00 +0000 (12:30 -0500)]
mke2fs: add support for hugefiles_align

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoFix up the Makefiles dependencies in lib/ext2fs and lib/quota
Theodore Ts'o [Thu, 30 Jan 2014 23:48:23 +0000 (18:48 -0500)]
Fix up the Makefiles dependencies in lib/ext2fs and lib/quota

Also use angle brackets for the #include of dirpaths.h to avoid the
need to manually massage the Makefile.in for the util directory.  This
is needed because we have to create a fake dirpaths.h file in the util
directory.  The fake dirpaths.h file is rquired to break the circular
dependency caused by util/subst creating dirpaths.h, while
util/subst.c is including config.h, which includes dirpaths.h.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoblkid: suppress Coverity warning
Theodore Ts'o [Thu, 30 Jan 2014 23:02:37 +0000 (18:02 -0500)]
blkid: suppress Coverity warning

The getopt() function will never let optarg be NULL (at least without
using the GNU double-colon extension, which we don't use because it's
not portable), so don't bother checking for that case.  It's harmless,
but it triggers a Coverity warning elsewhere, since it thinks optarg
could in fact be NULL.

Addresses-Coverity-Id: #1049156

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agolibss: fix potential buffer overrun in list_rqs
Theodore Ts'o [Thu, 30 Jan 2014 22:45:36 +0000 (17:45 -0500)]
libss: fix potential buffer overrun in list_rqs

Addresses-Coverity-Bug: #709516

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoquota: fix uninitiaized memory reference in mke2fs with quota enabled
Theodore Ts'o [Thu, 30 Jan 2014 22:10:46 +0000 (17:10 -0500)]
quota: fix uninitiaized memory reference in mke2fs with quota enabled

Initialize the on-disk structure before we fill it in, to avoid the
following valgrind warning:

   Conditional jump or move depends on uninitialised value(s)
      at 0x4323A8: qtree_entry_unused (quotaio_tree.c:40)
      by 0x431218: v2r1_mem2diskdqblk (quotaio_v2.c:85)
      by 0x432409: qtree_write_dquot (quotaio_tree.c:336)
      by 0x431136: v2_commit_dquot (quotaio_v2.c:264)
      by 0x42FB63: quota_write_inode (mkquota.c:126)
      by 0x408BE6: create_quota_inodes (mke2fs.c:2466)
      by 0x409A2D: main (mke2fs.c:2850)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoblkid: avoid potential integer overflow issues identified by Coverity
Theodore Ts'o [Thu, 30 Jan 2014 21:19:01 +0000 (16:19 -0500)]
blkid: avoid potential integer overflow issues identified by Coverity

Addresses-Coverity-Id: #1049157
Addresses-Coverity-Id: #1049158

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agomke2fs: add make_hugefile feature
Theodore Ts'o [Tue, 21 Jan 2014 04:06:07 +0000 (23:06 -0500)]
mke2fs: add make_hugefile feature

This feature is enabled via settings in /etc/mke2fs.conf.  For
example:

hugefile = {
features = extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize,^resize_inode,sparse_super2
inode_size = 128
num_backup_sb = 0
packed_meta_blocks = 1
make_hugefiles = 1
inode_ratio = 4194304
hugefiles_dir = /database
hugefiles_uid = 120
hugefiles_gid = 50
hugefiles_name = storage
hugefiles_digits = 4
hugefiles_size = 1G
num_hugefiles = 0
}

Then "mke2fs -T hugefile /dev/sdXX" will create as many 1G files
needed to fill the file system.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agoe2fsck, mke2fs: enable octal integers in the profile/config file
Theodore Ts'o [Tue, 21 Jan 2014 05:59:03 +0000 (00:59 -0500)]
e2fsck, mke2fs: enable octal integers in the profile/config file

If an integer in the config file starts with a 0, interpret it as an
octal number.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
10 years agomke2fs: allow metadata blocks to be at the beginning of the file system
Theodore Ts'o [Tue, 28 Jan 2014 19:44:23 +0000 (14:44 -0500)]
mke2fs: allow metadata blocks to be at the beginning of the file system

Add the extended options packed_meta_blocks and journal_location_front
which causes mke2fs to place the metadata blocks at the beginning of
the file system.

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