Whamcloud - gitweb
tools/e2fsprogs.git
5 years agoMerge branch 'old-maint' into maint
Theodore Ts'o [Sun, 17 Mar 2019 22:50:20 +0000 (18:50 -0400)]
Merge branch 'old-maint' into maint

5 years agoFix "make install-strip"
Theodore Ts'o [Sun, 17 Mar 2019 22:46:26 +0000 (18:46 -0400)]
Fix "make install-strip"

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: drop lvm2 from the recommends line
Theodore Ts'o [Mon, 11 Mar 2019 00:01:58 +0000 (20:01 -0400)]
debian: drop lvm2 from the recommends line

If the user doesn't intend to use lvm2, and it's not installed,
installing e2fsprogs shouldn't drag it (and all of its dependencies)
into the system.

Addresses-Debian-Bug: 924275

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2scrub: check to make sure lvm2 is installed
Theodore Ts'o [Sun, 10 Mar 2019 23:41:11 +0000 (19:41 -0400)]
e2scrub: check to make sure lvm2 is installed

Not all systems will have the lvm2 package installed, so check for
that.  Pretty much all systems should have util-linux installed, but
check for that as well.

Of course, if lvm2 is installed we shouldn't find any LVM devices ---
but eventually the Demon Murphy will find a way to make it happen. :-)

Also, set the PATH so we don't have to worry about the script failing
due to /sbin not being in the path.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoMerge branch 'old-maint' into maint
Theodore Ts'o [Thu, 7 Mar 2019 21:18:10 +0000 (16:18 -0500)]
Merge branch 'old-maint' into maint

5 years agoFix autoheader warnings
Dongyang Li [Wed, 6 Mar 2019 22:59:55 +0000 (22:59 +0000)]
Fix autoheader warnings

autoheader complains after 1.44.6 release:
autoheader: warning: missing template: HAVE_BLKID_PROBE_ENABLE_PARTITIONS
autoheader: Use AC_DEFINE([HAVE_BLKID_PROBE_ENABLE_PARTITIONS], [], [Description])
autoheader: warning: missing template: HAVE_BLKID_PROBE_GET_TOPOLOGY

This could fail automatic rpm builds.
Fixes: 7154d97 ("Check for the newer blkid functions without adding blkid to @LIBS@")

Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoUpdate release notes, etc., for the 1.45.0 release v1.45.0
Theodore Ts'o [Wed, 6 Mar 2019 18:23:53 +0000 (13:23 -0500)]
Update release notes, etc., for the 1.45.0 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2scrub: install the crontab file in /etc/cron.d w/o the .cron extension
Theodore Ts'o [Thu, 7 Mar 2019 05:38:52 +0000 (00:38 -0500)]
e2scrub: install the crontab file in /etc/cron.d w/o the .cron extension

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2scrub: make e2scrub_fail's e-mail addresses be configurable
Theodore Ts'o [Thu, 7 Mar 2019 04:46:20 +0000 (23:46 -0500)]
e2scrub: make e2scrub_fail's e-mail addresses be configurable

Allow the sender and recipient e-mail addresses be configurable from
/etc/e2scrub.conf.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2scrub: add missing Documentation links to systemd unit files
Theodore Ts'o [Thu, 7 Mar 2019 02:27:12 +0000 (21:27 -0500)]
e2scrub: add missing Documentation links to systemd unit files

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agomisc: fix spelling error
Theodore Ts'o [Thu, 7 Mar 2019 02:17:10 +0000 (21:17 -0500)]
misc: fix spelling error

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoscrub/Makefile.in: install the udev rule and crontab file as data files
Theodore Ts'o [Thu, 7 Mar 2019 01:09:37 +0000 (20:09 -0500)]
scrub/Makefile.in: install the udev rule and crontab file as data files

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoDon't use a symlink for config/ltmain.sh
Theodore Ts'o [Thu, 7 Mar 2019 01:06:26 +0000 (20:06 -0500)]
Don't use a symlink for config/ltmain.sh

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoFix "make clean" so it removes all generated files in the scrub directory
Theodore Ts'o [Wed, 6 Mar 2019 18:18:57 +0000 (13:18 -0500)]
Fix "make clean" so it removes all generated files in the scrub directory

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoUpdate Makefile.in files using "make depend"
Theodore Ts'o [Wed, 6 Mar 2019 18:14:19 +0000 (13:14 -0500)]
Update Makefile.in files using "make depend"

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotests: add test for e2image -b option
Artem Blagodarenko [Wed, 6 Mar 2019 16:57:00 +0000 (11:57 -0500)]
tests: add test for e2image -b option

The test makes raw image from partition with broken super block
and executes e2fsck.

Signed-off-by: Artem Blagodarenko <c17828@cray.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2image: add -b and -B options to specify where to find the superblock
Artem Blagodarenko [Wed, 6 Mar 2019 16:52:13 +0000 (11:52 -0500)]
e2image: add -b and -B options to specify where to find the superblock

e2image has no ability to use superblock backup to copy metadata.
This feature can be useful if someone wants to make partition
image and fix it using e2fsck utility.

New -b option allows to pass superblock number, like e2fsck utility does.
e2image doesn't change primary superblock and store it as is, so
it can be fixed using e2fsck latter. Option -B allows setting
superblock size.

Signed-off-by: Artem Blagodarenko <c17828@cray.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoMerge branch 'maint' into next
Theodore Ts'o [Wed, 6 Mar 2019 05:06:42 +0000 (00:06 -0500)]
Merge branch 'maint' into next

