Whamcloud - gitweb
tools/e2fsprogs.git
6 years agoAdd options to gzip and tar to create reproducible artificats
Theodore Ts'o [Sun, 13 Aug 2017 23:54:30 +0000 (19:54 -0400)]
Add options to gzip and tar to create reproducible artificats

Also remove some long-unused rules from resize2fs's Makefile.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agotests: disable use of the BLKID cache while running regression tests
Theodore Ts'o [Sun, 13 Aug 2017 21:52:20 +0000 (17:52 -0400)]
tests: disable use of the BLKID cache while running regression tests

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibsupport: fix 32-bit quota test failures
Theodore Ts'o [Sun, 13 Aug 2017 18:45:27 +0000 (14:45 -0400)]
libsupport: fix 32-bit quota test failures

On 32-bit platform some of the util_dqblk structures have a type of
long long.  So we need to use %lld and casts to make sure the right
thing happens on both 32-bit and 64-bit platforms.

Fixes: 968c1c2fe472ddc4a467aaff71305e83cdb0308f
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoDrop debian patches that have landed in v1.43.5
Theodore Ts'o [Fri, 4 Aug 2017 16:55:37 +0000 (12:55 -0400)]
Drop debian patches that have landed in v1.43.5

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoMerge branch 'debian' into debian-packaging
Theodore Ts'o [Fri, 4 Aug 2017 16:53:10 +0000 (12:53 -0400)]
Merge branch 'debian' into debian-packaging

6 years agoMerge tag 'v1.43.5' into debian
Theodore Ts'o [Fri, 4 Aug 2017 16:52:03 +0000 (12:52 -0400)]
Merge tag 'v1.43.5' into debian

v1.43.5

6 years agoUpdate release notes, etc., for the 1.43.5 release v1.43.5
Theodore Ts'o [Fri, 4 Aug 2017 16:20:53 +0000 (12:20 -0400)]
Update release notes, etc., for the 1.43.5 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoAdd new symbol to debian/e2fslibs.symbols
Theodore Ts'o [Fri, 4 Aug 2017 16:19:47 +0000 (12:19 -0400)]
Add new symbol to debian/e2fslibs.symbols

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agodebian: update policy conformance to standards version 4.0
Theodore Ts'o [Fri, 4 Aug 2017 15:27:15 +0000 (11:27 -0400)]
debian: update policy conformance to standards version 4.0

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agodebian/rules: update config.{guess,sub} before running configure, not after
Theodore Ts'o [Fri, 4 Aug 2017 15:26:39 +0000 (11:26 -0400)]
debian/rules: update config.{guess,sub} before running configure, not after

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoRemove special mips libraries from Debian build
Theodore Ts'o [Fri, 4 Aug 2017 06:01:43 +0000 (02:01 -0400)]
Remove special mips libraries from Debian build

These libraries were needed to support arcboot, which is obsolete and
no longer part of Debian.  So drop these non-standard, legacy special
libraries that were only built on the mips platform.

Addresses-Debian-Bug: #864144

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoRemove obsolete Conflicts/Replaces headers in Debian control file
Theodore Ts'o [Fri, 4 Aug 2017 05:54:55 +0000 (01:54 -0400)]
Remove obsolete Conflicts/Replaces headers in Debian control file

Addresses-Debian-Bug: #866623

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoRemove spaces at the end of man pages
Theodore Ts'o [Fri, 4 Aug 2017 05:51:50 +0000 (01:51 -0400)]
Remove spaces at the end of man pages

Addresses-Debian-Bug: #865584

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoClarify description of the the commit mount option in the ext4 man page
Theodore Ts'o [Fri, 4 Aug 2017 05:47:29 +0000 (01:47 -0400)]
Clarify description of the the commit mount option in the ext4 man page

Addresses-Debian-Bug: #867895

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoUpdate translation template for 1.43.5 release
Theodore Ts'o [Fri, 4 Aug 2017 05:30:54 +0000 (01:30 -0400)]
Update translation template for 1.43.5 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoUpdate lib/e2p/Makefile.in using "make depend"
Theodore Ts'o [Fri, 4 Aug 2017 05:27:48 +0000 (01:27 -0400)]
Update lib/e2p/Makefile.in using "make depend"

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agopo: update vi.po (from translationproject.org)
Trần Ngọc Quân [Fri, 4 Aug 2017 05:08:46 +0000 (01:08 -0400)]
po: update vi.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agopo: update sr.po (from translationproject.org)
Мирослав Николић [Fri, 4 Aug 2017 05:08:46 +0000 (01:08 -0400)]
po: update sr.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agopo: update hu.po (from translationproject.org)
Balázs Úr [Fri, 4 Aug 2017 05:08:46 +0000 (01:08 -0400)]
po: update hu.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agopo: update da.po (from translationproject.org)
Joe Hansen [Fri, 4 Aug 2017 05:08:46 +0000 (01:08 -0400)]
po: update da.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agopo: update cs.po (from translationproject.org)
Petr Pisar [Fri, 4 Aug 2017 05:08:46 +0000 (01:08 -0400)]
po: update cs.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: fix e2fsck -D for encrypted directories
Theodore Ts'o [Tue, 1 Aug 2017 14:26:11 +0000 (10:26 -0400)]
e2fsck: fix e2fsck -D for encrypted directories

