Whamcloud - gitweb
tools/e2fsprogs.git
10 years agoe2fsck: reopen the file system with saved flags after a journal replay
Theodore Ts'o [Sun, 6 Jul 2014 02:53:29 +0000 (22:53 -0400)]
e2fsck: reopen the file system with saved flags after a journal replay

After a journal replay, we close and reopen the file system so that
any changes in the superblock can get reflected in the libext2fs's
internal data structures.  We need to save the flags passed to
ext2fs_open() that we used when we originally opened the file system.

Otherwise we will end up not be able to repair a file system which
requires a journal replay and which has bigalloc enabled or which has
more than 2**32 blocks; e2fsck will abort with the error message:

fsck.ext4: Filesystem too large to use legacy bitmaps while trying to re-open

Addresses-Debian-Bug: 744953
Cc: Андрей Василишин <a.vasilishin@kpi.ua>
Cc: Jon Severinsson <jon@severinsson.net>
Cc: 744953@bugs.debian.org
10 years agomke2fs: prevent creation of unmountable ext4 with large flex_bg count
Akira Fujita [Sun, 6 Jul 2014 02:42:36 +0000 (22:42 -0400)]
mke2fs: prevent creation of unmountable ext4 with large flex_bg count

In mke2fs command, if flex_bg count is too large to filesystem blocks
count, unmountable ext4 which has the out of filesystem block offset
is created (Case1).  Moreover this large flex_bg count causes an
unintentional metadata layout (bmap-imap-itable-bmap-imap-itable .. in
block group) (Case2).

To fix these issues and keep healthy flex_bg layout, disallow creating
ext4 with obviously large flex_bg count to filesystem blocks count.

Steps to reproduce:
(Case1)
1.
    # mke2fs -t ext4 -b 4096 -O ^resize_inode -G $((2**20)) DEV 2130483

2.
    # mount -t ext4 DEV MP
    mount: wrong fs type, bad option, bad superblock on /dev/sdb4,
           missing codepage or helper program, or other error
           In some cases useful info is found in syslog - try
           dmesg | tail  or so