5 years agoUpdate release notes, etc., for the 1.44.6 release v1.44.6
Theodore Ts'o [Tue, 5 Mar 2019 19:54:16 +0000 (14:54 -0500)]
Update release notes, etc., for the 1.44.6 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoAOSP: misc: use scandir with alphasort instead of readdir for consistency
Yoshitaka Seto [Wed, 16 Jan 2019 08:47:48 +0000 (17:47 +0900)]
AOSP: misc: use scandir with alphasort instead of readdir for consistency

During the image generation, When using the e2fsdroid with src_dir,
then dir files are listed with readdir, which will not guarantee
the order across the machines/fielsystems. So instead using the
scandir with alphasort option to list the files in sorted order.

Bug: 122874817

Change-Id: I4b946c737319252b82c74a0e10360843503862a1
From AOSP commit: 4cbe059b48b46d6657e24e4cdef543da7537dba3

Reported-by: Yasuhiro Kubota <yasuhiro.1.kubota@sony.com>
Tested-by: Yasuhiro Kubota <yasuhiro.1.kubota@sony.com>
Signed-off-by: Vikram Dattu Thota <vikram.dattu@sony.com>
Signed-off-by: Takuya Ogawa <takuya.ogawa@sony.com>
Signed-off-by: Yoshitaka Seto <yoshitaka.seto@sony.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoAOSP: Fix file offset overflow issue when file's size > 4G
Chen Lin Z [Mon, 10 Dec 2018 07:31:40 +0000 (15:31 +0800)]
AOSP: Fix file offset overflow issue when file's size > 4G

fs->blocksize is int(4 bytes), while data is off_t(8 bytes),
'data_blk = data & ~(fs->blocksize - 1)' will cause data_blk
lose high 4 bytes of data if data > 4G and it'll cause file
inconsistent when using -d option to populate ext4 image file.

[ This was also fixed upstream via 1eec7413677e: "create_inode: fix
  copying large files".  This commit is just to clean up
  whitespace/formatting issues. -- tytso ]

Signed-off-by: Chen Lin Z <lin.z.chen@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
From AOSP commit: 999dd56f2586fadec7bfe846b8cb52c5e528248f

5 years agolibext2fs: revert "try to always use PUNCH_HOLE for unix_discard"
Darrick J. Wong [Thu, 14 Feb 2019 21:02:33 +0000 (16:02 -0500)]
libext2fs: revert "try to always use PUNCH_HOLE for unix_discard"

Revert bcca9876a3428c10417c660b78933e6e70e8a5f5, because
fallocate(PUNCH_HOLE) on block devices was changed to use zeroout
instead of discard shortly after block device fallocate was merged.
zeroout isn't necessarily a "drop storage" operation like discard is,
so we prefer to use that on block devices.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agocreate_inode: fix potential memory leak in path_append()
Lukas Czerner [Mon, 11 Feb 2019 17:00:10 +0000 (12:00 -0500)]
create_inode: fix potential memory leak in path_append()

If realloc() fails in path_append() we will lose a memory pointed to by
target->path.  Fix it.

path_append() is used by mke2fs and e2fsdroid.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2freefrag: fix memory leak in scan_online()
Lukas Czerner [Mon, 11 Feb 2019 16:52:50 +0000 (11:52 -0500)]
e2freefrag: fix memory leak in scan_online()

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoMerge branch 'maint' into next
Theodore Ts'o [Mon, 11 Feb 2019 02:50:26 +0000 (21:50 -0500)]
Merge branch 'maint' into next

5 years agoCheck for the newer blkid functions without adding blkid to @LIBS@
Theodore Ts'o [Mon, 11 Feb 2019 02:44:05 +0000 (21:44 -0500)]
Check for the newer blkid functions without adding blkid to @LIBS@

If we are using the system-provided blkid, check for the newer blkid
functions without adding -lblkid to @LIBS@.  This prevents programs
(like badblocks) which don't use the blkid library getting linked
against it.

Addresses-Debian-Bug: #919958
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoAOSP: E2fsprogs: fix ODR issue
Andreas Gampe [Wed, 30 Jan 2019 02:07:55 +0000 (18:07 -0800)]
AOSP: E2fsprogs: fix ODR issue

Do not use whole_static_libs and shared_libs at the same time. Fix
up clients.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Bug: 123590866
Test: mmma external/e2fsprogs
Change-Id: I36d184dd878de2beacbb17c306e47076b44d68bb
From AOSP commit: fece156b105719c782351e447298de073d4dab04

5 years agoAOSP: e2fsdroid: Fix incorrect error value handling.
David Anderson [Thu, 24 Jan 2019 02:49:23 +0000 (18:49 -0800)]
AOSP: e2fsdroid: Fix incorrect error value handling.

Methods returning 0 or -1 should not pass their return value to com_err.
Also, errno values should not be negated when passed to com_err or
through errcode_t.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Bug: N/A
Test: manual test

Change-Id: I5e25cf2deeee72668bf0ab58337ee582bf14bbc1
From AOSP commit: 0468e33fba75dbf60877ef14ecee7b0b60f756df

5 years agoAOSP: Build filefrag
Sandeep Patil [Wed, 26 Dec 2018 23:10:24 +0000 (15:10 -0800)]
AOSP: Build filefrag

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Bug: 121211685
Test: mma -j with lunch aosp_blueline-userdebug

