Whamcloud - gitweb
tools/e2fsprogs.git
8 years agomisc: avoid PATH_MAX dependency in create_inode.c
Theodore Ts'o [Wed, 11 May 2016 04:08:58 +0000 (00:08 -0400)]
misc: avoid PATH_MAX dependency in create_inode.c

Addresses-Debian-Bug: #822576

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibext2s: only define FS_IOC_FIEMAP on Linux systems
Theodore Ts'o [Wed, 11 May 2016 03:44:21 +0000 (23:44 -0400)]
libext2s: only define FS_IOC_FIEMAP on Linux systems

Hurd and *BSD is not going to have FS_IOC_FIEMAP, at least not at
Linux's codepoint.

Addresses-Debian-Bug: #822576

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agodebian: disable fus2fs for Hurd
Theodore Ts'o [Wed, 11 May 2016 03:41:38 +0000 (23:41 -0400)]
debian: disable fus2fs for Hurd

Hurd's libfuse is not compatible with the Linux version of libfuse.

Addresses-Debian-Bug: #822576

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agodebian: update initramfs in e2fsprogs's postinst script
Theodore Ts'o [Wed, 11 May 2016 03:27:04 +0000 (23:27 -0400)]
debian: update initramfs in e2fsprogs's postinst script

Addresses-Debian-Bug: #804237

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoMore man page and usage message fixups
Theodore Ts'o [Wed, 11 May 2016 03:23:14 +0000 (23:23 -0400)]
More man page and usage message fixups

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoresize2fs, libext2fs: fix bugs in sparse_super2 support
Theodore Ts'o [Wed, 11 May 2016 01:06:15 +0000 (21:06 -0400)]
resize2fs, libext2fs: fix bugs in sparse_super2 support

Fix resize2fs so that the location of the backup superblocks when the
sparse_super2 feature is enabled is properly set when growing the file
system from a single block group to larger file system sizes.

Also fix a bug where the block group summary statistics in some cases
when exapnding a sparse_super2 file system.

Finally, accurately calculate the file system metadata overhead of the
last block group in sparse_super2 file systems.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agomke2fs: support multiple -O options
Theodore Ts'o [Tue, 10 May 2016 21:41:08 +0000 (17:41 -0400)]
mke2fs: support multiple -O options

Some users will get confused and try to specify multiple -O options.
So teach mke2fs to treat "-O feature1 -O feature2" as
"-O feature1,feature2".

https://bugzilla.kernel.org/show_bug.cgi?id=117421

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoutil: remove lib/support from the e2fsprogs-libs tar distribution
Theodore Ts'o [Tue, 10 May 2016 20:18:44 +0000 (16:18 -0400)]
util: remove lib/support from the e2fsprogs-libs tar distribution

The lib/support library is only used for internal e2fsprogs programs,
and it won't compile correctly due to the fact that lib/ext2fs isn't
included in the e2fsprogs-libs distribution anyway.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoFix various man pages and usage message
Theodore Ts'o [Mon, 9 May 2016 02:12:41 +0000 (22:12 -0400)]
Fix various man pages and usage message

Thanks to pete@lyptonyx for doing a close pass editing of e2fsprogs's
man pages.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibe2p: change the long flag name for -P to be Project_Hierarchy
Theodore Ts'o [Mon, 9 May 2016 02:11:36 +0000 (22:11 -0400)]
libe2p: change the long flag name for -P to be Project_Hierarchy

This more clearly describes what the flag means.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agomke2fs: fix the parsing used for -E quotatype=usrquota:grpquota:prjquota
Theodore Ts'o [Mon, 9 May 2016 01:11:18 +0000 (21:11 -0400)]
mke2fs: fix the parsing used for -E quotatype=usrquota:grpquota:prjquota

Commit 2d2d799c7261 tried to use parse_quota_options(), which uses
commas to separate out the quota types.  Unfortunately, when parsing
extended options, commands are used to separate different extended
options.

To fix this, I've add a new support function parse_quota_type(), which
allows either commas or colons to used as a separator character, and
which manipulates a bit field to indicate which quota types should be
enabled.  Eventually tune2fs should be converted to use
parse_quota_type() as well, thus obsoleting parse_quota_options(), but
that's a more complicated cleanup patch for later.

Fix a lint warning which could the number of blocks to be incorretly
printed if it exceeds 2**32.

Also fix some typos and other minor bugs in the usage message.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoe4crypt: remove debugging code which broke the set_policy subcommand
Theodore Ts'o [Sat, 7 May 2016 03:38:33 +0000 (23:38 -0400)]
e4crypt: remove debugging code which broke the set_policy subcommand

Also fixed some spelling typos in help messages.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agomke2fs: adjust the default file system size by the offset
Theodore Ts'o [Sun, 1 May 2016 04:57:19 +0000 (00:57 -0400)]
mke2fs: adjust the default file system size by the offset