If the directory entry is encrypted there may be embedded NUL
characters; hence, we should use memcmp instead of strncmp when
comparing strings.  Otherwise, e2fsck can erroneously report that a
directory have duplicant entries when doing an e2fsck -D check.

Reported-by: Sahitya Tummala <stummala@codeaurora.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoFix build when configured with --disable-threads
Theodore Ts'o [Thu, 27 Jul 2017 23:43:00 +0000 (19:43 -0400)]
Fix build when configured with --disable-threads

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoFix build when configured with --enable-profile
Theodore Ts'o [Thu, 27 Jul 2017 23:42:23 +0000 (19:42 -0400)]
Fix build when configured with --enable-profile

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: fix error handling for ext2fs_sync_device()
Theodore Ts'o [Thu, 27 Jul 2017 23:41:22 +0000 (19:41 -0400)]
libext2fs: fix error handling for ext2fs_sync_device()

Return the proper error code instead of -1.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoFurther cleanups of the dir_link documentation in the ext4 man page
Theodore Ts'o [Thu, 27 Jul 2017 22:31:04 +0000 (18:31 -0400)]
Further cleanups of the dir_link documentation in the ext4 man page

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibsupport: fix error handling in quota_write_inode
zhangyi (F) [Mon, 24 Jul 2017 07:01:26 +0000 (15:01 +0800)]
libsupport: fix error handling in quota_write_inode

The error return value of quota_file_create() is no longer < 0,
and the error handling in quota_write_inode() is incorrect,
fix these. This also fix a tune2fs segfault that currently
occurs when we add project and quota features to an inode
exhaustion ext4 filesystem.

Fixes: a701823a3150("libsupport: fix gcc -Wall nits")

Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agodebugfs: fix "ls -p" to avoid printing garbage after the file name
Theodore Ts'o [Mon, 24 Jul 2017 17:11:16 +0000 (13:11 -0400)]
debugfs: fix "ls -p" to avoid printing garbage after the file name

In commit 68a1de3df3 (debugfs: pretty print encrypted filenames in the
ls command), a change was introduced in debugfs/ls.c which instead of
copying dirent->name and 0-terminating it, dirent->name is used
directly in printf.

However, instead of using the precision to limit the number of
characters output, the code uses the field width. As a result,
characters are output until a 0 is read, which results in garbage
after the file name.

Also fix two other instances of this in debugging messages that aren't
used, but fixing them will avoid potential future copypasta bugs.

Reported-by: Christian Gabriel <ch_gabriel@web.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoClarify how the description of the dir_nlink feature in the ext4 man page
Theodore Ts'o [Sun, 23 Jul 2017 22:51:22 +0000 (18:51 -0400)]
Clarify how the description of the dir_nlink feature in the ext4 man page

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agotune2fs: edit dire warning about check intervals
Eric Sandeen [Sun, 23 Jul 2017 22:34:57 +0000 (18:34 -0400)]
tune2fs: edit dire warning about check intervals

Time & mount-count based checks have been off by default for quite some
time now, but the dire warning about disabling them remains in the
tune2fs manpage, which is confusing.  We did "strongly consider
the consequences" and disabled it by default, no need to scare the
user about it now.  Inform the user of the consequences in a more
measured tone.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoresize2fs: sanity check the free blocks and inode counts
Theodore Ts'o [Sun, 23 Jul 2017 04:46:36 +0000 (00:46 -0400)]
resize2fs: sanity check the free blocks and inode counts

If the free block or free inodes count are larger than the number of
blocks or inodes in the system, request that the file system be
checked.  Otherwise it's possible for calcuate_minimum_resize_size()
to hang in an infinite loop.

This problem was found using American Fuzzy Lop.

Reported-by: Adam Buchbinder <abuchbinder@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agodebugfs: add sanity checking to the string_to_inode() utility function
Theodore Ts'o [Sun, 23 Jul 2017 04:45:05 +0000 (00:45 -0400)]
debugfs: add sanity checking to the string_to_inode() utility function

Otherwise it's possible for a corrupt file system or bad user input to
cause debugfs to crash if the resulting inode number is insanely
large.

This problem was found using American Fuzzy Lop.