Change-Id: If8cffae8168990a11e8228b9f00d2fee15924935
Signed-off-by: Sandeep Patil <sspatil@google.com>
From AOSP commit: 0393dd541c79dfda1475ef071a31215dd2811162

5 years agocreate_inode: fix copying large files
Ross Burton [Thu, 7 Feb 2019 16:05:13 +0000 (11:05 -0500)]
create_inode: fix copying large files

When copying large files into a ext filesystem at mkfs time the copy
fails at 2^31 bytes in.  There are two problems:

copy_file_chunk() passes an offset (off_t, 64-bit typically) to
ext2fs_file_lseek() which expects a ext2_off_t (typedef to __u32) so
the value is truncated. Solve by calling ext2fs_file_llseek() which
takes a u64 offset instead.

try_lseek_copy() rounds the data and hole offsets as found by lseek()
to block boundaries, but the calculation gets truncated to 32-bits.
Solve by casting the 32-bit blocksize to off_t to ensure this doesn't
happen.

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
5 years agodebugfs: output large directory size
Artem Blagodarenko [Tue, 5 Feb 2019 22:10:05 +0000 (17:10 -0500)]
debugfs: output large directory size

large_dir option allows to create directory with size > 2GB.
debugfs utility outputs negative size value for large directories
and ignores high part of directory size.

Fix debugfs to use high part of directory size in debugfs output
and use appropriate output format.

Signed-off-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2fsck: allow to check >2GB sized directory
Artem Blagodarenko [Tue, 5 Feb 2019 22:09:16 +0000 (17:09 -0500)]
e2fsck: allow to check >2GB sized directory

After large_dir feature has been added, e2fsprogs is
ready for directories > 2GB, so we can remove e2fsck
directory size check.

Signed-off-by: Artem Blagodarenko <artem.blagodarenko@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
5 years agoMerge branch 'maint' into next
Theodore Ts'o [Wed, 30 Jan 2019 04:17:08 +0000 (23:17 -0500)]
Merge branch 'maint' into next

5 years agolibext2fs: add checks for block number wrapping for bitmap range functions
Theodore Ts'o [Wed, 30 Jan 2019 04:07:27 +0000 (23:07 -0500)]
libext2fs: add checks for block number wrapping for bitmap range functions

This fixes potential seg faults when opening a fuzzed file system with
block group descriptors containing a bogus inode table location.

Google-Bug-Id: 119929050
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibext2fs: validate inode table location in block group descriptors
Theodore Ts'o [Wed, 30 Jan 2019 03:49:29 +0000 (22:49 -0500)]
libext2fs: validate inode table location in block group descriptors

Make sure the inode table location is a valid block number.

Google-Bug-Id: 119171089
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agomke2fs: fix bugs in hugefile creation
Theodore Ts'o [Fri, 25 Jan 2019 03:35:15 +0000 (22:35 -0500)]
mke2fs: fix bugs in hugefile creation

For certain sizes mke2fs's hugefile creation would fail with the error:

mke2fs: Could not allocate block in ext2 filesystem while creating huge file 0

This would happen because we had failed to reserve enough space for
the metadata blocks for the hugefile.  There were two problems:

1) The overhead calculation function failed to take into account the
cluster size for bigalloc file systems.

2) In the case where num_blocks is 0 and num_files is 1, the overhead
calculation function was passed a size of 0, which caused the
calculated overhead to be zero.

Google-Bug-Id: 123239032
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe4defrag: adjust total count when files change during the run
Theodore Ts'o [Fri, 4 Jan 2019 04:06:42 +0000 (23:06 -0500)]
e4defrag: adjust total count when files change during the run

If files are created while e4defrag is running, it's quite possible
for succeed_cnt to be larger than total_count, in which case the
number of failures (calculated via total_count - succeed_cnt) will
overflow and become a very large unsigned number.

The way we calculate statistics is a bit silly, since when recurse
into directories is counted, it's counted as a "failure".  But we'll
ignore this from now, and avoid the unsigned overflow.

Address-Debian-Bug: #888899

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoRevert "e4defrag: use 64-bit counters to track # files defragged"
Theodore Ts'o [Fri, 4 Jan 2019 03:27:37 +0000 (22:27 -0500)]
Revert "e4defrag: use 64-bit counters to track # files defragged"

This reverts commit 3293ea9ecbe1d622f9cf6c41d705d82fbae6a3e3.

This wasn't really the right fix, since there can't be more than 2**32
files in a file system.  The real issue is when the number of files in
a directory change during the e4defrag run.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotests: generate test_data.tmp file from a script
Theodore Ts'o [Thu, 3 Jan 2019 19:10:32 +0000 (14:10 -0500)]
tests: generate test_data.tmp file from a script

Even if the debugfs executable is not sparse, it might contain a 1k
aligned block which is all zeros, which when written into a 1k block
file system by a test like d_loaddump will result in a sparse file and
causing one or more test failures.

Google-Bug-Id: 122085761
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoFix various types in the v1.44.5 changelogs
Theodore Ts'o [Tue, 18 Dec 2018 06:04:25 +0000 (01:04 -0500)]
Fix various types in the v1.44.5 changelogs

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: move source.lintian-overrides from deprecated location
Theodore Ts'o [Tue, 18 Dec 2018 06:02:54 +0000 (01:02 -0500)]
debian: move source.lintian-overrides from deprecated location

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: add Build-Depend-Package to the symbol files
Theodore Ts'o [Tue, 18 Dec 2018 06:01:24 +0000 (01:01 -0500)]
debian: add Build-Depend-Package to the symbol files

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoMerge branch 'maint' into next
Theodore Ts'o [Sun, 16 Dec 2018 05:46:24 +0000 (00:46 -0500)]
Merge branch 'maint' into next