3.
    # dumpe2fs DEV
    ...
    Block count:              2130483
    ...
    Flex block group size:    1048576
    ...
    Group 65: (Blocks 2129920-2130482) [INODE_UNINIT]
      Checksum 0x4cb3, unused inodes 8080
      Block bitmap at 67 (bg #0 + 67), Inode bitmap at 1048643 (bg #32 + 67)
      Inode table at 2129979-2130483 (+59)
                             ^^^^^^^  2130483 is out of FS!
      65535 free blocks, 8080 free inodes, 0 directories, 8080 unused inodes
      Free blocks:
      Free inodes: 525201-533280

(Case2)
1.
    # mke2fs -t ext4 -G 2147483648 DEV 3145728

2.
    # debugfs -R stats DEV
    ...
    Block count:              786432
    ...
    Flex block group size:    2147483648
    ...
     Group  0: block bitmap at 193, inode bitmap at 194, inode table at 195
    ...
     Group  1: block bitmap at 707, inode bitmap at 708, inode table at 709
    ...
     Group  2: block bitmap at 1221, inode bitmap at 1222, inode table at 1223
    ...

Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
10 years agomke2fs: add get_uint_from_profile to mke2fs.c
Akira Fujita [Sun, 6 Jul 2014 02:34:07 +0000 (22:34 -0400)]
mke2fs: add get_uint_from_profile to mke2fs.c

We can set flex_bg count only up to 2^30 with profile
because get_int_from_profile can handle it to 2^31-1.
Add get_uint_from_profile to read unsigned int value
so that mke2fs with profile can handle up to 2^31 flex_bg same as -G option.

Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agomke2fs: set upper limit to flex_bg count
Akira Fujita [Sun, 6 Jul 2014 02:14:08 +0000 (22:14 -0400)]
mke2fs: set upper limit to flex_bg count

mke2fs -G option allows root user to set flex_bg count (power of 2).
However ext4 has bad metadata layout if we specify more than or equal to
2^32 to mke2fs -G, because of the 32bit shift operation
in ext2fs_allocate_group_table().

And the maximum block group count of ext4 is 2^32 -1 (ext4_group_t
s_groups_count), so diallow more than 2^32 flex_bg count.

Steps to reproduce:

   # mke2fs -t ext4 -G 4294967296 DEV

   # dumpe2fs DEV
   ...
   Flex block group size:    1          <----- flex_bg is 1!
   ...
   Group 0: (Blocks 0-32767)
     Checksum 0x4afd, unused inodes 7541
     Primary superblock at 0, Group descriptors at 1-1
     Reserved GDT blocks at 2-59
     Block bitmap at 60 (+60), Inode bitmap at 61 (+61)
     Inode table at 62-533 (+62)
     32228 free blocks, 7541 free inodes, 2 directories, 7541 unused inodes
     Free blocks: 540-32767
     Free inodes: 12-7552
   Group 1: (Blocks 32768-65535) [INODE_UNINIT]
     Checksum 0xc890, unused inodes 7552
     Backup superblock at 32768, Group descriptors at 32769-32769
     Reserved GDT blocks at 32770-32827
     Block bitmap at 32828 (+60), Inode bitmap at 32829 (+61)
     Inode table at 32830-33301 (+62)
     32234 free blocks, 7552 free inodes, 0 directories, 7552 unused inodes
     Free blocks: 33302-65535
     Free inodes: 7553-15104
   ...

Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: "Darrick J. Wong" <darrick.wong@oracle.com>
10 years agomke2fs: handle flex_bg collision with backup descriptors
Andreas Dilger [Fri, 28 Feb 2014 20:15:45 +0000 (13:15 -0700)]
mke2fs: handle flex_bg collision with backup descriptors

If a large flex_bg factor is specified and the block allocator was
laying out block or inode bitmaps or inode tables, and collides with
previously allocated metadata (for example the backup superblock or
group descriptors) it would reset the allocator back to the beginning
of the flex_bg instead of continuing past the obstruction.

For example, with "-G 131072" the inode table will hit the backup
descriptors in groups 1, 3, 5, 7, 9 and start interleaving with the
block and inode bitmaps.  That results in poorly allocated bitmaps
and inode tables that are interleaved and not contiguous as was
intended for flex_bg:

 Group 0: (Blocks 0-32767)
   Primary superblock at 0, Group descriptors at 1-2048
   Block bitmap 2049 (+2049), Inode bitmap at 133121 (bg #4+2049)
   Inode table 264193-264200 (bg #8+2049)
   :
   :
 Group 3838: (Blocks 125763584-125796351) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap 5887 (bg #0+5887), Inode bitmap 136959 (bg #4+5887)
   Inode table 294897-294904 (bg #8 + 32753)
 Group 3839: (Blocks 125796352-125829119) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap 5888 (bg #0+5888), Inode bitmap 136960 (bg #4+5888)
   Inode table 5889-5896 (bg #0 + 5889)
 Group 3840: (Blocks 125829120-125861887) [INODE_UNINIT, BLOCK_UNINIT]
   Block bitmap 5897 (bg #0+5897), Inode bitmap 136961 (bg #4+5889)
   Inode table 5898-5905 (bg #0 + 5898)
   :
   :

Instead, skip the intervening blocks if there aren't too many of them.
That mostly keeps the flex_bg allocations from colliding, though still
not perfect because there is still some overlap with the backups.
This patch addresses the majority of the problem, allowing about 124k
groups to be layed out perfectly, instead of less than 4k groups with
the previous code.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agomke2fs: enable lazy_itable_init on newer kernel by default
Lukas Czerner [Sun, 6 Jul 2014 01:08:34 +0000 (21:08 -0400)]
mke2fs: enable lazy_itable_init on newer kernel by default

Currently is used did not specified lazy_itable_init option we rely on
information from ext4 module exported via sysfs interface. However if
the ext4 module is not loaded it will not be enabled even though kernel
might support it.

With this commit we set the default according to the kernel version,
however we still allow it to be set manually via extended option or be
enabled in case that ext4 module advertise that it supports this
feature.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
10 years agomke2fs: add revision to the is_before_linux_ver()
Lukas Czerner [Sun, 6 Jul 2014 01:07:55 +0000 (21:07 -0400)]
mke2fs: add revision to the is_before_linux_ver()

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoe2fsprogs: introduce ext2fs_close_free() helper
Lukas Czerner [Sun, 6 Jul 2014 01:06:29 +0000 (21:06 -0400)]
e2fsprogs: introduce ext2fs_close_free() helper

Currently there are many uses of ext2fs_close() which might be wrong.
First of all ext2fs_close() does not set the ext2_filsys pointer to NULL
so the caller is responsible for clearing it, however there are some
cases there we do not do it.

Second of all very small number of users of ext2fs_close() actually
check the return value. If there is a problem in ext2fs_close() it will
not even free the ext2_filsys structure, but majority of users expect it
to do so.

To fix both problems this commit introduces a new helper
ext2fs_close_free() which will not only check for the return value and
free the ext2_filsys structure if the call to ext2fs_close2() failed,
but it will also set the ext2_filsys pointer to NULL.

Replace every use of ext2fs_close() in e2fsprogs tools with
ext2fs_close_free() - there is no real reason to keep using
ext2fs_close().

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
10 years agofix cross-compilation support
Theodore Ts'o [Sun, 6 Jul 2014 00:23:23 +0000 (20:23 -0400)]
fix cross-compilation support

Commit 2500ebfc89 (util: fix make dependencies for subst) broke cross
compilation because it unconditionally used config.h without setting a
includes path so that the config.h file could be found.

The proposed fix of adding the include path (such as was proposed at
http://patchwork.ozlabs.org/patch/355662/ or in Debian Bug #753375)
isn't really the right way to go, since the information in config.h is
for the target environment, and not the build environment.  So using
config.h when building helper programs used as part of the build can
potentially cause more problems than it solves.

In general, build helpers must be written to be as portable as
possible, and to not require any autoconf defined #ifdef's whenever
possible.  The subst program broke this rule to (1) address a Coverity
security complaint by using futimes(2) instad of utimes(2) if present,
and (2) to preserve the nanosecond portion of the file timestamp.

Oh, well.  We won't be able to do the latter when cross compiling, and
as to the former, if an attacker has write access to your build tree
while you are building programs that will be run as root, you've got
bigger problems.  :-)

Fix the problem that commit 2500ebfc89 was trying to address by
explicitly adding @DEFS@ to CFLAGS, so that -DHAVE_CONFIG_H is passed
to make depend.  This fixes up the make depend without forcing the use
of config.h when cross-compiling.

Addresses-Debian-Bug: #753375
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Tested-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Cc: Helmut Grohne <helmut@subdivi.de>
Cc: 753375@bugs.debian.org
10 years agoconfigure.in: fix external libblkid test for static link
Theodore Ts'o [Sat, 5 Jul 2014 04:27:02 +0000 (00:27 -0400)]
configure.in: fix external libblkid test for static link

External libblkid needs -luuid when linking statically.

Also fix up the bogus other-lib parameter in the libuuid test;
$LIBUUID is the null string, so it doesn't do anything other than
obfuscate the use of AC_CHECK_LIB.

Reported-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoblkid,ext2fs: avoid name clash with __u{8,16,32,64}
Andreas Dilger [Sat, 5 Jul 2014 03:34:10 +0000 (23:34 -0400)]
blkid,ext2fs: avoid name clash with __u{8,16,32,64}

Try to avoid name clashes with definitions of __u8, __u16, __u32,
and __u64 in userspace, in case other headers also define these
types.  Define HAVE___{S,U}{8,16,32,64} preprocessor macros to
show that these types are already defined.

This would avoid the need to check for _BLKID_TYPES_H in ext2_types.h
and _EXT2_TYPES_H in blkid_types.h, but since older versions of these
headers did not use HAVE___U8 et.al. keep these checks around for now.

Report an error if there are no 64-bit types available.  The code
will not compile if these are not available.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoblkid: remove unnecessary header and comment
Andreas Dilger [Wed, 11 Jun 2014 18:59:05 +0000 (12:59 -0600)]
blkid: remove unnecessary header and comment

The LIST_HEAD macro is not directly used in getsize.c, so
<sys/queue.h> is not needed at all, and could cause confusion at
some later point if the Linux-style list macros are ever used.

Build was verified on MacOS which defined HAVE_SYS_DISK_H true.
I manually inspected the sources for recent *BSD headers to check
if this was needed there or not.  MacOS and FreeBSD <sys/disk.h>
do not use lists at all.  NetBSD and OpenBSD <sys/disk.h> and all
of the <sys/mount.h> headers include <sys/queue.h> internally.

I used http://fxr.watson.org/fxr/source/sys/mount.h?v={OSTYPE}
as a reference, checking both old and new *BSD versions.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoe2fsprogs: add mount options to ext4.5
Eric Sandeen [Sat, 5 Jul 2014 03:07:36 +0000 (23:07 -0400)]
e2fsprogs: add mount options to ext4.5

This is a straight cut and paste from the util-linux
mount manpage to ext4.5 (with commented-out lines
removed).

It's pretty much impossible for util-linux to keep up
with every filesystem out there, and Karel has more than
once expressed a wish that mount options move into fs-specific
manpages.

So, here we go.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoe2fsprogs: revise and extend chattr(1) and chattr usage()
Eric Sandeen [Sat, 5 Jul 2014 03:03:14 +0000 (23:03 -0400)]
e2fsprogs: revise and extend chattr(1) and chattr usage()

The chattr(1) manpage and chattr usage() output were missing some flags.

Add those, and make some other minor cosmetic fixes.

(I've left out the 'B' (EXT2_COMPRBLK_FL) flag, because
it's not actually used anywhere, and I can't figure out
how it differs from 'c' (EXT2_COMPR_FL))

Also, because the matrix of filesystems & flags is quite large,
refer to filesystem-specific manpages for detailed discussion
of flags supported by those filesystems, rather than trying to
cover it all in this manpage.  I'll send those manpage
updates to the appropriate lists a bit later.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
10 years agoe2fsprogs: reorder flags in chattr(1)
Eric Sandeen [Sat, 5 Jul 2014 03:02:59 +0000 (23:02 -0400)]
e2fsprogs: reorder flags in chattr(1)

The flags described in chattr usage() and the chattr(1) manpage
were in semi-random order, which makes it hard to ascertain
which flags might be missing or undocumented, and to locate
flags within the manpage.

Re-order the list of flags in alphanumeric order, and do
the same for the flag descriptions in the body of the manpage.

There should be no content changes here, just reordering
for consistency.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
10 years agoe2fsck: fix last mount time and last write time in preen mode
Jan Kara [Fri, 4 Jul 2014 20:24:18 +0000 (16:24 -0400)]
e2fsck: fix last mount time and last write time in preen mode

Fixing last mount time and last write time is safe - there's no risk of
loosing any important information or making corruption significantly
worse even if we get it wrong. So let's just fix these times in preen
mode. This allows initrd to automatically check and mount root
filesystem in case system clock is wrong without having to manually set
broken_system_clock variable (openSUSE uses broken_system_clock by default
to avoid these problems during boot but this disables time-based checks
even on systems where clock is fine so that's not ideal either).

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agomke2fs: prevent creation of filesystem with unsupported revision
Frank Sorenson [Fri, 4 Jul 2014 19:31:50 +0000 (15:31 -0400)]
mke2fs: prevent creation of filesystem with unsupported revision

It's a bit strange to accept revision levels higher than
the code creating the filesystem can understand, so don't
allow it.

At least the kernel will mount the fs readonly if it's too
high, but no other utility will touch it, so you can't
fix the error.

Just reject anything > EXT2_MAX_SUPP_REV at mkfs time.

Signed-off-by: Frank Sorenson <fsorenso@redhat.com>
[sandeen@redhat.com: Add more verbose commit log]
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoe2fsprogs: remove checker infrastructure
Eric Sandeen [Thu, 17 Apr 2014 22:05:38 +0000 (17:05 -0500)]
e2fsprogs: remove checker infrastructure

Per http://www.gnu.org/software/checker/ the gcc "-checker" option
is long deprecated.  Nuke it from e2fsprogs.

Most people would never hit this, but people who love to turn knobs,
such as the reporter of kernel.org bz#74171, might run into it and be
sad.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoUpdate to latest version of config.* files
Theodore Ts'o [Fri, 4 Jul 2014 04:30:04 +0000 (00:30 -0400)]
Update to latest version of config.* files

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoaclocal.m4: update to newer versions of autoconf macros
Theodore Ts'o [Fri, 4 Jul 2014 03:44:13 +0000 (23:44 -0400)]
aclocal.m4: update to newer versions of autoconf macros

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agomove e2fsprogs-specific macros from aclocal.m4 to acinclude.m4
Ross Burton [Fri, 4 Jul 2014 03:19:38 +0000 (23:19 -0400)]
move e2fsprogs-specific macros from aclocal.m4 to acinclude.m4

Autoconf says that aclocal.m4 is a machine-generated copy of
system-wide macros, whereas acinclude.m4 is for project-specific
macros.  Reflect this division and ease building by anyone who needs
to re-generate the autotooling by splitting AX_TLS and CHECK_GNU_MAKE
to acinclude.m4.

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agodebugfs: add support setting the error_count and associated sb fields
Theodore Ts'o [Fri, 4 Jul 2014 02:28:24 +0000 (22:28 -0400)]
debugfs: add support setting the error_count and associated sb fields

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agotests: avoid using mktemp -t
Theodore Ts'o [Fri, 4 Jul 2014 02:16:48 +0000 (22:16 -0400)]
tests: avoid using mktemp -t

The -t option is documented as deprecated in GNU's mktemp, and
FreeBSD's mktemp doesn't support it at all.

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

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agotests: clean up the temp file if test_one is interrupted
Theodore Ts'o [Mon, 9 Jun 2014 14:47:41 +0000 (10:47 -0400)]
tests: clean up the temp file if test_one is interrupted

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agotests: fix left-over e2fsprogs-tmp files not getting clean up
Theodore Ts'o [Mon, 9 Jun 2014 14:34:17 +0000 (10:34 -0400)]
tests: fix left-over e2fsprogs-tmp files not getting clean up

In addition, incorporate the test name into the e2fsprogs-tmp to make
it easier to debug left-over temp files in the future.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agotests: for mktemp the exes must be the final characters of the name
Benno Schulenberg [Mon, 9 Jun 2014 14:17:39 +0000 (10:17 -0400)]
tests: for mktemp the exes must be the final characters of the name

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agomisc: quiet minor build warnings, ignore generated files
Andreas Dilger [Mon, 9 Jun 2014 13:53:40 +0000 (09:53 -0400)]
misc: quiet minor build warnings, ignore generated files

Quiet a couple of build warnings in tst_libext2fs.c
Add missing unistd.h header for misc/util.c.

Ignore generated files for lib/ext2fs/tst_libext2fs and intl/ files.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoresize2fs: don't attempt to calculate minimum size on fs with errors
Eric Sandeen [Mon, 9 Jun 2014 13:52:19 +0000 (09:52 -0400)]
resize2fs: don't attempt to calculate minimum size on fs with errors

My old patch:

resize2fs: don't print minimum size if fs is not clean

almost did this, but it still calculated the size; it just didn't print
it.  Which is a bit silly.

Jes had a pretty badly corrupted image which made the minimum size
calculation go off into the weeds.  It was corrupted, and also marked
as having an error.

We'll eventually bail out for an unmounted filesystem if it's marked
as being in an error state anyway; just move that test & bail-out
to a much earlier point, and remove the now-duplicate one under the
print_min_size block.

This will catch & block all resize operations on an offline filesystem
with errors, in one central place.

Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoe2fsck: sort the abbreviations better
Benno Schulenberg [Wed, 4 Jun 2014 01:59:31 +0000 (21:59 -0400)]
e2fsck: sort the abbreviations better

This makes it easier for translators to look up what they've done.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoe2fsck: make two comments match the messages
Benno Schulenberg [Wed, 4 Jun 2014 01:59:31 +0000 (21:59 -0400)]
e2fsck: make two comments match the messages

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agoe2fsck: make a prompt message simpler and thus translatable
Benno Schulenberg [Wed, 4 Jun 2014 01:59:31 +0000 (21:59 -0400)]
e2fsck: make a prompt message simpler and thus translatable

It can be made simpler because there is no need to differentiate between
having an internal journal inode and having an external journal device.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agopo: describe more precisely the %B expansion
Benno Schulenberg [Wed, 4 Jun 2014 01:59:31 +0000 (21:59 -0400)]
po: describe more precisely the %B expansion

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 years agofilefrag: fix issues with 29758d2
Eric Sandeen [Mon, 2 Jun 2014 01:27:41 +0000 (21:27 -0400)]
filefrag: fix issues with 29758d2

29758d2 filefrag: exit with error code if an error is hit

introduced a couple errors; in one case it missed returning
a value, and possibly picked up errno from (unchecked) close(),
and in the other used a test where it needed an
assignment.  So capture the error, move perror() directly
after the failed call in both cases, and fix the assignment.

Also fix a precedence problem with:

if (fe_flags & mask == 0)

which is equivalent to:

if (fe_flags & (mask == 0))

but we need:

if ((fe_flags & mask) == 0)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
10 years agopo: add %It to the list of recognized expansions
Benno Schulenberg [Sun, 1 Jun 2014 21:29:50 +0000 (23:29 +0200)]
po: add %It to the list of recognized expansions

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
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>