OSDN Git Service
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Theodore Ts'o [Mon, 7 Mar 2016 02:30:07 +0000 (21:30 -0500)]
Merge branch 'maint' into next
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>
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>
Theodore Ts'o [Mon, 7 Mar 2016 01:37:49 +0000 (20:37 -0500)]
Merge branch 'maint' into next
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Theodore Ts'o [Mon, 30 Nov 2015 23:16:36 +0000 (18:16 -0500)]
Merge branch 'maint' into next
Andreas Dilger [Mon, 30 Nov 2015 20:26:35 +0000 (15:26 -0500)]
e2fsck: fix e2fsck -fD directory truncation
When an extent-mapped directory is compacted by "e2fsck -fD" and
frees enough leaf blocks that it loses an extent tree index block,
the old e2fsck_rehash_dir->ext2fs_block_iterate3->write_dir_block()
code would not free the extent block, which would result in the
extent tree becoming corrupted when it is written out.
Pass 1: Checking inodes, blocks, and sizes
Inode
17825800, end of extent exceeds allowed value
(logical block 710, physical block
570459684, len 1019)
This results in loss of a whole index block of directory leaf blocks
and maybe thousands or millions of files in lost+found.
Fix e2fsck_rehash_dir() to call ext2fs_punch() to free the blocks
at the end of the directory instead of trying to handle this itself
while writing out the directory. That properly handles all of the
cases of updating the extent tree as well as accounting for blocks
that are released (both leaf blocks and index blocks).
Add a test case for compacting the directory to be smaller than the
index block that originally caused the corruption.
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Mon, 30 Nov 2015 20:26:21 +0000 (15:26 -0500)]
libext2fs: fix block-mapped file punch
If ext2fs_punch() was called with "end = ~0ULL" to indicate truncate
to the end of file it tried to compute "count" for ext2fs_punch_ind()
based on "start" and "end", but incorrectly passed "count = ~0U" even
when "start" was non-zero, causing an overflow in some cases.
The calling convention for ext2fs_punch_ind() was also gratuitously
different from ext2fs_punch() and ext2fs_punch_extent(), passing
"count" instead of "end" as the last parameter. Fix this by passing
it "end" like the other functions, and handle "count" internally.
Add checks to ext2fs_punch_ind() if "end" is at or beyond the 2^32
indirect block limit so the 32-bit internal variables don't overflow.
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Mon, 30 Nov 2015 20:22:07 +0000 (15:22 -0500)]
e2fsck: zap extent-format inode with no extent header
The kernel requires all inodes with the extent flag set to have a
valid extent tree header in i_block. The ext2fs_extent_open2 prefers
to initialize the header if i_block is zeroed, but e2fsck never writes
the new header to disk. Since the kernel won't create inodes with the
flag and no header anyway, zap such files.
Reported-by: Bo Branten <bosse@acc.umu.se>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Jim Garlick [Mon, 30 Nov 2015 17:13:39 +0000 (12:13 -0500)]
tune2fs: warn if the filesystem journal is dirty
Running tune2fs on a filesystem with an unrecovered journal can
cause the tune2fs settings changes in the superblock to be reverted
when the journal is replayed if it contains an uncommitted copy of
the superblock. Print a warning if this is detected so that the
user isn't surprised if it happens.
Signed-off-by: Jim Garlick <garlick@llnl.gov>
Updated message printed to include steps to replay journal.
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Mon, 30 Nov 2015 17:09:44 +0000 (12:09 -0500)]
libext2fs: fix tst_badblocks buffer overrun
The test2[] array is not 0-terminated and the create_test_list() for
loop does not terminate properly at the end of this array, but
continues until it hits the 0 at the end of test3[].
Reported-by: Hanno Boeck <hanno@hboeck.de>
Addresses: https://bugzilla.kernel.org/show_bug.cgi?id=104311
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Artemiy Volkov [Mon, 30 Nov 2015 17:03:52 +0000 (12:03 -0500)]
e2fsck: do not read EA header beyond the end of an inode
In check_inode_extra_space(), if we attempt to read an EA header at
the end of the extra space, in a corrupted filesystem it may result in
a read beyond the bounds of the inode. Add a check to prevent this.
Reproduced by running ./test_one --valgrind f_write_ea_toobig_extra_isize.
Signed-off-by: Artemiy Volkov <artemiyv@acm.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Acked-by: Darrick J. Wong <darrick.wong@oracle.com>
Jan Kara [Mon, 30 Nov 2015 16:56:55 +0000 (11:56 -0500)]
chattr: fix typo in a manpage
Signed-off-by: Jan Kara <jack@suse.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 9 Dec 2013 18:55:23 +0000 (13:55 -0500)]
debugfs: add support to properly set and display extended timestamps
This code is partially derived from patches from David Turner to allow
debugfs to properly support extended timestamps.
Cc: David Turner <novalis@novalis.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Andreas Dilger [Sat, 14 Nov 2015 01:10:27 +0000 (18:10 -0700)]
e2fsck: skip quota update when interrupted
There is a bug in how e2fsck handles being interrupted by CTRL-C.
If CTRL-C is pressed to kill e2fsck rather than e.g. kill -9, then
the interrupt handler sets E2F_FLAG_CANCEL in the context but doesn't
actually kill the process. Instead, e2fsck_pass1() checks this flag
before processing the next inode.
If a filesystem is running in fix mode (e2fsck -fy) is interrupted,
and the quota feature is enabled, then the quota file will still be
written to disk even though the inode scan was not complete and the
quota information is totally inaccurate. Even worse, if the Pass 1
inode and block scan was not finished, then the in-memory block
bitmaps (which are used for block allocation during e2fsck) are also
invalid, so any blocks allocated to the quota files may corrupt other
files if those blocks were actually used.
e2fsck 1.42.13.wc3 (28-Aug-2015)
Pass 1: Checking inodes, blocks, and sizes
^C[QUOTA WARNING] Usage inconsistent for ID 0:
actual (
6455296, 168) != expected (
8568832, 231)
[QUOTA WARNING] Usage inconsistent for ID 695:
actual (
614932320256, 63981) != expected (
2102405386240, 176432)
Update quota info for quota type 0? yes
[QUOTA WARNING] Usage inconsistent for ID 0:
actual (
6455296, 168) != expected (
8568832, 231)
[QUOTA WARNING] Usage inconsistent for ID 538:
actual (
614932320256, 63981) != expected (
2102405386240, 176432)
Update quota info for quota type 1? yes
myth-OST0001: e2fsck canceled.
myth-OST0001: ***** FILE SYSTEM WAS MODIFIED *****
There may be a desire to flush out modified inodes and such that have
been repaired, so that restarting an interrupted e2fsck will make
progress, but the quota file update is plain wrong unless at least
pass1 has finished, and the journal recreation is also dangerous if
the block bitmaps have not been fully updated.
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sat, 15 Mar 2014 15:36:34 +0000 (11:36 -0400)]
libext2fs: fix parents when modifying extents
In ext2fs_extent_set_bmap() and ext2fs_punch_extent(), fix the parents
when altering either end of an extent so that the parent nodes reflect
the added mapping.
There's a slight complication to using fix_parents: if there are two
mappings to an lblk in the tree, the value of handle->path->curr can
point to either extent afterwards), which is documented in a comment.
Some additional color commentary from Darrick:
In the _set_bmap() case, I noticed that the "remapping last block in
extent" case would produce symptoms if we are trying to remap a
block from "extent" to "next_extent", and the two extents are
pointed to by different index nodes. _extent_replace(...,
next_extent) updates e_lblk in the leaf extent, but because there's
no _extent_fix_parents() call, the index nodes never get updated.
In the _punch_extent() case, we conclude that we need to split an
extent into two pieces since we're punching out the middle. If the
extent is the last extent in the block, the second extent will be
inserted into a new leaf node block. Without _fix_parents(), the
index node doesn't seem to get updated.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Matthieu Dupont [Sun, 15 Nov 2015 15:24:54 +0000 (16:24 +0100)]
make2fs: parse a human readable inode ratio for the -i option
Signed-off-by: Matthieu Dupont <matt.59491@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sat, 24 Oct 2015 05:26:35 +0000 (01:26 -0400)]
debugfs: clean up feature test macros with predicate functions
Create separate predicate functions to test/set/clear feature flags,
thereby replacing the wordy old macros. Furthermore, clean out the
places where we open-coded feature tests.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sat, 24 Oct 2015 05:23:30 +0000 (01:23 -0400)]
resize2fs: clean up feature test macros with predicate functions
Create separate predicate functions to test/set/clear feature flags,
thereby replacing the wordy old macros. Furthermore, clean out the
places where we open-coded feature tests.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sat, 24 Oct 2015 05:23:01 +0000 (01:23 -0400)]
misc: clean up feature test macros with predicate functions
Create separate predicate functions to test/set/clear feature flags,
thereby replacing the wordy old macros. Furthermore, clean out the
places where we open-coded feature tests.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sat, 24 Oct 2015 04:43:19 +0000 (00:43 -0400)]
e2fsck: clean up feature test macros with predicate functions
Create separate predicate functions to test/set/clear feature flags,
thereby replacing the wordy old macros. Furthermore, clean out the
places where we open-coded feature tests.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sat, 24 Oct 2015 04:34:09 +0000 (00:34 -0400)]
libext2fs: clean up feature test macros with predicate functions
Create separate predicate functions to test/set/clear feature flags,
thereby replacing the wordy old macros. Furthermore, clean out the
places where we open-coded feature tests.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sat, 24 Oct 2015 04:30:02 +0000 (00:30 -0400)]
libext2fs: automatically enable meta_bg to avoid filling up BG 0
If during formatting we'd lose more than 75% a block group to group
descriptors and other metadata, enable the meta_bg feature. This
enables us to create >500T filesystems with default options.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sat, 24 Oct 2015 04:24:57 +0000 (00:24 -0400)]
libext2fs: fix maximum bg overhead calculation with meta_bg enabled
When meta_bg is enabled at mkfs time, we put at most one group
descriptor block in each blockgroup. Unfortunately, the calculation
of max overhead per bg doesn't know this, so mkfs fails when it isn't
strictly necessary. Fix it, since Dave reported that he couldn't
create a 500TB ext4 filesystem.
Reported-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 29 Sep 2015 14:26:16 +0000 (10:26 -0400)]
Merge remote-tracking branch 'origin/maint' into next
Theodore Ts'o [Sat, 19 Sep 2015 01:37:53 +0000 (21:37 -0400)]
subst: work around an NFS bug
When running on NFS, opening files with 0444 perms for writing can
sometimes fail. This is arguably an NFS server bug, but work around
it by creating the file with 0644 permissions, and only change the
permissions to be 0444 right before we close the file.
URL: https://bugs.gentoo.org/550986
Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Wed, 9 Sep 2015 14:53:49 +0000 (10:53 -0400)]
Fix typo in the ext4(5) man page
Addresses-Debian-Bug: #798425
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 6 Sep 2015 02:21:35 +0000 (22:21 -0400)]
tune2fs: allow changing the UUID mounted file systems with the -f option
There are times when it is necessary to update the UUID on a mounted
root file system (for example). So when we add this this safety check
to e2fsprogs 1.43, we will likely break some scripts. Allow the -f
option to force an override of this safety check.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 6 Sep 2015 02:18:29 +0000 (22:18 -0400)]
e4defrag: fix build failure if libc doesn't have sync_file_range()
The posix_fadvise() to hint to the system that the file can be removed
from memory will probably not work well without the sync_file_range(2)
call, but e4defrag should still fundamentally work, and this will
allow e4defrag to compile if the C library doesn't happen this system
call exposed.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Thu, 23 Jul 2015 16:46:42 +0000 (12:46 -0400)]
android: be able to build dumpe2fs, lsattr, and e2fsck statically
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Wed, 22 Jul 2015 04:18:14 +0000 (00:18 -0400)]
Merge branch 'maint' into next
Tobias Stoeckmann [Mon, 20 Jul 2015 14:52:28 +0000 (10:52 -0400)]
debugfs: handle out of memory condition
If malloc fails, properly handle the error condition.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Tobias Stoeckmann [Mon, 20 Jul 2015 14:42:40 +0000 (10:42 -0400)]
util: avoid off-by-one on long symlinks
readlink does not nul terminate its result, therefore one extra byte
has to be taken into account.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Wed, 22 Jul 2015 04:06:43 +0000 (00:06 -0400)]
e2fsck: check htree leaf block checksums
We weren't verifying the checksum of an htree leaf block due to a
coding error that marked all htree blocks as not having checksums.
While we're at it, fix the error message that gets displayed so that
it doesn't print a meaningless block offset.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Thu, 16 Jul 2015 21:19:38 +0000 (17:19 -0400)]
e2fsck: check for encrypted directory entries with too-short file names
If there are directory entries with file names which are less than 16
bytes, it turns out that passing less than the crypto block size to
the kernel's crypto layer will cause the kernel to crash.
However, since there never should be encrypted directory entries where
the file name is less than 16 bytes (the AES block size), change
e2fsck to offer to address this corruption by deleting the directory
entry.
(We need to checks for this condition into the kernel as well.)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Thu, 16 Jul 2015 18:21:22 +0000 (14:21 -0400)]
e2fsck: check for an encrypted lost+found directory
The /lost+found directory must not be encrypted, since e2fsck won't
have any keys. If we find an encrypted lost+found directory, we
should delete the directory and recreate it.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Wed, 15 Jul 2015 03:19:08 +0000 (23:19 -0400)]
android: add add_ext4_encrypt helper program
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 19:36:19 +0000 (15:36 -0400)]
debugfs: cleanup gcc -Wall warnings
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 17:23:28 +0000 (13:23 -0400)]
misc: cleanup gcc -Wall warnings
Also change ext2fs_symlink() so that the target parameter is a const
char *, thus promising that we will never change the incoming string.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 14:58:33 +0000 (10:58 -0400)]
Remove dropped const warning and enable pread/pwrite for Android build
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 14:41:23 +0000 (10:41 -0400)]
create_inode: remove backup definition of __func__
We are using __func__ without any backup definition in the rest of
e2fsprogs, and this is causing warnings in the Android build, so just
remove it.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 13:22:47 +0000 (09:22 -0400)]
Eliminate unused variable and unused label warnings from Android build
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 12:31:51 +0000 (08:31 -0400)]
Eliminate unused parameter warnings from Android build
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 03:09:15 +0000 (23:09 -0400)]
Eliminate unused function warnings from Android build
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 02:54:37 +0000 (22:54 -0400)]
Eliminate doubly defined _LARGEFILE_SOURCE warning
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 02:43:31 +0000 (22:43 -0400)]
Move dict.c from e2fsck to lib/support
The quota code required that we included dict.o in libsupport.a, so we
might as well just move dict.c and dict.h to lib/support, and then
have e2fsck use the version of dict.c in libsupport.a. This
simplifies the build system and eliminates having two identical copies
of dict.o floating around in the build tree.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 01:55:32 +0000 (21:55 -0400)]
Move the check_plausibility() function from misc to lib/support
The check_plausibility() function is now used all over the place, so
we should move the plausible.c file to lib/support and remove the
special case handling for that file that had been in the build system.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 13 Jul 2015 00:44:53 +0000 (20:44 -0400)]
Suppress annoying missing field initializer warnings
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 12 Jul 2015 22:05:40 +0000 (18:05 -0400)]
Move the profile parsing functions from e2fsck to lib/support
The profile functions started as something specific to e2fsck. It's
now used by mke2fs and e2fsck, so it's better to move it into
libsupport.a.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 12 Jul 2015 21:39:26 +0000 (17:39 -0400)]
tune2fs: allow tune2fs to be built as a static library for Android
Sync up with aosp's e2fsprogs commits:
d25948b9b4a9e361ef071dc8175df0407f60b7e0
e59f7c7cedb1e07eb4dbbb66e115c14faea19f19
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 12 Jul 2015 20:59:52 +0000 (16:59 -0400)]
Theodore Ts'o [Sun, 12 Jul 2015 20:56:39 +0000 (16:56 -0400)]
android_config: remove HAVE_TERMIO_H
Sync up with aosp's e2fsprogs commits:
dc351db427e667b9f954c4338f69da83fa16222b
2ca3c65991609bb5b48004ec3c7a66f6b417beed
4ef951aa5e69116963f1836fe5ddcf6b87afbecd
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 12 Jul 2015 03:24:38 +0000 (23:24 -0400)]
Add fallocate.c to lib/exte2fs/Android.mk
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 12 Jul 2015 03:05:57 +0000 (23:05 -0400)]
rename libquota.a to libsupport.a
We will be using libsupport.a for e2fsprogs's internal support
functions. It will contain the quota support functions, but we will
also be moving code such as profile.c and plausible.c to libsupport.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 4 Jul 2015 02:02:30 +0000 (22:02 -0400)]
configure: remove support to disable quota support
For the 1.43 release, quota support will be the default. It's much
simpler if we don't try to make quota support optional. This was done
originally because the quota feature wasn't fully tested. It is now,
so we can remove this as an option.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Fri, 3 Jul 2015 20:29:35 +0000 (16:29 -0400)]
configure: remove support to disable htree support
The presence of --disable-htree is very much a legacy thing. Remove
it since supporting the lack of htree support is pretty silly.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>