5 years agoUpdate release notes, etc., for the 1.44.5 release v1.44.5
Theodore Ts'o [Sun, 16 Dec 2018 04:05:58 +0000 (23:05 -0500)]
Update release notes, etc., for the 1.44.5 release

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: create changelog for v1.44.5
Theodore Ts'o [Sat, 15 Dec 2018 18:15:10 +0000 (13:15 -0500)]
debian: create changelog for v1.44.5

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: fix up libext2fs-dev.doc-base
Theodore Ts'o [Sun, 16 Dec 2018 04:21:58 +0000 (23:21 -0500)]
debian: fix up libext2fs-dev.doc-base

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoAOSP: ODR violation in tune2fs during host build
Mark Salyzyn [Thu, 25 Oct 2018 20:00:51 +0000 (13:00 -0700)]
AOSP: ODR violation in tune2fs during host build

Port of commit 3271c69c97f486914fea833a36eaf5d86938c76d as applied to
e2fsck, but to tune2fs.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Bug: 112062612
Bug: 111302946
Test: $ m SANITIZE_HOST=address out/host/linux-x86/bin/tune2fs
      $ out/host/linux-x86/bin/tune2fs --help
Change-Id: If49d367d96b7bfd0b8b79c6bde23c0ded52ca683
From AOSP commit: 1cb5de330e5d1e0c6f587945ec065b995cc1c84b

5 years agoe2fsck: use "Optimize?" prompt for PR_1E_CAN_{COLLAPSE,NARROW}_EXTENT_TREE
Theodore Ts'o [Sun, 16 Dec 2018 03:13:41 +0000 (22:13 -0500)]
e2fsck: use "Optimize?" prompt for PR_1E_CAN_{COLLAPSE,NARROW}_EXTENT_TREE

If e2fsck can optimize an inode's extent tree, it should ask for
permission to optimize it, not to "fix" it.  This was causing some
confusion, since some users interpreted this prompt as an indication
that the file system was inconsistent.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebugfs: fix set_inode_field so it can set the checksum field
Theodore Ts'o [Thu, 13 Dec 2018 05:53:16 +0000 (00:53 -0500)]
debugfs: fix set_inode_field so it can set the checksum field

Previously, setting the inode field was a no-op, since the library
function ext2fs_write_inode_full() would override whatever value was
set by debugfs.  Use the new ext2fs_write_inode2() interface so we can
in fact set the checksum to a potentially wrong value.  Also, ignore
the inode checksum failures if we are setting the checksum, and if the
checksum value is "calc", set the inode checksum to the correct value.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: update to Debian policy 4.2.1
Theodore Ts'o [Sat, 15 Dec 2018 17:05:16 +0000 (12:05 -0500)]
debian: update to Debian policy 4.2.1

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe4defrag: use 64-bit counters to track # files defragged
Theodore Ts'o [Sat, 15 Dec 2018 15:08:42 +0000 (10:08 -0500)]
e4defrag: use 64-bit counters to track # files defragged

Addresses-Debian-Bug: 888899

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibext2fs: add ext2fs_{read,write}_inode2()
Theodore Ts'o [Thu, 13 Dec 2018 05:51:51 +0000 (00:51 -0500)]
libext2fs: add ext2fs_{read,write}_inode2()

Add new library interface which allows the caller to control whether
the inode checksum should be checked on inode read, or set on inode
write.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoMerge branch 'maint' into next
Theodore Ts'o [Wed, 12 Dec 2018 03:33:42 +0000 (22:33 -0500)]
Merge branch 'maint' into next

5 years agomisc: fix groff formatting nits in man pages
Bjarni Ingi Gislason [Tue, 11 Dec 2018 01:49:22 +0000 (01:49 +0000)]
misc: fix groff formatting nits in man pages

Change a two-fonts macro to a one-font one, when there is only one
genuine argument.

Separate a punctuation mark or a section number from the only argument
to make two for a two-fonts macro.

Remove an unneeded escape in front of a horizontal tab character.

Correct the unit for distance from 'in' to 'i'.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebian: fix location of libext2fs documentation
Theodore Ts'o [Wed, 12 Dec 2018 03:20:52 +0000 (22:20 -0500)]
debian: fix location of libext2fs documentation

Addresses-Debian-Bug: #915942
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2fsprogs: introduce script used to generate utf8data.h
Gabriel Krisman Bertazi [Mon, 3 Dec 2018 23:04:28 +0000 (18:04 -0500)]
e2fsprogs: introduce script used to generate utf8data.h

The mkutf8data program was written by SGI for the kernel. We integrate
it here, but it should be kept in sync with the kernel code, when
applicable.  The header generated by this script is also included in
this repository, such that we don't have to carry the UCD files too.
They are only necessary when the header has to be recreated (for
instance, to update the Unicode version supported)

The mkutf8data is not a dependency of utf8data.h because we don't want
the utf8data.h rule to be called after a make clean that would remove
mkutf8data.  It is simpler to call it from inside the rule, and make
sure we only trigger the utf8data.h rule if we really need to,
particularly if we decide not to integrate the ucd files in the tree.