Reported-by: Adam Buchbinder <abuchbinder@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: add stricter checks on the inode size in ext2fs_open2()
Theodore Ts'o [Sun, 23 Jul 2017 04:26:44 +0000 (00:26 -0400)]
libext2fs: add stricter checks on the inode size in ext2fs_open2()

An inode size larger than the block size can cause userspace programs
to crash.

This problem was found using American Fuzzy Lop.

Reported-by: Adam Buchbinder <abuchbinder@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: don't restart after a critical metadata collision in e2fsck -n mode
Theodore Ts'o [Sun, 23 Jul 2017 04:08:18 +0000 (00:08 -0400)]
e2fsck: don't restart after a critical metadata collision in e2fsck -n mode

If the file system isn't going to be changed, there's no point
restarting; it will just cause e2fsck to loop forever.

This problem was found using American Fuzzy Lop.

Reported-by: Adam Buchbinder <abuchbinder@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: quiet some harmless bitmap warnings
Theodore Ts'o [Sun, 23 Jul 2017 02:50:22 +0000 (22:50 -0400)]
e2fsck: quiet some harmless bitmap warnings

E2fsck checks block numbers against the block_metadata_map before it
checks to see whether or not the block numbers are valid.  So suppress
these harmless warnings.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agotests: dumpe2fs against an image with bad os_type
Adam Buchbinder [Sat, 22 Jul 2017 21:52:53 +0000 (17:52 -0400)]
tests: dumpe2fs against an image with bad os_type

The os_type here is large enough to be negative when interpreted as a
signed integer.

This test case was generated by american fuzzy lop, starting from a
base filesystem image from files.fuzzing-project.org.

Signed-off-by: Adam Buchbinder <abuchbinder@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2p: fix segfault in e2p_os2string
Adam Buchbinder [Sat, 22 Jul 2017 21:52:24 +0000 (17:52 -0400)]
e2p: fix segfault in e2p_os2string

Passing in a negative integer would lead to a segfault, and
a crafted filesystem image could trigger that.

Signed-off-by: Adam Buchbinder <abuchbinder@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: check for invalid quota inode numbers
Theodore Ts'o [Sat, 22 Jul 2017 20:08:25 +0000 (16:08 -0400)]
e2fsck: check for invalid quota inode numbers

If the superblock has invalid inode numbers for the user, group, or
project quota inodes, e2fsck should notice and offer to fix things by
zeroing out the invalid superblock field.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: add support for printing the quota type in problem reports using %U
Theodore Ts'o [Sat, 22 Jul 2017 18:51:28 +0000 (14:51 -0400)]
e2fsck: add support for printing the quota type in problem reports using %U

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: fix the s_log_block_size check in ext2fs_open()
Theodore Ts'o [Mon, 17 Jul 2017 23:55:39 +0000 (19:55 -0400)]
libext2fs: fix the s_log_block_size check in ext2fs_open()

The s_log_block_check can fail to detect an invalid value if it is
between UINT_MAX-9 and UINT_MAX, which can lead to ext2fs_open()
crashing with a division by zero error.

This bug was found using American Fuzzy Lop: http://lcamtuf.coredump.cx/afl/

Addresses-Debian-Bug: #868489

Reported-by: jwilk@jwilk.net
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoAOSP: blkid: Resolve to the exFAT uuid change on reboot.
liminghao [Mon, 10 Apr 2017 01:48:51 +0000 (09:48 +0800)]
AOSP: blkid: Resolve to the exFAT uuid change on reboot.

The volume_serial into exFAT super block is uuid but
not standard uuid, it's just volume serial number.

Change-Id: I376ed9fe1ba1b7f3d367d78cc5e2bb8ea9cc2d13
Signed-off-by: liminghao <liminghao@xiaomi.com>
From AOSP commit: 91e756e829362c66265334e2e20fb3604586ce8b

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoAOSP: blkid: add support to recognize exfat to blkid.
liminghao [Wed, 1 Mar 2017 09:54:42 +0000 (17:54 +0800)]
AOSP: blkid: add support to recognize exfat to blkid.

we can now identify exfat filesystem.

Change-Id: I870e59a14b6bcd8b45562cdd02c2502d60a9eeff
Signed-off-by: liminghao <liminghao@xiaomi.com>
From AOSP commit: 1206f6d8c5ed47ba19cfc30a19dba51fcd2cd5cb

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: fix compile errors/warnings
Tahsin Erdogan [Fri, 30 Jun 2017 04:19:32 +0000 (21:19 -0700)]
libext2fs: fix compile errors/warnings

Defining DEBUG_QUOTA reveals a few compile errors. Fix these.
Also fix format string type mismatches in a couple of log_debug()
calls.

Fixes: 2d2d799c7261 ("Clean up codes for adding new quota type")

