e2fsck: handle symlink properly with inline data

After fixing a bug on kernel side for handling symlink properly with
inline data, it will break the assumption in e2fsck because in original
patch set of inline data it doesn't support symlink with inline data
feature.  This commit makes e2fsck handle symlink properly with inline
data.

After applied this patch, the inline data feature has ability to store
the symlink.  We also need to add this ability for symlink commmand in
debugfs.

Cc: Ian Nartowicz <claws@nartowicz.co.uk>
Cc: Tao Ma <tm@tao.ma>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs: do not display fast symlink with inline data

After enabling symlink with inline data, stat command in debugfs will
think an inode is a fast symlink.  This patch fixes this issue.

Cc: Ian Nartowicz <claws@nartowicz.co.uk>
Cc: Tao Ma <tm@tao.ma>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
po: describe more precisely the %B expansion

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
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>
e2fsck: make two comments match the messages

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
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>
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>
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>
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>
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>
tests: clean up the temp file if test_one is interrupted

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
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>
debugfs: add support setting the error_count and associated sb fields

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
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>
aclocal.m4: update to newer versions of autoconf macros

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Update to latest version of config.* files

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