The UCD files are not distributed along with this commit, but we add
information on how to fetch them.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibext2fs: fix regression so we are correctly translating Posix ACL's
Theodore Ts'o [Fri, 7 Dec 2018 03:44:45 +0000 (22:44 -0500)]
libext2fs: fix regression so we are correctly translating Posix ACL's

The commit 50d0998cfee ("libext2fs: add ea_inode support to set
xattr") broke the fix that was addressed in commit 0ee1eaf70c25
("libext2fs: translate internal ext4 acl to Posix ACL in
ext2fs_xattr_[sg]et()").  This was because although we calculated what
the correct on-disk ACL representation would be, we didn't actually
*store* it, but instead stored the passed-in Posix ACL memory
representation instead.

Addresses-Launchpad-Bug: #1807288
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoext4.5: add fname_encoding feature to ext4 man page
Gabriel Krisman Bertazi [Sat, 1 Dec 2018 00:42:23 +0000 (19:42 -0500)]
ext4.5: add fname_encoding feature to ext4 man page

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoext2fs: nls: support UTF-8 11.0 with NFKD normalization
Gabriel Krisman Bertazi [Sat, 1 Dec 2018 00:42:22 +0000 (19:42 -0500)]
ext2fs: nls: support UTF-8 11.0 with NFKD normalization

We need this such that we can do normalization and casefolding
compatible with the kernel, in order to properly support fsck
verification and rehashing.

The UTF-8 11.0 implementation is copied and adapted from the kernel code
to ensure maximum compatibility.  The decode trie in utf8data.h is
generated using a script and the UCD sources in the kernel code.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotune2fs: prevent enabling encryption flag on encoding-aware fs
Gabriel Krisman Bertazi [Sat, 1 Dec 2018 00:39:08 +0000 (19:39 -0500)]
tune2fs: prevent enabling encryption flag on encoding-aware fs

The kernel will refuse to mount filesystems with the encryption and
encoding features enabled at the same time.  The encoding feature can
only be set at mke2fs time, so we can just prevent encryption from being
set at a later time by tune2fs.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agodebugfs: support encoding when printing the file hash
Gabriel Krisman Bertazi [Sat, 1 Dec 2018 00:39:07 +0000 (19:39 -0500)]
debugfs: support encoding when printing the file hash

Implement two parameters -e and -c, to specify encoding and casefold
when printing the hash of a given file.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibext2fs: support encoding when calculating dx hashes
Gabriel Krisman Bertazi [Sat, 1 Dec 2018 00:39:06 +0000 (19:39 -0500)]
libext2fs: support encoding when calculating dx hashes

fsck must be aware of the superblock encoding and the casefold directory
setting, such that it is able to correctly calculate the dentry hashes.

[ Changed to use a stack-allocated buffer instead of a calling
  calloc() with a fixed size -- TYT ]

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibext2fs: implement NLS framework support
Gabriel Krisman Bertazi [Sat, 1 Dec 2018 00:39:05 +0000 (19:39 -0500)]
libext2fs: implement NLS framework support

Basic NLS support is required in e2fsprogs because of fsck, which
needsto calculate dx hashes for encoding aware filesystems.  this patch
implements this infrastructure as well as ascii support.

We don't need to do all the dance of versioning as we do in the kernel,
because we know before-hand which encodings and versions we
support (those we know how to store in the sb), so it is simpler just to
create static tables.

This version only has support for ASCII; we'll add support for Unicode
later.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agochattr/lsattr: support casefold attribute
Gabriel Krisman Bertazi [Sat, 1 Dec 2018 00:39:04 +0000 (19:39 -0500)]
chattr/lsattr: support casefold attribute

This flag can be set on directories to request insensitive file name
lookups.

I used the letter 'F', referring to "caseFold" for lack of a better
option.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agomke2fs: configure encoding during superblock initialization
Gabriel Krisman Bertazi [Sat, 1 Dec 2018 00:39:03 +0000 (19:39 -0500)]
mke2fs: configure encoding during superblock initialization

This patch implements two new extended options to mkefs, allowing the
user to specify an encoding for file name operations and encoding flags
during filesystem creation.  We provide default flags for each encoding,
which the user can overwrite by passing -E fname_encoding-flags to mkfs.

If the user doesn't specify an encoding, the default value from
options.fname_encoding in mke2fs.conf.in file will be used.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibe2p: helpers for configuring the encoding superblock fields
Gabriel Krisman Bertazi [Sat, 1 Dec 2018 00:39:02 +0000 (19:39 -0500)]
libe2p: helpers for configuring the encoding superblock fields

Implement helper functions to convert the encoding name and specific
parameters requested by the user on the command line into the format
that is written to disk.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agolibext2fs: update tst_super_size to include new superblock fields
Theodore Ts'o [Mon, 3 Dec 2018 04:30:53 +0000 (23:30 -0500)]
libext2fs: update tst_super_size to include new superblock fields

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoMerge branch 'maint' into next
Theodore Ts'o [Mon, 26 Nov 2018 17:37:41 +0000 (12:37 -0500)]
Merge branch 'maint' into next

5 years agoe2freefrag: fix free blocks count during live scan
Darrick J. Wong [Thu, 8 Nov 2018 18:44:31 +0000 (10:44 -0800)]
e2freefrag: fix free blocks count during live scan

In e2freefrag live scan mode, we take the free block count from the
ondisk superblock.  This leads to screwy histogram percentages:

Extent Size Range :  Free extents   Free Blocks  Percent
    4M...    8M-  :             5          8234    1.05%
   64M...  128M-  :             2         52279    6.64%
  512M... 1024M-  :             1        202752   25.74%

...because there could be superblock updates in the journal that haven't
yet been checkpointed.  The online scan is perfectly capable of tallying
the free blocks on its own, so teach it do that and make a more accurate
report.

Reported-by: Elana Hashman <Elana.Hashman@twosigma.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agotune2fs: fix false warning that a UUID change will take a long time
Theodore Ts'o [Sat, 24 Nov 2018 03:34:31 +0000 (22:34 -0500)]
tune2fs: fix false warning that a UUID change will take a long time

If the file system only has the flex_bg feature enabled (with out the
metadata_csum feature enabled), it won't take a long time time fix up
the checksums after changing the UUID.  While it does need to
recalculate all of the checksums in the block group descriptors, that
doesn't take a long time.

Also, if the ea_data feature is enabled, changing the UUID will also
take a long time, and we weren't warning the user about that case.

Fix up the warning message so it doesn't mislead people, and is more
accurate.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agomk_cmds: don't use explicit pathname for sed
Theodore Ts'o [Thu, 22 Nov 2018 23:01:56 +0000 (18:01 -0500)]
mk_cmds: don't use explicit pathname for sed

$AWK doesn't use an explicit pathname, and it's perfectly fine to
assume that awk and sed are in the user's PATH.  The problem with
using an explicit pathname is that Debian currently allows merged and
non-merged /usr.  Avoid using an explicit pathname to prevent
potential problems.

Addresses-Debian-Bug: #914087
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoext2fs: add byte swapping of new superblock fields for BE machines
Gabriel Krisman Bertazi [Wed, 21 Nov 2018 00:11:27 +0000 (19:11 -0500)]
ext2fs: add byte swapping of new superblock fields for BE machines

New superblock fields must be byte swapped before being accessed in Big
Endian machines.

Not tested on an actual BE machine.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoReserve feature bit and SB field bit for filename encoding
Gabriel Krisman Bertazi [Mon, 19 Nov 2018 04:12:48 +0000 (23:12 -0500)]
Reserve feature bit and SB field bit for filename encoding

The s_encoding field in the superblock stores a magic number indicating
the encoding format and version used globally by file and directory
names in the filesystem.

The s_encoding_flags defines policies for using the charset encoding,
like how to handle invalid sequences and what kind of normalization to
use.

A feature flag is also allocated to indicate whether this filesystem has
encoding awareness enabled.

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoAdd timestamp extension bits to superblock
Gabriel Krisman Bertazi [Mon, 19 Nov 2018 03:31:10 +0000 (22:31 -0500)]
Add timestamp extension bits to superblock

Re-sync the superblock structure declaration with its kernel counterpart
to include the fields added by kernel commit 6a0678a79bb3 ("ext4: super:
extend timestamps to 40 bits")

Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2scrub: fix systemd escaping again
Darrick J. Wong [Mon, 5 Nov 2018 17:59:46 +0000 (09:59 -0800)]
e2scrub: fix systemd escaping again

Apparently newer versions of systemd than the one on this author's
laptop <cough> now complain about lack of (path) escaping in unit
instance variable contents:

 # e2scrub_all
 Scrubbing /home...
 Invalid unit name "e2scrub@/home" was escaped as "e2scrub@-home"
 (maybe you should use systemd-escape?)
 Starting Online ext4 Metadata Check for /home...

So change the escape_path_for_systemd function to escape paths
unconditionally to make the warning go away.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
5 years agoe2fsck: check xattr 'system.data' before setting inline_data feature
Li Dongyang [Tue, 13 Nov 2018 04:46:03 +0000 (15:46 +1100)]
e2fsck: check xattr 'system.data' before setting inline_data feature

ext2fs_inline_data_size will happy return 0 and set size to
EXT4_MIN_INLINE_DATA_SIZE even when inode doesn't have
xattr 'system.data', a corrupted i_flags could make e2fsck
enable the inline_data on the superblock.

We should only offer to enable inline_data when i_flags is set
and xattr 'system.data' can be found.

Also use correct prompt for PR_1_INLINE_DATA_FEATURE.

Signed-off-by: Li Dongyang <dongyangli@ddn.com>
6 years agolibext2fs: refactor code which fixes up the checksums in an extent tree
Theodore Ts'o [Sun, 21 Oct 2018 13:32:37 +0000 (09:32 -0400)]
libext2fs: refactor code which fixes up the checksums in an extent tree

The code to recalculate the checksums in an extent tree (which is
needed after an inode is relocated so it has a different inode number)
was duplicated in tune2fs and resize2fs.  In addition, this work could
be done in a much more efficient way inside lib/ext2fs/extent.c.

This commit creates a new library function which corrects the
checksums in an inode's extent tree, named: ext2fs_fix_extents_checksums()

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoMerge branch 'maint' into next
Theodore Ts'o [Sun, 21 Oct 2018 11:53:16 +0000 (07:53 -0400)]
Merge branch 'maint' into next

6 years agoe4defrag: handle failure to open the file system gracefully
Theodore Ts'o [Sun, 21 Oct 2018 11:35:53 +0000 (07:35 -0400)]
e4defrag: handle failure to open the file system gracefully

If e4defrag is run by root, it will try to open the underlying file
system for files that it is trying to defrag so it can get the file
system parameters.  It's currently doing this by searching /etc/mtab.
This isn't the best way to go about doing things, but we'll leave it
for now, at least for a maintenance release.  (The better way to do
things would be to look up the device using the blkid library, but
that's a more involved change.)

Since the file system parameters isn't strictly speaking necessary
(after all we get by without them when not running as root), we'll
allow e4defrag to continue running if we can't find the file system.
This can happen if /etc/mtab is pointing at /proc/mounts, and the
kernel can't properly identify the root file system, it is reported as
"/dev/root".

Addresses-Debian-Bug: #907634

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agotests: move inode and its interior extent tree block
Theodore Ts'o [Sat, 20 Oct 2018 14:11:21 +0000 (10:11 -0400)]
tests: move inode and its interior extent tree block

Add a test case for the bug fixed in 4b3038134baf: "resize2fs: update
checksums in the extent tree's relocated block"

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoresize2fs: update checksums in the extent tree's relocated block
Theodore Ts'o [Sat, 20 Oct 2018 13:14:48 +0000 (09:14 -0400)]
resize2fs: update checksums in the extent tree's relocated block

When shrinking an file system, and we need to relocate an inode, the
checksums in its extent tree must get updated to reflect its new inode
number.  When doing this, we need to do this *after* we update the
extent tree to reflect any blocks which need to be relocated due to
the file system shrink operation.

Otherwise, in the case where only an interior node of the extent tree
needs to get relocated, and none of the entries in that node need to
be adjusted, the checksum for that interior node is updated in the old
copy of that block, and then after the extent tree is updated to use
the new copy of that interior node, the extent tree is left with an
invalid checksum.

This is a relatively rare case, since it requires the following
conditions to be true:

*)  The metadata checksum feature must be enabled.
*)  An inode needs to be relocated.
*)  The inode needs to have an interior node.
*)  The block for that interior node needs to be relocated.
*)  None of blocks addressed by entries in that interior node needs
    to be relocated.