Signed-off-by: Tahsin Erdogan <tahsin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoFix warnings found using UBSAN
Theodore Ts'o [Tue, 4 Jul 2017 22:00:46 +0000 (18:00 -0400)]
Fix warnings found using UBSAN

Compiling with -fsanitize=undefined -fsanitize=address causes some
warnings of C code that has undefined behavior according to the C
standard bugs.  None of the warnings should cause e2fsprogs
malfunction given a sane compiler running on architectures that Linux
can support.  Still, it's better to clean up to code than not.

To fix up a complaint of a negative shift in hash function, update the
very dated hash we had been using for the revoke table with the
current generic hash used by the kernel.

Other fixes are fairly self-explanatory.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agotests: add j_recover_csum3_64bit
Theodore Ts'o [Tue, 4 Jul 2017 21:51:48 +0000 (17:51 -0400)]
tests: add j_recover_csum3_64bit

Add a test to make sure we are correctly recovering 64-bit journals
using the v3 checksum format.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: fix build issue for on Windows/Cygwin systems
Theodore Ts'o [Tue, 4 Jul 2017 01:28:53 +0000 (21:28 -0400)]
libext2fs: fix build issue for on Windows/Cygwin systems

Provide ext2fs_get_device_size2() for Windows/Cygwin systems, so
builds can succeed.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe4defrag: fix GCC7.x compiler warning
Marc Thomas [Mon, 26 Jun 2017 15:40:39 +0000 (16:40 +0100)]
e4defrag: fix GCC7.x compiler warning

../../misc/e4defrag.c:1821:8: warning: statement will never be executed
[-Wswitch-unreachable]
    int mount_dir_len = 0;

Also fix a typo in a few comments.

Signed-off-by: Marc Thomas <marc@dragonfly.plus.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agofilefrag: fix GCC7.x compiler warning
Marc Thomas [Mon, 26 Jun 2017 15:39:47 +0000 (16:39 +0100)]
filefrag: fix GCC7.x compiler warning