If the user specifies an offset using -E offset without specifying an
explicit size, the system will use the block device (or file) size as
the default file system size.  If we are using the default file system
size, subtract out the offset so the resulting file system will stay
within the block device.  Also print a warning that this might not be
what the user wants.

Addresses-Debian-Bug: #803629

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoUse texi2dvi --clean to work around a bug in texi2dvi
Theodore Ts'o [Sun, 1 May 2016 02:19:59 +0000 (22:19 -0400)]
Use texi2dvi --clean to work around a bug in texi2dvi

If the sources for e2fsprogs are located in a pathname that contains a
tilde character (which can happen when the sources are unpacked using
"apt-get source" when e2fsprogs has a pre-release test version),
texi2dvi will fail due to a bug (Debian bug #822492: "texinfo:
texi2dvi doesn't protect the ~ character in the second pass").  Work
around this bug by using texi2dvi --clean.

Addresses-Debian-Bug: #822227

Reported-by: svante.signell@gmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agomke2fs.8, badblocks.8: fix spelling errors and other miscellaneous typos
Theodore Ts'o [Thu, 28 Apr 2016 23:54:34 +0000 (19:54 -0400)]
mke2fs.8, badblocks.8: fix spelling errors and other miscellaneous typos

Reported-by: Pete <pete@leptonyx.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agofuse2fs: delete unused variables
Darrick J. Wong [Tue, 19 Apr 2016 19:21:00 +0000 (12:21 -0700)]
fuse2fs: delete unused variables

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agotests: rename e2image related tests
Theodore Ts'o [Mon, 25 Apr 2016 15:58:47 +0000 (11:58 -0400)]
tests: rename e2image related tests

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoe2image: ignore checksum errors
Darrick J. Wong [Tue, 19 Apr 2016 19:20:30 +0000 (12:20 -0700)]
e2image: ignore checksum errors

Since e2image is used to capture broken fs images for debugging,
ignore checksum errors when creating the image.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoe2fsck: clean up error messages when journal is corrupted
Theodore Ts'o [Sun, 17 Apr 2016 04:44:06 +0000 (00:44 -0400)]
e2fsck: clean up error messages when journal is corrupted

Update the tests to match with the new behavior and error messages

Also fix test_one so that it doesn't print the failed test output in
the case where the script does not exist.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoFix build failure if --config-jbd-debug isn't enabled
Theodore Ts'o [Sun, 17 Apr 2016 04:23:48 +0000 (00:23 -0400)]
Fix build failure if --config-jbd-debug isn't enabled

This fixes a bug that was introduced recently in commit 1fc23b5e77.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoe2fsck: don't abort if the journal is corrupted due to checksum errors
Theodore Ts'o [Sat, 16 Apr 2016 01:09:24 +0000 (21:09 -0400)]
e2fsck: don't abort if the journal is corrupted due to checksum errors

If e2fsck_run_ext3_journal() returns an error indicating that a CRC
error was detected, we shouldn't abort, but instead proceed so the
file system can be fixed.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoe2fsck: don't try to set a UUID on metadata_csum file systems
Theodore Ts'o [Sat, 16 Apr 2016 00:51:36 +0000 (20:51 -0400)]
e2fsck: don't try to set a UUID on metadata_csum file systems

If the UUID field is NULL, e2fsck will try to generate and set a new
UUID.  This will cause massive problems if the metadata_csum feature
is set, so avoid doing so in that case.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoe2fsck: use specific CRC and corruption errors in journal recovery
Theodore Ts'o [Fri, 15 Apr 2016 23:35:02 +0000 (19:35 -0400)]
e2fsck: use specific CRC and corruption errors in journal recovery

Sync up with kernel commit 6a797d27: "ext4: call out CRC and
corruption errors with specific error codes".

This allows us to distinguish between CRC errors and I/O errors.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoFix support for configure --enable-jbd-debug
Theodore Ts'o [Fri, 15 Apr 2016 23:01:38 +0000 (19:01 -0400)]
Fix support for configure --enable-jbd-debug

We haven't used this in a while, so it's bitrotted a bit.  Fix it up
so that it works correctly.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoMerge branch 'maint' into next
Theodore Ts'o [Fri, 15 Apr 2016 15:33:30 +0000 (11:33 -0400)]
Merge branch 'maint' into next

8 years agoe2image: don't leak progress info to stdout
Eric Sandeen [Fri, 15 Apr 2016 03:20:46 +0000 (22:20 -0500)]
e2image: don't leak progress info to stdout

Commit c8ee0d60 fixed most of these, but missed this one.

# e2image -r -p <device> - > imagefile

leads to a corrupted image due to the "Scanning inodes..."
printf going to stdout.

Reported-by: Alex Markley <alex@malexmedia.net>
Addresses-Red-Hat-Bugzilla: #1327329
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoe2fsck: Print "REBOOT SYSTEM" instead of "REBOOT LINUX"
Theodore Ts'o [Sun, 27 Mar 2016 03:23:43 +0000 (23:23 -0400)]
e2fsck: Print "REBOOT SYSTEM" instead of "REBOOT LINUX"

As a nod to people building e2fsprogs for FreeBSD or Hurd.

Addresses-Debian-Bug: #769838

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoFix missing prototype warnings caused by missing header files
Theodore Ts'o [Sun, 27 Mar 2016 03:18:34 +0000 (23:18 -0400)]
Fix missing prototype warnings caused by missing header files

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agomke2fs: fix for the "-E offset=N" option
Marcus Huewe [Sun, 27 Mar 2016 02:26:40 +0000 (22:26 -0400)]
mke2fs: fix for the "-E offset=N" option

Configure the io channel with the specified offset before
calling mke2fs_discard_device(). Otherwise the data before offset
is discarded.

Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibext2fs: fix offset support in unix_io.c
Marcus Huewe [Sun, 27 Mar 2016 02:26:02 +0000 (22:26 -0400)]
libext2fs: fix offset support in unix_io.c

Added offset support to the following functions:
- unix_cache_readahead
- unix_discard
- unix_zeroout

Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agotests: add testcase for "mke2fs -E offset=N..."
Marcus Huewe [Sun, 27 Mar 2016 02:24:51 +0000 (22:24 -0400)]
tests: add testcase for "mke2fs -E offset=N..."

Test that mke2fs does not modify any data before the offset and
after the end of the filesystem.

Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoblkid: fix blkid time diff bug
Jeff Sharkey [Wed, 16 Oct 2013 22:42:12 +0000 (15:42 -0700)]
blkid: fix blkid time diff bug

When calculating time diffs, use difftime() instead of risking
integer overflow.  Also build a "blkid" binary.

Addresses-Google-Bug: #11175082
Change-Id: I23521f45204574bb32f152926401c2cbad93175b

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agollseek: setup the correct seek for ext2fs_llseek
JP Abgrall [Fri, 25 Mar 2016 16:00:07 +0000 (12:00 -0400)]
llseek: setup the correct seek for ext2fs_llseek

After
  http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/commit/lib/ext2fs/llseek.c?id=274d46e1d35af423d0292d63c4d0ad7a03be82ba

with
  __linux__
  defined(HAVE_LSEEK64) && defined(HAVE_LSEEK64_PROTOTYPE)
  SIZEOF_OFF_T >= SIZEOF_LONG_LONG
it leads to ext2fs_llseek() doing a "return lseek(fd, offset, origin);"
Which  fails for offsets > 32bit.

Also, with
  __linux__
  !(defined(HAVE_LSEEK64) && defined(HAVE_LSEEK64_PROTOTYPE))
  defined(HAVE_LLSEEK)
  SIZEOF_OFF_T == SIZEOF_LONG_LONG
my_llseek is not defined at all. And there is no need to define
llseek as lseek, as llseek is never used.
Luckily ext2fs_llseek() then does "return lseek(...);"
It would seem that my_llseek should be used in both places.

Addresses-Google-Bug: #13340735
Change-Id: Ie7330300c9c1ca103eaaef97536dcf10adbbba02
Signed-off-by: JP Abgrall <jpa@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoMerge branch 'maint' into next
Theodore Ts'o [Tue, 22 Mar 2016 04:03:09 +0000 (00:03 -0400)]
Merge branch 'maint' into next

8 years agotests: fix Makefile so it is portable to gmake 3.x
Theodore Ts'o [Tue, 22 Mar 2016 04:01:19 +0000 (00:01 -0400)]
tests: fix Makefile so it is portable to gmake 3.x

In commit 0355d6d047884f5b we used a Makefile shell assignment syntax
which is compatible with pmake and gmake 4.x, but which breaks on
gmake 3.x.  So only use the pmake-compatible construction if we are
not using GNU make.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoFix FreeBSD portability problems
Theodore Ts'o [Tue, 22 Mar 2016 03:43:41 +0000 (23:43 -0400)]
Fix FreeBSD portability problems

FreeBSD doesn't have libintl support built into the libc, and
libsupport requires libintl support.  So we need to make sure it is
available when we link against the libsupport library.

Also, work around *BSD's interesting interpretation of how
_XOPEN_SOURCE is supposed to work.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoMerge branch 'maint' into next
Theodore Ts'o [Mon, 21 Mar 2016 17:21:03 +0000 (13:21 -0400)]
Merge branch 'maint' into next

8 years agolibext2fs: make sure ismounted.c explicitly pulls in <sys/types.h>
Theodore Ts'o [Mon, 21 Mar 2016 17:09:54 +0000 (13:09 -0400)]
libext2fs: make sure ismounted.c explicitly pulls in <sys/types.h>

The major() cpp macro is defined as requiring sys/types.h to be
included with _BSD_SOURCE defined.  However, in older glibc's this
hasn't been strictly required and the stdlib.h header file included
sys/types.h implicitly.  Fix this so that more aggressive
distributions run into build errors.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
in with andchanges. Lines starting

8 years agoFix warnings caused by glibc 2.20
Theodore Ts'o [Mon, 21 Mar 2016 17:01:27 +0000 (13:01 -0400)]
Fix warnings caused by glibc 2.20

Glibc has depcreated _SVID_SOURCE and _BSD_SOURCE in favor of
_DEFAULT_SOURCE.  So define _DEFAULT_SOURCE to shut up glibc 2.20

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibsupport: fix potential resource leaks in the profile code
Theodore Ts'o [Fri, 18 Mar 2016 21:14:15 +0000 (17:14 -0400)]
libsupport: fix potential resource leaks in the profile code

These were found by Coverity.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agochattr: fix verbose message while setting the project id
Theodore Ts'o [Fri, 18 Mar 2016 20:49:51 +0000 (16:49 -0400)]
chattr: fix verbose message while setting the project id

This was caused by a cut and paste error.  (Thanks to Coverity for
pointing this out).

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoutil: add get-var script
Theodore Ts'o [Fri, 18 Mar 2016 20:29:19 +0000 (16:29 -0400)]
util: add get-var script

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoAndroid.mk: add missing source files from lib/e2p/Android.mk
Theodore Ts'o [Fri, 18 Mar 2016 20:24:53 +0000 (16:24 -0400)]
Android.mk: add missing source files from lib/e2p/Android.mk

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibsupport: fix function prototype for parse_quota_opts
Theodore Ts'o [Fri, 18 Mar 2016 20:11:53 +0000 (16:11 -0400)]
libsupport: fix function prototype for parse_quota_opts

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agotune2fs: don't include journal recovery when building for Android
Theodore Ts'o [Fri, 18 Mar 2016 20:07:34 +0000 (16:07 -0400)]
tune2fs: don't include journal recovery when building for Android

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoAndroid.mk: fix up the library -host naming convention change
Theodore Ts'o [Fri, 18 Mar 2016 19:24:39 +0000 (15:24 -0400)]
Android.mk: fix up the library -host naming convention change

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agofuse2fs.1: add manual page for fuse2fs
Theodore Ts'o [Fri, 18 Mar 2016 19:23:35 +0000 (15:23 -0400)]
fuse2fs.1: add manual page for fuse2fs

Also add libfuse-dev to the Debian build depends so that fuse2fs gets
built for Debian.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoFix various clang and gcc -Wall warnings
Theodore Ts'o [Fri, 18 Mar 2016 16:45:19 +0000 (12:45 -0400)]
Fix various clang and gcc -Wall warnings

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibext2fs: fix build failure in lib/ext2fs/swapfs on big-endian systems
Theodore Ts'o [Fri, 18 Mar 2016 02:39:10 +0000 (22:39 -0400)]
libext2fs: fix build failure in lib/ext2fs/swapfs on big-endian systems

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoUpdate lib/ext2fs/Makefile.in using "make depend" v1.43-WIP-2016-03-15
Theodore Ts'o [Tue, 15 Mar 2016 05:50:40 +0000 (01:50 -0400)]
Update lib/ext2fs/Makefile.in using "make depend"

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoUpdate translation template file
Theodore Ts'o [Tue, 15 Mar 2016 05:49:00 +0000 (01:49 -0400)]
Update translation template file

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoUpdate release notes for a 1.43-WIP release (14-Mar-2016)
Theodore Ts'o [Tue, 15 Mar 2016 05:37:28 +0000 (01:37 -0400)]
Update release notes for a 1.43-WIP release (14-Mar-2016)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agodebian: update debian policy conformance to 3.9.7
Theodore Ts'o [Tue, 15 Mar 2016 05:30:55 +0000 (01:30 -0400)]
debian: update debian policy conformance to 3.9.7

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoAndroid.mk: Replace _host suffix with more standard -host suffix
Alex Deymo [Thu, 10 Dec 2015 02:15:25 +0000 (18:15 -0800)]
Android.mk: Replace _host suffix with more standard -host suffix

Most libraries use the "-host" suffix when building for the host. This
patch renames all the libraries to use -host instead of _host.

Addresses-Google-Bug: #24619596
TEST=make dist

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoconfigure.ac: fix up Debian naming scheme for its orig.tar.gz file
Theodore Ts'o [Tue, 15 Mar 2016 05:10:29 +0000 (01:10 -0400)]
configure.ac: fix up Debian naming scheme for its orig.tar.gz file

We are using a new convention for the 1.43-WIP releases which should
be less confusion by replacing the hyphens by periods (e.g.,
1.43~WIP.2016.03.06 instead of 1.43~WIP-2016-03-06).  This avoids
confusion regarding the debian release number (which uses the last
hyphen in the version string to separate the upstream version from the
release number).

Also fix a typo in the version number used in the debian changelog and
e2fslibs.symbols file.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agogen-android-files: create the MODULE_LICENSE_GPL and README.version files
Damien Miller [Mon, 14 Mar 2016 23:07:26 +0000 (19:07 -0400)]
gen-android-files: create the MODULE_LICENSE_GPL and README.version files

These package version metadata files will be used for automated
notification of external vulnerability reports in Android.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibuuid: Silence warnings in lib/uuid when building on Android
James Hawkins [Mon, 22 Feb 2016 23:29:58 +0000 (15:29 -0800)]
libuuid: Silence warnings in lib/uuid when building on Android

-Wno-unused-function
-Wno-unused-parameter

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoAndroid.mk: export uuid/uuid.h
Mark Salyzyn [Mon, 14 Mar 2016 22:41:38 +0000 (18:41 -0400)]
Android.mk: export uuid/uuid.h

Addresses-Google-Bug: #23181629
Addresses-Google-Bug: #24133481

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibext2fs: export the library include path
Alex Deymo [Thu, 3 Sep 2015 02:07:46 +0000 (19:07 -0700)]
libext2fs: export the library include path

When adding 'libext2fs' as a library dependency from any other binary,
the binary needs to find the library headers. Users of this library
should not hard-code the include path themselves. This patch exports the
library headers on all three version of the libext2fs library and
removes the redundant include path from executables in e2fsprogs.

Addresses-Google-Bug: #23084776
TEST=mma

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoblkid: add support to recognize f2fs to blkid
Jeff Sharkey [Mon, 14 Mar 2016 20:48:13 +0000 (16:48 -0400)]
blkid: add support to recognize f2fs to blkid

We can now identify f2fs filesystems and extract the UUID.

Addresses-Google-Bug: #20275581

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoCleanup Obsolete LOCAL_PRELINK_MODULE
Ying Wang [Tue, 16 Dec 2014 20:31:57 +0000 (12:31 -0800)]
Cleanup Obsolete LOCAL_PRELINK_MODULE

Addresses-Google-Bug: #18675947

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoWrap tune2fs.h to be C++ compatible
Tao Bao [Mon, 14 Mar 2016 20:35:54 +0000 (16:35 -0400)]
Wrap tune2fs.h to be C++ compatible

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoRename COPYING to NOTICE and add MODULE_LICENSE_GPL file
Theodore Ts'o [Mon, 14 Mar 2016 18:50:37 +0000 (14:50 -0400)]
Rename COPYING to NOTICE and add MODULE_LICENSE_GPL file

The NOTICE and MODULE_LICENSE_GPL files is the convention used by
Android's Open Source Project.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoe2fsck: correct ext4 dates generated by old kernels
David Turner [Mon, 14 Mar 2016 17:57:33 +0000 (13:57 -0400)]
e2fsck: correct ext4 dates generated by old kernels

Older kernels on 64-bit machines would incorrectly encode pre-1970
ext4 dates as post-2311 dates.  Detect and correct this (assuming the
current date is before 2242).

Include tests for this, as well as changes to debugfs to correctly
set crtimes.

Signed-off-by: David Turner <novalis@novalis.org>
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agodebugfs: fix a bug in string_to_time() which misparsed @NNNNNNN inputs
Theodore Ts'o [Mon, 14 Mar 2016 17:54:41 +0000 (13:54 -0400)]
debugfs: fix a bug in string_to_time() which misparsed @NNNNNNN inputs

Thanks to David Turner <novalis@novalis.org> for reporting this bug.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoUpdate release notes and debian changelog
Theodore Ts'o [Mon, 14 Mar 2016 16:50:45 +0000 (12:50 -0400)]
Update release notes and debian changelog

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agofuse2fs: improve command-line parsing
Theodore Ts'o [Sat, 12 Mar 2016 07:06:14 +0000 (02:06 -0500)]
fuse2fs: improve command-line parsing

Use libfuse's command line parsing, which is much more powerful and
flexible than what we had before, and to allow the user to have more
fine-grained control over FUSE's run-time options.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoe2fsck: fix problem report typo
Eric Whitney [Mon, 7 Mar 2016 02:52:16 +0000 (21:52 -0500)]
e2fsck: fix problem report typo

Remove the stray left parenthesis.  Observed while testing bigalloc_1k
filesystems with shared/298 on 32 bit ARM running 4.3 kernels.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
8 years agoresize2fs: clear uninit BG if allocating from new group
Eric Sandeen [Mon, 7 Mar 2016 02:51:23 +0000 (21:51 -0500)]
resize2fs: clear uninit BG if allocating from new group

If resize2fs_get_alloc_block() allocates from a BLOCK_UNINIT group, we
need to make sure that the UNINIT flag is cleared on both file system
structures which are maintained by resize2fs.  This causes the
modified bitmaps to not get written out, which leads to post-resize2fs
e2fsck errors; used blocks in UNINIT groups, not marked in the block
bitmap.  This was seen on r_ext4_small_bg.

This patch uses clear_block_uninit() to clear the flag,
and my problem goes away.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agotests: fix missing cleanup of temporary files
Theodore Ts'o [Mon, 7 Mar 2016 02:44:43 +0000 (21:44 -0500)]
tests: fix missing cleanup of temporary files

A number of tests weren't properly cleaning their temp files.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoMerge branch 'maint' into next
Theodore Ts'o [Mon, 7 Mar 2016 02:30:07 +0000 (21:30 -0500)]
Merge branch 'maint' into next

8 years agomisc: replace comparison macros with inline functions
Andreas Dilger [Mon, 7 Mar 2016 02:23:40 +0000 (21:23 -0500)]
misc: replace comparison macros with inline functions

Replace the EXT2FS_RB_EMPTY_ROOT(), EXT2FS_RB_EMPTY_NODE(),
EXT2FS_RB_CLEAR_NODE(), IS_BLOCK_BM(), IS_INODE_BM(), and
IS_INODE_TB() macros with static inline functions to avoid
suprious compiler warnings with clang:

pass1.c:618:28: warning: equality comparison with extraneous
parentheses [-Wparentheses-equality]
if ((*((__u32 *)(entry)) == 0UL)) {
             ~~~~~~~~~~~~~~~~~~~~^~~~~~
pass1.c:618:28: note: remove extraneous parentheses
around the comparison to silence this warning
if ((*((__u32 *)(entry)) == 0UL)) {
 ^~
pass1.c:618:28: note: use '=' to turn this equality
comparison into an assignment
if ((*((__u32 *)(entry)) == 0UL)) {
 ^~
 =

The static inline functions should compile identically, and allow
some extra compile-time checking for the arguments over macros.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agotests: cleanup tmpfile for the f_extent_htree
Theodore Ts'o [Mon, 7 Mar 2016 02:22:13 +0000 (21:22 -0500)]
tests: cleanup tmpfile for the f_extent_htree

The interim hack to allow this test to work for the maint branch ends
up leaving the tmpfile around.  Clean this up.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoMerge branch 'maint' into next
Theodore Ts'o [Mon, 7 Mar 2016 01:37:49 +0000 (20:37 -0500)]
Merge branch 'maint' into next

8 years agotune2fs: recover the journal
Darrick J. Wong [Sat, 13 Feb 2016 22:38:17 +0000 (14:38 -0800)]
tune2fs: recover the journal

If the journal needs to be recovered to avoid clobbering whatever
changes tune2fs makes, do so.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agotune2fs: confirm dangerous operations
Darrick J. Wong [Sat, 13 Feb 2016 22:38:11 +0000 (14:38 -0800)]
tune2fs: confirm dangerous operations

Give admins a short amount of time to confirm that they want to
proceed with a dangerous operation.  Refuse to perform the op
unless the filesystem is freshly checked.

Cc: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibext2fs: sort keys for xattr blocks
Darrick J. Wong [Sun, 6 Mar 2016 02:42:17 +0000 (21:42 -0500)]
libext2fs: sort keys for xattr blocks

Richard Purdie reports that libext2fs doesn't sort attribute keys in
the xattr block correctly, causing the kernel to return -ENODATA when
querying attributes that should be there.  Therefore, sort attributes
so that whatever ends up in the xattr block is sorted according to
what the kernel expects.

Cc: Darren Hart <dvhart@linux.intel.com>
Reported-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Tested-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agofilefrag: accommodate holes when calculating expected values
Darrick J. Wong [Sun, 6 Mar 2016 01:01:35 +0000 (20:01 -0500)]
filefrag: accommodate holes when calculating expected values

Currently, filefrag's "expected physical block" column expects extent
records to be physically adjacent regardless of the amount of logical
block space between the two records.  This means that if we punch a
hole in a file, we get reports like this:

ext:   logical_offset:   physical_offset: length:  expected: flags:
4:     4096..    8343:   57376..  61623:   4248:
5:     8345..   10313:   61625..  63593:   1969:   61624:

Notice how it expects 8345 to map to 61624, and scores this against
the fragmentation of the file.  Flagging this as "unexpected" is
incorrect because the gap in the logical mapping is exactly the same
size as the gap in the physical extents.

Furthermore, this particular mapping leaves the door open to the
optimal mapping -- if a write to block 8344 causes it to be mapped to
61624, the entire range 4096-10313 can be mapped with a single extent.
Until that happens, there's no way to combine extents 4 and 5 because
of the gap in the logical mapping at block 8344.

Therefore, tweak the extent report to account for holes.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agotests: check proper operation of metadata_csum_seed
Darrick J. Wong [Sat, 5 Mar 2016 19:01:11 +0000 (14:01 -0500)]
tests: check proper operation of metadata_csum_seed

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agomke2fs: store checksum seed at format time
Darrick J. Wong [Sat, 5 Mar 2016 17:53:29 +0000 (12:53 -0500)]
mke2fs: store checksum seed at format time

Allow users to turn on metadata_csum_seed at format time so that UUIDs
can be live-changed at any time.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoe2fsck: check the checksum seed feature flag is set correctly
Darrick J. Wong [Sat, 5 Mar 2016 17:52:55 +0000 (12:52 -0500)]
e2fsck: check the checksum seed feature flag is set correctly

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agotune2fs: allow user to turn on saving the checksum seed
Darrick J. Wong [Sat, 5 Mar 2016 17:38:52 +0000 (12:38 -0500)]
tune2fs: allow user to turn on saving the checksum seed

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibext2fs: store checksum seed in superblock
Darrick J. Wong [Sat, 13 Feb 2016 22:37:32 +0000 (14:37 -0800)]
libext2fs: store checksum seed in superblock

Allow the filesystem to store the metadata checksum seed in the
superblock and add an incompat feature to say that we're using it.
This enables tune2fs to change the UUID on a mounted metadata_csum
FS without having to (racy!) rewrite all disk metadata.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agodebugfs: add support for the project id field
Theodore Ts'o [Sat, 5 Mar 2016 17:00:41 +0000 (12:00 -0500)]
debugfs: add support for the project id field

Teach the stat and set_inode_field commands to support the project ID
field.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolibe2p: add missing f[gs]etproject.c files
Theodore Ts'o [Sat, 5 Mar 2016 16:05:18 +0000 (11:05 -0500)]
libe2p: add missing f[gs]etproject.c files

Li Xi's patch was missing the sources for fgetproject.c and
fsetproject.c.  I've created replacement files which will service the
purpose.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoAdd project ID support for chattr/lsattr
Li Xi [Tue, 1 Mar 2016 04:19:08 +0000 (23:19 -0500)]
Add project ID support for chattr/lsattr

Chattr and lsattr can be used to set or get project ID:
chattr -p <project id> file
lsattr -p file

Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agofindsuper: improve output if s_mkfs_time unset
Andreas Dilger [Sun, 6 Mar 2016 23:16:04 +0000 (18:16 -0500)]
findsuper: improve output if s_mkfs_time unset

If s_mkfs_time is not set in the superblock, print the s_mtime field
instead to identify the different superblocks.  This can happen if the
superblock is corrupted, since s_mkfs_time is not reset by e2fsck.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agolsattr: treat inode generation as an unsigned int
Andreas Dilger [Sun, 6 Mar 2016 00:38:34 +0000 (17:38 -0700)]
lsattr: treat inode generation as an unsigned int

The EXT2_GETVERSION ioctl is defined to take a "long" parameter, but
fgetversion() calls ioctl() with an "int" parameter instead.  This is
handled in the kernel correctly, but the generation is sign-extended
in fgetversion() before return on 64-bit systems and lsattr prints
it as a huge positive number for inode generation above 0x80000000:

        1635574212 -------------e-- /mnt/ost0/O/0/d0/12928
        18446744073045131735 -------------e-- /mnt/ost0/O/0/d0/166240
        782808861 -------------e-- /mnt/ost0/O/0/d0/31744
        18446744072181134840 -------------e-- /mnt/ost0/O/0/d0/135008

Correctly assign the returned generation number as an unsigned value,
and print it with a 10-character field width.  The version is printed
left-aligned for consistency with the old code and to ensure it is
always printed in the first column for use with tools like "cut":

        1635574212 -------------e-- /mnt/ost0/O/0/d0/12928
        3630547415 -------------e-- /mnt/ost0/O/0/d0/166240
        782808861  -------------e-- /mnt/ost0/O/0/d0/31744
        2766550520 -------------e-- /mnt/ost0/O/0/d0/135008

Do not return a random value from the stack as the version on error.
Clean up some style issues and consolidate some duplicate code.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agomisc: add missing declarations on maint
Andreas Dilger [Sun, 6 Mar 2016 00:38:33 +0000 (17:38 -0700)]
misc: add missing declarations on maint

Fix compile warnings for missing declarations on the maint branch.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agodebugfs: improve dump_mmp handling
Andreas Dilger [Sun, 6 Mar 2016 00:38:32 +0000 (17:38 -0700)]
debugfs: improve dump_mmp handling

If MMP is not enabled on a filesystem (s_mmp_block == 0), print this
clearly rather than "MMP: block number beyond filesystem range".

Add an option to "debugfs dump_mmp" to specify the MMP block number
instead of getting it from the superblock s_mmp_block field.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoblkid: fix ZFS device detection
Andreas Dilger [Sun, 6 Mar 2016 00:38:31 +0000 (17:38 -0700)]
blkid: fix ZFS device detection

While the main blkid functionality is in util-linux, there is still
use for blkid on non-Linux platforms.

Fix the ZFS device detection by looking at multiple uberblocks to
see if any are present, rather than looking for the ZFS boot block
which is not always present.

There are slots for up to 128 uberblocks, but the first 4 are not
written to disk on a newly-formatted filesystem, so check several
of them at different offsets within the uberblock array.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoAdd inherit flags for project quota
Li Xi [Tue, 1 Mar 2016 04:18:05 +0000 (23:18 -0500)]
Add inherit flags for project quota

This patch add EXT4_PROJINHERIT_FL to enable inherit feature for
project ID. If an directory has its inherit flag set, all its
newly created children will inherit its project ID. Conversely,
new inodes will get a default project ID (i.e. zero). Also, no
hard link or rename is permitted if the directory and child has
different project ID.

Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoAdd project quota support
Li Xi [Tue, 1 Mar 2016 03:57:05 +0000 (22:57 -0500)]
Add project quota support

This patch adds project quota support. An new quota type PRJQUOTA(2)
is added. EXT4_PRJ_QUOTA_INO(11) is reserved for project quota inode.
The super block reservers an field s_prj_quota_inum for saving
project quota inode. And each inode adds an internal field i_projid
for saving its project ID.

Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoAdd project feature flag EXT4_FEATURE_RO_COMPAT_PROJECT
Li Xi [Tue, 1 Mar 2016 03:36:13 +0000 (22:36 -0500)]
Add project feature flag EXT4_FEATURE_RO_COMPAT_PROJECT

This patch add project feature flag EXT4_FEATURE_RO_COMPAT_PROJECT.
Project feature is a read-only compat feature. Thus, an ext4 file
system with project feature enabled could only be read by ext4
kernel module without project feature support.

Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoClean up codes for adding new quota type
Li Xi [Tue, 12 Jan 2016 08:56:44 +0000 (17:56 +0900)]
Clean up codes for adding new quota type

Project quota related fields are reserved in Linux kernel.
As a preparation for it, this patch cleans up quota codes
of e2fsprogs so as to make it easier to add new quota type(s).

Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoFix build system to be compatible with BSD pmake
Theodore Ts'o [Sat, 2 Jan 2016 02:44:12 +0000 (21:44 -0500)]
Fix build system to be compatible with BSD pmake

This fixes a number of incompatibilities which caused maint branch to
fail to build on on FreeBSD.  Also fix the Makefile in the tests
directory so that "make -jN check" works correctly on FreeBSD.

Previously the Makefile in the tests directory used a construct which
was specific to GNU Make, which which silently expanded to an empty
list, which caused "make check" to be a no-op when running using BSD's
pmake.  This Makefile has been changed to use the != macro assignment
syntax which is common to GNU make and BSD pmake.  It's technically
not completely portable (it will not be recognized by Solaris's ccs
make, for example), but most other operating systems ship GNU make
(Solaris, AIX), or BSD pmake (*BSD, Mac OS) as either the primary or
alternative make utility that this should an acceptable compromise,
since it makes running all of tests using something like "make -j8
check" or "make -j16 check" run *much* faster.

There are still some caveats if using BSD pmake; in particular, if the
configure script is run on a system which has GNU make (installed as
gmake on FreeBSD for example), the configure script will find it, and
enable some GNU make features in the Makefile, and the generated
makefiles *must* be built using gmake.  However, if isolated build
jail / chroot is used which only has pmake, the Makefiles should now
work with pmake.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoext2fs: work around FreeBSD header breakage
Theodore Ts'o [Sat, 2 Jan 2016 01:12:22 +0000 (20:12 -0500)]
ext2fs: work around FreeBSD header breakage

FreeBSD 10.2 will blow up compiling its own header files in sys/file.h
if _XOPEN_SOURCE is defined.

In file included from tdb.c:59:
/usr/include/sys/file.h:209:2: error: unknown type name 'u_int'
        u_int   xf_flag;        /* flags (see fcntl.h) */
                ^
1 error generated.

This is despite the fact that POSIX.1 requires comforming applications
to define _XOPEN_SOURCE (to different numbers depending on the version
of POSIX.1 the program is expecting to work against).  See section
2.2.1 in POSIX.1 for chapter and verse.

Work around this by removing the _XOPEN_SOURCE declaration.  This will
cause compiler warnings (and will cause builds against some versions
of Solaris to break), so only do this for FreeBSD.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agomke2fs: sort "-d" option alphabetically
Andreas Dilger [Mon, 30 Nov 2015 23:30:11 +0000 (18:30 -0500)]
mke2fs: sort "-d" option alphabetically

Move the mke2fs "-d" option to be alphabetical like other options.

Rename "root_dir" to "src_root_dir" to avoid confusion with the
actual root inode in the new filesystem.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agofuse2fs: set inode's uid/gid when creating inode
Darrick J. Wong [Mon, 30 Nov 2015 23:28:42 +0000 (18:28 -0500)]
fuse2fs: set inode's uid/gid when creating inode

When creating a file in op_create, set the file's uid and gid to the
user's uid and gid.  Do the same in op_mknod.

Reported-by: Lennart Lövstrand <lennart@lovstrand.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
8 years agoMerge branch 'maint' into next
Theodore Ts'o [Mon, 30 Nov 2015 23:16:36 +0000 (18:16 -0500)]
Merge branch 'maint' into next