When all of these conditions are true, though, the file system is left
with corrupted with bad checksum for the extent tree block.

Addresses-Launchpad-Bug: 1798562

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reported-by: Jean-Baptiste Lallement <jean-baptiste.lallement@ubuntu.com>
6 years agofuse2fs: add fakeroot option.
Nicholas Clark [Tue, 16 Oct 2018 19:37:45 +0000 (15:37 -0400)]
fuse2fs: add fakeroot option.

Add a new 'fakeroot' option to fuse2fs. When enabled, fuse2fs will
will pretend to be root when checking file permssions. This allows
fuse2fs to be used for building/modifying rootfs images as an
unprivileged user.

As per the maintainer's request, nosuid and nodev are automatically
enabled when fakeroot is selected (on platforms that support them)
to help prevent accidental misuse.

Signed-off-by: Nicholas Clark <nicholas.clark@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoMerge branch 'maint' into next
Theodore Ts'o [Tue, 16 Oct 2018 19:37:36 +0000 (15:37 -0400)]
Merge branch 'maint' into next

6 years agofuse2fs: fix fsname option in some cases
Nicholas Clark [Tue, 16 Oct 2018 19:34:20 +0000 (15:34 -0400)]
fuse2fs: fix fsname option in some cases

FUSE's parser allows command-line options to be specified before
or after the device/image and mount-path. This commit changes the
value of the fsname mount option to be correct even if options are
specified before the target device/image.