../../misc/filefrag.c:591:33: warning: comparison between pointer and
zero character constant [-Wpointer-compare]
  for (cpp = argv + optind; *cpp != '\0'; cpp++) {

Signed-off-by: Marc Thomas <marc@dragonfly.plus.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe4defrag: display the e2fsprogs version number
Marc Thomas [Fri, 9 Jun 2017 12:58:32 +0000 (13:58 +0100)]
e4defrag: display the e2fsprogs version number

Signed-off-by: Marc Thomas <marc@dragonfly.plus.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agotests: add new test f_del_dup_quota
Eric Whitney [Fri, 23 Jun 2017 21:28:12 +0000 (17:28 -0400)]
tests: add new test f_del_dup_quota

Add a test to validate the changes in commit b0f5fa880c36: "e2fsck:
fix multiply-claimed block quota accounting when deleting files".

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agomke2fs: fix hugefile creation so the hugefile(s) are contiguous
Theodore Ts'o [Mon, 19 Jun 2017 22:39:55 +0000 (18:39 -0400)]
mke2fs: fix hugefile creation so the hugefile(s) are contiguous

Commit 4f868703f6f2: "libext2fs: use fallocate for creating journals
and hugefiles" introduced a regression for the mke2fs hugefile
feature.  The problem is that the fallocate library function
intersperses the extent tree metadata blocks with the data blocks, and
this violates the hugefile guarantee that the created files should be
physically contiguous on disk.

Unfortuantely the m_hugefile regression test was flawed, and didn't
pick up the regression.

This commit fixes the regression test so that it detects the problem
before fixing mke2fs, and also fixes the mke2fs hugefile by reverting
the mke2fs hugefile portion of commit 4f868703f6f2.

Google-Bug-Id: 62791459

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: fix build warning on Big Endian systems in closefs.c
Theodore Ts'o [Sun, 4 Jun 2017 23:28:35 +0000 (19:28 -0400)]
libext2fs: fix build warning on Big Endian systems in closefs.c

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: correctly write up the backup superblocks in big endian systems
Theodore Ts'o [Sun, 4 Jun 2017 22:37:31 +0000 (18:37 -0400)]
libext2fs: correctly write up the backup superblocks in big endian systems

This bug has been around since we added support for metadata
checksums, but it was unmasked by commit bf9f3b6d5b ("e2fsck: exit
with exit status 0 if no errors were fixed").  The backup superblocks
are not supposed to have the EXT2_VALID_FS or the NEEDS_RECOVERY bits
set, and earlier 1.43.x versions of e2fsprogs were byte swapping the
shadow superblock each time it was written, so that every other backup
superblock was incorrectly byte swapped.

Fortunately the primary backup superblock was correctly written
(modulo having the VALID_FS bit set when it should not have been set)
so for the most part no one noticed.  And very few architectures use
big endian byte ordering these days.  (Even IBM has seen the light
with the ppcle architecture.  :-)

Fortunately commit bf9f3b6d5b caused f_desc_size_bad and
f_resize_inode to fail on a big endian system, which allowed me to
notice the issue and investigate.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agotune2fs: fix BUGs of tuning project quota
Wang shilong [Tue, 30 May 2017 00:36:51 +0000 (20:36 -0400)]
tune2fs: fix BUGs of tuning project quota

There are several problems for project quota enable/disable:
tune2fs -O ^project did not work, because @clear_ok_features
did not include @EXT4_FEATURE_RO_COMPAT_PROJECT.

update_feature_set() works for -O option, but tune2fs -Q prj/^prj
did not work well, because function handle_quota_options()
did not set and clear @EXT4_FEATURE_RO_COMPAT_PROJECT feature very well.

one warning message is removed, because with project feature
enabled, quota feature will be enabled automatically.

Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agobadblocks: support languages which use multi-column wide characters
Theodore Ts'o [Tue, 30 May 2017 00:04:56 +0000 (20:04 -0400)]
badblocks: support languages which use multi-column wide characters

CJK characters take up two columns for each character; teach badblocks
to take this into account.

Addresses-Debian-Bug: #860926

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reported-by: "Mingye Wang (Arthur2e5)" <arthur200126@gmail.com>
6 years agoe2fsck: don't flush to device opened in read-only mode
Konstantin Chistyakov [Mon, 29 May 2017 23:11:38 +0000 (19:11 -0400)]
e2fsck: don't flush to device opened in read-only mode

If the e2fsck is called with both the -f and -n options, it will
complete with an exit status of 8 due to an error when trying to flush
the io_channel (which was opened read-only) when built on on Cygwin on
Windows 8.1 and Windows 10.  Apparently Cygwin is unhappy when fsync
is called on a file descriptor opened read-only.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsprogs: Make -U option consistent between tune2fs and mke2fs
Drew Davenport [Mon, 29 May 2017 22:51:21 +0000 (18:51 -0400)]
e2fsprogs: Make -U option consistent between tune2fs and mke2fs

Allow "null", "clear", "random", or "time" for the -U option for
mke2fs, which are already allowed options for tune2fs.

Signed-off-by: Drew Davenport <ddavenport@google.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agotests: fix expected output for f_detect_junk
Theodore Ts'o [Thu, 25 May 2017 17:11:40 +0000 (13:11 -0400)]
tests: fix expected output for f_detect_junk

The expect files for f_detect_junk had gotten out of sync with the
code base, and since this test is optional (it depends on libmagic
being installed), we hadn't noticed.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: fix sparse bmap to extent conversion
Darrick J. Wong [Thu, 25 May 2017 01:56:36 +0000 (21:56 -0400)]
e2fsck: fix sparse bmap to extent conversion

When e2fsck is trying to convert a sparse block-mapped file to an extent
file, we incorrectly merge block mappings that are physically contiguous
but not logically contiguous because of insufficient checking with the
extent we're constructing.  Therefore, compare the logical offsets for
contiguity as well.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: correctly subtract xattr blocks on bigalloc filesystems
Eric Biggers [Thu, 25 May 2017 01:48:41 +0000 (21:48 -0400)]
libext2fs: correctly subtract xattr blocks on bigalloc filesystems

ext2fs_inode_data_blocks2() calculates an inode's data block count by
subtracting the external xattr block, if any, from the total blocks.
But on bigalloc filesystems, the xattr "block" is actually a whole
cluster, so ext2fs_inode_data_blocks2() would return a too-large value.

It seems this could have caused several different problems, but the one
I encountered was that xfstest generic/399 failed in the "bigalloc"
config because e2fsck incorrectly considered a symlink on the filesystem
to be corrupted at the end of the test.  This happened because e2fsck
incorrectly calculated a nonzero data block count for a "fast" symlink
with an external xattr block and therefore treated it as a "slow"
symlink, which failed validation.

Fix this by updating ext2fs_inode_data_blocks2() to subtract the cluster
size rather than the block size.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2fsck: fix multiply-claimed block quota accounting when deleting files
Eric Whitney [Thu, 25 May 2017 01:34:20 +0000 (21:34 -0400)]
e2fsck: fix multiply-claimed block quota accounting when deleting files

As e2fsck processes each file in pass1, the actual file system quota is
increased by the number of blocks discovered in the file.  This can
include both non-multiply-claimed and multiply-claimed blocks, if the
latter exist.  However, if a file containing multiply-claimed blocks
is then deleted in pass1b, those blocks are not taken into account when
decreasing the actual quota.  In this case, the new quota values written
to the file system by e2fsck overstate the space actually consumed.
And, e2fsck must be run twice on the file system to fully correct
quota.

Fix this by counting multiply-claimed blocks as a debit to quota when
deleting files in pass1b.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
7 years agoinclude sys/sysmacros.h as needed
Mike Frysinger [Fri, 19 May 2017 17:25:59 +0000 (13:25 -0400)]
include sys/sysmacros.h as needed

The minor/major/makedev macros are not entirely standard.  glibc has had
the definitions in sys/sysmacros.h since the start, and wants to move away
from always defining them implicitly via sys/types.h (as this pollutes the
namespace in violation of POSIX).  Other C libraries have already dropped
them.  Since the configure script already checks for this header, use that
to pull in the header in files that use these macros.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agomisc: fix 'zero_hugefiles = false' regression
Eric Biggers [Mon, 8 May 2017 22:47:57 +0000 (15:47 -0700)]
misc: fix 'zero_hugefiles = false' regression

When mk_hugefiles() was switched to use ext2fs_fallocate(), it was
accidentally changed to ignore the 'zero_hugefiles = false' setting,
which should cause hugefiles to be allocated without initializing their
contents.  Fix this by only passing EXT2_FALLOCATE_ZERO_BLOCKS to
ext2fs_fallocate() when zero_hugefiles is true.

Google-Bug-Id: 38037607
Fixes: 4f868703f6f2 ("libext2fs: use fallocate for creating journals and hugefiles")
Cc: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe2fsck: fix ASAN error when using 128 byte inodes
Theodore Ts'o [Sat, 15 Apr 2017 14:33:53 +0000 (10:33 -0400)]
e2fsck: fix ASAN error when using 128 byte inodes

Due to the inode table buffering, it's actually hard to overrun the
end of allocated memory, so the ASAN error doesn't trigger all the
time.

Google-Bug-Id: 37326362

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe2fsck: allow extent tree optimization to be disabled
Theodore Ts'o [Sat, 15 Apr 2017 13:22:27 +0000 (09:22 -0400)]
e2fsck: allow extent tree optimization to be disabled

Add an extended option, -E no_optimize_extents, as well as a
e2fsck.conf profile option, to disable extent tree optimization.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agotests: add new test f_quota_extent_opt
Theodore Ts'o [Sat, 15 Apr 2017 04:59:11 +0000 (00:59 -0400)]
tests: add new test f_quota_extent_opt

Add a test to validate the changes in commit 403bcb668e4f: "e2fsck:
update quota when optimizing the extent tree".

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe2fsck: update quota when optimizing the extent tree
Theodore Ts'o [Sat, 15 Apr 2017 04:29:46 +0000 (00:29 -0400)]
e2fsck: update quota when optimizing the extent tree

If quota is enabled, optimizing the extent tree wouldn't update the
in-memory quota statistics, so that a subsequent e2fsck run would show
that the quota usage statistics on disk were incorrect.

Google-Bug-Id: 36391645

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe4crypt: fix error handling for KEYCTL_GET_KEYRING_ID
Joe Richey [Mon, 3 Apr 2017 16:52:50 +0000 (16:52 +0000)]
e4crypt: fix error handling for KEYCTL_GET_KEYRING_ID

Due to some interesting behaviour in keyctl (as described in the
comments), we use KEYCTL_GET_KEYRING_ID to translate the special value
of KEY_SPEC_SESSION_KEYRING to a real keyring id. However, how we
currently do this is flawed in two ways.

First, if KEYCTL_GET_KEYRING_ID fails, we don't detect it as it returns
-1 and zero is used for an error value in get_keyring_id. Second, if the
user specifies "-k @s" the translation never runs and the undesireable
behavior occurs.

These are both fixed by doing the translation outside of get_keyring_id.

Signed-off-by: Joe Richey <joerichey@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe2fsck: fix quota accounting to use cluster units
Eric Whitney [Sun, 2 Apr 2017 16:57:05 +0000 (12:57 -0400)]
e2fsck: fix quota accounting to use cluster units

The quota accounting code in e2fsck's pass 1 and pass 3 uses block units
rather than cluster units when recording the allocated space consumed by
files and directories.  In pass 1, this causes a large undercount of
actual quota results and test failures for xfstests generic/383, /384,
/385, and /386 on bigalloc file systems.  In pass 3, this results in
quota accounting errors when the lost+found directory is either extended
or recreated on a bigalloc file system.

Use clusters rather than blocks when accounting for allocated space,
and correct a related header comment in the quota code.

Note that pass 1b also contains call sites for quota_data_sub() that
also need to be addressed.  However, it appears that more than just
unit conversion may be needed, so that will be left to a future patch.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibext2fs: apply LDFLAGS when building tst_inline_data
Eric Biggers [Fri, 17 Mar 2017 22:38:36 +0000 (15:38 -0700)]
libext2fs: apply LDFLAGS when building tst_inline_data

If libext2fs was compiled with an external libblkid pointed to by
LDFLAGS, then linking the tst_inline_data program failed because the
requested linker flags were not used.  Fix this by adding $(ALL_LDFLAGS)
to the build rule, as is done for the other test programs.

Fixes: 31253488385a ("libext2fs: add a unit test for inline data")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe2fsck: fix type mismatches in quota warning message
Eric Whitney [Fri, 31 Mar 2017 23:21:59 +0000 (19:21 -0400)]
e2fsck: fix type mismatches in quota warning message

The conversion operations in the format control strings found in the
fprintf call used to print the quota warning message do not match the
types of their corresponding arguments.  Although this probably hasn't
generally been a problem, it obfuscates a bigalloc quota accounting bug
where the reported actual quota goes negative.

Clean up the mismatches and some unnecessary casts.  While we're at it,
fix a spelling nit in a related comment.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoFix metadata_csum typo in ext4 man page
Justin Bronder [Fri, 31 Mar 2017 14:24:39 +0000 (10:24 -0400)]
Fix metadata_csum typo in ext4 man page

Signed-off-by: Justin Bronder <jsbronder@cold-front.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
7 years agoMerge branch 'next' into debian
Theodore Ts'o [Fri, 3 Mar 2017 15:13:25 +0000 (10:13 -0500)]
Merge branch 'next' into debian

7 years agomisc: fix all the compiler warnings
Darrick J. Wong [Thu, 2 Mar 2017 04:52:12 +0000 (20:52 -0800)]
misc: fix all the compiler warnings

Fix the various compiler warnings that have crept in, and only define
__bitwise if the system headers haven't already done so.  Linux 4.10
changes the __bitwise definition so that our redefinition here is
just different enough that gcc complains.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agotests: fix test failure in f_detect_xfs caused by commit bf615bb0ccad
Theodore Ts'o [Fri, 3 Mar 2017 15:00:17 +0000 (10:00 -0500)]
tests: fix test failure in f_detect_xfs caused by commit bf615bb0ccad

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoMerge branch 'next' into debian
Theodore Ts'o [Wed, 1 Mar 2017 20:26:35 +0000 (15:26 -0500)]
Merge branch 'next' into debian

7 years agolibext2fs: readahead for meta_bg
Alexey Lyashkov [Wed, 1 Mar 2017 20:03:54 +0000 (15:03 -0500)]
libext2fs: readahead for meta_bg

There are ~37k of random IOs with meta_bg option on 300T target.
Debugfs requires 20 minutes to be started. Enabling readahead for
group blocks metadata save time dramatically. Only 12s to start.

Signed-off-by: Alexey Lyashkov <alexey.lyashkov@seagate.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
7 years agoe2fsck: report the exit value in the logfile
Theodore Ts'o [Wed, 1 Mar 2017 19:33:45 +0000 (14:33 -0500)]
e2fsck: report the exit value in the logfile

If e2fsck logging is enabled, report the exit value as the last line
in the log file.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopo: update uk.po (from translationproject.org)
Yuri Chornoivan [Mon, 20 Feb 2017 02:45:43 +0000 (21:45 -0500)]
po: update uk.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopo: update sv.po (from translationproject.org)
Göran Uddeborg [Mon, 20 Feb 2017 02:45:43 +0000 (21:45 -0500)]
po: update sv.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Mon, 20 Feb 2017 02:45:42 +0000 (21:45 -0500)]
po: update pl.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopo: update nl.po (from translationproject.org)
Benno Schulenberg [Mon, 20 Feb 2017 02:45:42 +0000 (21:45 -0500)]
po: update nl.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopo: update fr.po (from translationproject.org)
Samuel Thibault [Mon, 20 Feb 2017 02:45:42 +0000 (21:45 -0500)]
po: update fr.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopo: update es.po (from translationproject.org)
Antonio Ceballos [Mon, 20 Feb 2017 02:45:42 +0000 (21:45 -0500)]
po: update es.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopo: update da.po (from translationproject.org)
Joe Hansen [Mon, 20 Feb 2017 02:45:42 +0000 (21:45 -0500)]
po: update da.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agopo: update cs.po (from translationproject.org)
Petr Pisar [Mon, 20 Feb 2017 02:45:42 +0000 (21:45 -0500)]
po: update cs.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agodebugfs: better support of superblocks with bad checksums
Theodore Ts'o [Mon, 20 Feb 2017 02:08:21 +0000 (21:08 -0500)]
debugfs: better support of superblocks with bad checksums

Allow debugfs to open file systems with a bad checksum, and teach the
show_super_stats command to print the expected checksum value.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoDo interim update of RELEASE NOTES
Theodore Ts'o [Fri, 17 Feb 2017 20:18:10 +0000 (15:18 -0500)]
Do interim update of RELEASE NOTES

7 years agoe2fsck: make problem comments match error messages
Andreas Dilger [Fri, 17 Feb 2017 17:57:29 +0000 (12:57 -0500)]
e2fsck: make problem comments match error messages

Since the @x compression obscures e2fsck problem error messages
from being found by normal searching, make the comment for each
error match the actual error message so that they can be found
more easily.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe2fsck: don't check inode flag values for deleted inodes
Theodore Ts'o [Fri, 17 Feb 2017 15:42:17 +0000 (10:42 -0500)]
e2fsck: don't check inode flag values for deleted inodes

Commit 47b8941774df "e2fsck: make sure system.data xattr is present"
exposed a bug in e2fsck's pass 1 handling which caused the xfstests's
generic/079 to fail if the inline_data feature was enabled.  The
problem was that e2fsck was checking if an inode with inline data had
the system.xattr EA before checking to see if that inode was still in
use --- and this invariant isn't necessarily true for deleted inodes.
There were a number of other checks that were done too early that
could also potentially cause false positive complaints, although those
would normally only happen if a now-unused portion of the inode table
had gotten corrupted, or if tune2fs had disabled a particular file
system feature and there old, deleted inodes that had values
inconsistent with the new file system configuration.

Reported-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoe2fsck: exit with exit status 0 if no errors were fixed
Theodore Ts'o [Fri, 17 Feb 2017 03:02:35 +0000 (22:02 -0500)]
e2fsck: exit with exit status 0 if no errors were fixed

Previously, e2fsck would exit with a status code of 1 even though the
only changes that it made to the file system were various
optimziations and not fixing file system corruption.  Since the man
page states that an exit status of 1 means "file system errors
corrupted", fix e2fsck to return an exit status of 0.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoRefactor code to print journal superblock information
Theodore Ts'o [Thu, 16 Feb 2017 23:54:41 +0000 (18:54 -0500)]
Refactor code to print journal superblock information

Move the code to list the journal superblock information to libe2p, so
it can be used by debugfs, and so we don't have two copies of
substantially the same code in dumpe2fs.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibext2fs: remove unused jfs_dat.h file
Theodore Ts'o [Thu, 16 Feb 2017 20:11:23 +0000 (15:11 -0500)]
libext2fs: remove unused jfs_dat.h file

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agodebugfs: with ls -l, include space between size and date
Eric Biggers [Mon, 13 Feb 2017 00:01:40 +0000 (16:01 -0800)]
debugfs: with ls -l, include space between size and date

Before:
     11   40700 (2)      0      0   1228812-Feb-2017 12:51 lost+found

After:
     11   40700 (2)      0      0   12288 12-Feb-2017 12:51 lost+found

Fixes: 68a1de3df340 ("debugfs: pretty print encrypted filenames in the ls command")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
7 years agodebugfs.8: fix name of argument to blocks command
Eric Biggers [Mon, 13 Feb 2017 00:00:09 +0000 (16:00 -0800)]
debugfs.8: fix name of argument to blocks command

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agolibsupport: remove debugging printf() from parse_qtype.c
Theodore Ts'o [Thu, 16 Feb 2017 16:19:51 +0000 (11:19 -0500)]
libsupport: remove debugging printf() from parse_qtype.c

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agotests: don't use "debugfs -f /dev/stdin"
Theodore Ts'o [Thu, 16 Feb 2017 16:15:34 +0000 (11:15 -0500)]
tests: don't use "debugfs -f /dev/stdin"

Don't use "debugfs -f /dev/stdin" for portability reasons --- not all
systems have /dev/stdin.  Simply dropping "-f /dev/stdin" works just
fine.

Reported-by: Rical Jasan <ricaljasan@pacific.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agomke2fs: remove the -f option from the man page
John Haxby [Wed, 8 Feb 2017 15:26:38 +0000 (15:26 +0000)]
mke2fs: remove the -f option from the man page

The -f option was removed in c6ed60cdeb13 (mke2fs: support creating
bigalloc file systems), let's remove it from the man page as well.
And as it was the only noted bug, take the BUGS section with it.

Signed-off-by: John Haxby <john.haxby@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoAdd debian packaging for tune2fs-fix-quota-enablement-regression
Theodore Ts'o [Mon, 6 Feb 2017 02:08:45 +0000 (21:08 -0500)]
Add debian packaging for tune2fs-fix-quota-enablement-regression

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 years agoMerge branch 'debian' into debian-packaging
Theodore Ts'o [Mon, 6 Feb 2017 02:02:20 +0000 (21:02 -0500)]
Merge branch 'debian' into debian-packaging