Signed-off-by: Nicholas Clark <nicholas.clark@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoblkid: adjust copyright license for version.c to be LGPL
Theodore Ts'o [Tue, 16 Oct 2018 16:53:36 +0000 (12:53 -0400)]
blkid: adjust copyright license for version.c to be LGPL

This makes the license of version.c to be consistent with the rest of
the files in the library.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoMerge branch 'maint' into next
Theodore Ts'o [Sun, 14 Oct 2018 16:31:06 +0000 (12:31 -0400)]
Merge branch 'maint' into next

6 years agoAOSP: android/perms.c: clean up error handling
Nick Kralevich [Thu, 11 Oct 2018 03:35:17 +0000 (20:35 -0700)]
AOSP: android/perms.c: clean up error handling

There are a number of error conditions which, due to the way
ext2fs_dir_iterate2 operates, would not be propagated to the upper
layers of the call stack. As a result, certain error conditions,
such as not having enough room to allocate blocks for SELinux
labels, would fail silently, instead of causing a compile
failure.

As suggested in
https://android-review.googlesource.com/c/platform/external/e2fsprogs/+/324363
, add a error field to the caller's private data structure, and use the
bit in the field to indicate an error condition. Now, certain errors
which were silently ignored will cause a compile failure when compiling
Android.

Test: Artifically modify selabel_lookup() to return a failure, and
      verify Android doesn't compile.
Test: Verify Android compiles under normal circumstances.
Test: Artifically modify ino_add_xattr() to return a failure, and
      verify Android doesn't compile.
Bug: 117502873
Bug: 117567573
Bug: 117473440

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Change-Id: Icdb0105a77e98c3428f20d3c59bf824dcad5db8d
From AOSP commit: 7ca13b8b2953f93536ea09eb2ff19bd7cc85b3c1

6 years agoAOSP: Fix debugfs clang build.
David Anderson [Thu, 11 Oct 2018 19:36:34 +0000 (12:36 -0700)]
AOSP: Fix debugfs clang build.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Change-Id: Ic4de282039524e1858bbd288e2b85be30d843f40
From AOSP commit: 7e9e2ca4b08aab41b28e57d0c9b840b8b9e6466d

6 years agoAOSP: ODR violation in resize2fs during host build
Jiyong Park [Tue, 18 Sep 2018 00:41:07 +0000 (09:41 +0900)]
AOSP: ODR violation in resize2fs during host build

Bug: 112062612
Test: $ m SANITIZE_HOST=address $OUT_DIR/host/linux-x86/bin/resize2fs $OUT_DIR/host/linux-x86/bin/llvm-symbolizer
      $ $OUT_DIR/host/linux-x86/bin/resize2fs

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Change-Id: I72a8c183eb887137e3a414043b3d54771aa4eedc
From AOSP commit: 9ba4dd69cfbf312c6015d5b007566e2467203f5e

6 years agoMerge branch 'maint' into next
Theodore Ts'o [Thu, 11 Oct 2018 14:28:42 +0000 (10:28 -0400)]
Merge branch 'maint' into next

6 years agoe2fsck: clear clang warnings for missing field initializers in structs
Theodore Ts'o [Thu, 11 Oct 2018 14:25:31 +0000 (10:25 -0400)]
e2fsck: clear clang warnings for missing field initializers in structs

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agotest_one: make sure the tmpfile is cleaned up if the test script exits
Theodore Ts'o [Thu, 11 Oct 2018 02:56:12 +0000 (22:56 -0400)]
test_one: make sure the tmpfile is cleaned up if the test script exits

f_detect_junk will skip the test by exiting; and in that case we need
to make sure the test's tmpfile gets cleaned up.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoDefine __GNUC_PREREQ if necessary
Theodore Ts'o [Thu, 11 Oct 2018 02:25:54 +0000 (22:25 -0400)]
Define __GNUC_PREREQ if necessary

The __GNUC_PREREQ convenience macro is defined by glibc's header
files.  If it isn't available, make it available for us to use.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agofilefrag.c: fix build problem when using musl libc
Theodore Ts'o [Thu, 11 Oct 2018 02:24:01 +0000 (22:24 -0400)]
filefrag.c: fix build problem when using musl libc

Use HAVE_LINUX_FD_H guard since not all libc's or operating systems
provide <linux/fd.h>.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoMerge branch 'maint' into next
Theodore Ts'o [Thu, 4 Oct 2018 14:39:50 +0000 (10:39 -0400)]
Merge branch 'maint' into next

6 years agolibe2p: avoid segfault when s_nr_users is too high
Lukas Czerner [Tue, 14 Aug 2018 14:37:53 +0000 (16:37 +0200)]
libe2p: avoid segfault when s_nr_users is too high

Currently in e2fsprogs tools it's possible to access out of bounds
memory when reading list of ids sharing a journal log
(journal_superblock_t->s_users[]) in case where s_nr_users is too high.

This is because we never check whether the s_nr_users fits into the
restriction of JFS_USERS_MAX. Fix it by checking that nr_users is not
bigger than JFS_USERS_MAX and error out when possiblem.

Also add test for dumpe2fs. The rest would require involving external
journal which is not possible to test with e2fsprogs test suite at the
moment.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoe2scrub: fix makefile MKINSTALLDIRS -> MKDIR_P
Darrick J. Wong [Tue, 28 Aug 2018 23:38:14 +0000 (16:38 -0700)]
e2scrub: fix makefile MKINSTALLDIRS -> MKDIR_P

Fix the MKINSTALLDIRS -> MKDIR_P transition in the scrub/ dir.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: try to always use PUNCH_HOLE for unix_discard
Darrick J. Wong [Tue, 28 Aug 2018 23:38:07 +0000 (16:38 -0700)]
libext2fs: try to always use PUNCH_HOLE for unix_discard

Now that block devices support PUNCH_HOLE via fallocate, refactor the
unix_discard code into a helper that will always try to use it.  For
block devices we can fall back to BLKDISCARD, but we prefer to use
fallocate because it will always invalidate the page cache of the zeroed
region.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agolibext2fs: use ZERO_RANGE before PUNCH_HOLE in unix_zeroout
Darrick J. Wong [Tue, 28 Aug 2018 23:38:00 +0000 (16:38 -0700)]
libext2fs: use ZERO_RANGE before PUNCH_HOLE in unix_zeroout

In unix_zeroout() for files, we should try a ZERO_RANGE before we try
PUNCH_HOLE because the former will not cause us to lose preallocated
blocks.  Since block devices have supported fallocate for a few years
now, refactor the fallocate calls into a helper and call it from either
case.

Reported-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
6 years agoFor --enable-subset, change "make install" so it implies "make install-libs"
Theodore Ts'o [Fri, 24 Aug 2018 21:12:20 +0000 (17:12 -0400)]
For --enable-subset, change "make install" so it implies "make install-libs"

The e2fsprogs-libs-1.44.x.tar.gz subset distribution had a hack so
that "make install" would install the libraries via an implied "make
install-libs" --- since after all the tarball had was just the
libraries.

This commit makes "make install" behave the same was as the
e2fsprogs-libs distribution in the case of "configure --enable-subset"

Signed-off-by: Theodore Ts'o <tytso@mit.edu>