Theodore Ts'o [Wed, 28 Feb 2018 03:15:54 +0000 (22:15 -0500)]
libext2fs: declare local functions static to avoid namespace leakage
The functions, xattr_array_update() and space_used() were accidentally
allowed to be declared extern and were thus made available via the
shared library. Fix this.
Theodore Ts'o [Tue, 27 Feb 2018 22:32:27 +0000 (17:32 -0500)]
Break up RELEASE-NOTES into files in doc/RelNotes
The RELEASE-NOTES file was getting too big as be unweildy. It also
made it hard to have simultaneous releases of older maintenance
releases. So split it up into smaller files in the doc/RelNotes
directory.
Theodore Ts'o [Tue, 27 Feb 2018 06:27:10 +0000 (01:27 -0500)]
resize2fs: remove bigalloc warning for online resizing
The kernel supports online resizing of bigalloc file systems. There's
no real point to have a scary messaging when doing an online resize of
bigalloc file systems, since all of the heavy lifting is done by the
kernel.
Theodore Ts'o [Tue, 27 Feb 2018 01:56:33 +0000 (20:56 -0500)]
remove AOSP's lib/config.h and update util/android_config.h
While synchronizing with the AOSP e2fsprogs tree, lib/config.h was
accidentally checked in. In the upstream repository, the official
copy of lib/config.h for Android should be stored in
util/android_config.h, since lib/config.h will confuse Unix builds.
This means that when synchronizing with the AOSP tree, changes
lib/config.h need to be reflected in util/android_config.h
Steven Moreland [Mon, 12 Feb 2018 23:18:03 +0000 (15:18 -0800)]
AOSP: mke2fs: Don't require mke2fs.conf on Windows.
This target doesn't exist on Windows.
Fixes the following error:
build/make/core/main.mk:586: warning: Missing required dependency host_cross_mke2fs.conf from module host_cross_mke2fs defined in out/soong/Android-aosp_walleye.mk
Nick Kralevich [Mon, 27 Nov 2017 22:07:42 +0000 (14:07 -0800)]
AOSP: Standarize on VFS_CAP_REVISION_2
In https://github.com/torvalds/linux/commit/8db6c34f1dbc8 , namespaced
file capabilities were introduced. That change updated VFS_CAP_REVISION
from VFS_CAP_REVISION_2 to VFS_CAP_REVISION_3.
Android code is written assuming v2 capabilities, and the code will
break if we naively try to treat a v2 structure as a v3 structure.
So don't even try.
Android kernels prior to v4.14 will not support this extended capability
structure, so attempting to set such capabilities will ultimately fail.
With 8db6c34f1dbc8, it appears that attempting to read a v3 capabilities
xattr will always downgrade the capability to a v2 capability, so it
really doesn't make sense to look for a v3 capability.
Android capabilities are only created at /system and /vendor filesystem
creation time by host tools. Android processes, within or outside a
namespace, are not permitted CAP_SETFCAP
(https://android-review.googlesource.com/c/platform/system/sepolicy/+/547801/1/public/domain.te
line 1101). So we should never have to deal with a v3 capability other
than those that might appear on the /system / /vendor partition at a
future date by a future author.
Stephen Hines [Fri, 27 Oct 2017 18:44:15 +0000 (11:44 -0700)]
AOSP: Suppress use of ASan on e2fsdroid temporarily.
There is a heap buffer overflow that the next toolchain detects on
e2fsdroid. In order to expedite deploying that toolchain, which has been
validated on all of our other targets, we are going to suppress
host sanitization of this executable until we can resolve the actual
bug.
Bug: http://b/68387795
Test: ASAN_OPTIONS=detect_leaks=0 SANITIZE_HOST=address m -j48
Change-Id: I35126c25a65304e53a18031d99334cc57e21a6a5
From AOSP commit: 4705e518c65bf38d876188f28b65fd4815c716d7
Jin Qian [Thu, 10 Aug 2017 18:11:09 +0000 (11:11 -0700)]
AOSP: misc: fix resource leak in populate_fs
Contributed-By: Ivan Maidanski <i.maidanski@samsung.com>
Change-Id: Ibffdeea347d993c97f86ff7bfc5e78024048afce
From AOSP commit: 978002e04483ddab12187f2e08b28996657bc818
Theodore Ts'o [Sun, 25 Feb 2018 01:23:24 +0000 (20:23 -0500)]
tune2fs: if turning off csum_seed and the UUID has changed, require fsck
In the case where the UUID has changed and the user wants to turn off
the csum_seed feature, it's important that file system be freshly
checked. That's also the only case when it's necessary to recalculate
all of the metadata file systems.
Theodore Ts'o [Sat, 24 Feb 2018 23:11:19 +0000 (18:11 -0500)]
tune2fs/fuse2fs/debugfs: after replaying the journal, fix up s_lastcheck
If the file system needs to have the journal replayed, but definition
it can't be freshly checked. So if the time when the file system was
last checked (s_lastcheck) is before the time it was last mounted
(s_mtime), force s_lastcheck to be before s_mtime.
This is necessary to make sure some of tune2fs's safety checks work
correctly after replaying the journal, since some of tune2fs's
operations really require that the file system be self-consistent or
grave damage can result.
Theodore Ts'o [Sat, 24 Feb 2018 23:07:44 +0000 (18:07 -0500)]
tune2fs: move the journal recovery before we try to modify the superblock
Also change the t_replay_and_set test so that we do something more
innocuous, such as setting the file system label, instead of something
much more dangerous such as removing metadata_csum feature (which
requires rewriting the metadat checksums, and this will fail
catastrophically after the test corrupts the inode bitmaps and we
perform the journal replay correctly).
NeilBrown [Sat, 24 Feb 2018 19:56:06 +0000 (14:56 -0500)]
tune2fs: don't recover journal if device is busy.
tune2fs currently replays the journal if it needs
recovery and the filesystem isn't mounted.
The test for "is the filesystem mounted" isn't completely robust.
Lustre makes use of ext4 filesystems in a way that they are mounted
without being visible in /proc/mounts or similar.
This usage can easily be detected by attempting to open the device
with O_EXCL. tune2fs already does this and the EXT2_MF_BUSY flag
is set if open(O_EXCL) fails.
Several uses other than lustre mounts could cause O_EXCL to fail,
but in any case it seems unwise to recover the journal when something
else is keeping the device busy.
So add an extra test to avoid journal recovery when the device
is busy. This fixes some problems with lustre usage.
Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Theodore Ts'o [Thu, 4 Jan 2018 00:28:43 +0000 (19:28 -0500)]
debian: remove -dbg packages from the control file
It looks like Debian's upload automation will reject a control file
that has packages that it doesn't recognize, even if they are not
built in the default build profile. (e.g., the expectation is that
build profiles will *disable* packages, but not *add* new binary
packages not normally built.)
So move the offending lines into debian/control.legacy-dbg which is
tacked onto the debian/control file via "./debian/rules debian-files"
and then removed via "./debian/rules mrproper". It's a hack, but it's
only needed when building backports for Debian Jessie.
Theodore Ts'o [Wed, 3 Jan 2018 21:05:44 +0000 (16:05 -0500)]
debian: convert to use build profile rules exclusively
This commit drops support for the debian/rules.custom file, and only
relies on build profiles.
This means we no longer need to build the control file from
control.in, which simplifies this; developers can now build a debian
package immediately after checking out the tree from git. This also
implies that we are dropping support for Debian 7 (wheezy) and Ubuntu
Trusty (14.04LTS) and older releases. (People who want to backport to
these older distributions will have to make manual adjustments to the
debian/control and debian/rules files.)
Instead of using SKIP_E2FSCK_STATIC in debian/rules.custom, use the
new build profile: pkg.e2fsprogs.no-static-e2fsck
Support for the old-style *-dbg files used in Debian Jessie (which did
not support dbgsym packages) is completely automated. The system will
auto-detect systems which do not support dbgsym and automatically set
the pkg.e2fsprogs.legacy-pkg build profile.
Palmer Dabbelt [Fri, 29 Dec 2017 18:19:51 +0000 (10:19 -0800)]
misc: rename copy_file_range to copy_file_chunk
As of 2.27, glibc will have a copy_file_range library call to wrap the
new copy_file_range system call. This conflicts with the function in
misc/create_inode.c, which this patch renames _copy_file_range.
Theodore Ts'o [Mon, 1 Jan 2018 23:59:16 +0000 (18:59 -0500)]
libext2fs: when writing bitmaps mark the fs as dirty if necessary
If any checksum fields are updated in the block group descriptors, we
need to set the EXT2_FLAG_DIRTY flag so that the block group
descriptors are written to disk.
Tyson Nottingham [Thu, 14 Dec 2017 07:13:12 +0000 (23:13 -0800)]
Add missing information to various man pages and usage texts
badblocks.c: Add -B and -X to usage text.
chattr.1.in: Add P to list of settable attributes.
e2image.8.in, e2image.c: Remove superfluous mention of -r option.
e2undo.8.in, e2undo.c: Add description for -z to man page and add -o and
-z to synopsis and usage text.
e4crypt.8.in: Add -p pad option to relevant command descriptions.
lsattr.1.in: Fix typo.
mke2fs.8.in: Add -C to synopsis. Add MKE2FS_DEVICE_PHYS_SECTSIZE
description and update MKE2FS_DEVICE_SECTSIZE description.
mke2fs.conf.5.in: Add devices stanza summary. Remove base_features and
default_features descriptions from defaults section, as they are
already described in fs_types section. Move enable_periodic_fsck and
force_undo to fs_types section, as they can be set per filesystem
type. Add missing lazy_journal_init and hugefiles_dir descriptions.
tune2fs.8.in: Remove unsupported -p option and deprecated -s option.
Add 64bit, ea_inode, large_dir, and metadata_csum_seed descriptions.
tune2fs.c: Remove unsupported -p option from usage text.
Add mmp_update_interval to extended option usage text.
Tyson Nottingham [Thu, 14 Dec 2017 07:13:11 +0000 (23:13 -0800)]
Add missing information to debugfs man pages and usage texts
Add descriptions for dump_unused, get_quota, list_quota,
set_current_time, show_debugfs_params, and supported_features
commands to debugfs man page. Add various missing command
arguments and correct a few typos in man page and usage texts.
Tyson Nottingham [Thu, 14 Dec 2017 07:13:09 +0000 (23:13 -0800)]
Add missing features and mount options to ext4 man page
Add descriptions for the metadata_csum and metadata_csum_seed
features, as well as nombcache and prjquota mount options. Also,
update a couple of descriptions.
Add swabbing for these missing fields. Reorder the swabbing
on other fields so that they are in struct order, and add
comments for fields that do not need swabbing, so it is easier
to see that all fields are being handled.
Since this seems to be a fairly common occurrence, add compile
time checks to ext2fs_swap_super(), ext2fs_swap_inode_large(),
and ext2fs_swap_group_desc2() via a new EXT2FS_BUILD_BUG_ON()
macro to cause a compile warning if fields are used from these
structs without a corresponding change to the swab functions.
Qian Yingjin [Wed, 13 Dec 2017 15:59:39 +0000 (10:59 -0500)]
debugfs: fix ncheck program output
Fix the bug that print the inode number not the program name
when reporting bad inode name during checking in ncheck.
Minor bug fix: it should reduce iw->inodes_left when found
matched inode number.
Dmitry V. Levin [Wed, 13 Dec 2017 04:05:45 +0000 (23:05 -0500)]
Fix -Wunused-variable compilation warnings
Fix the following compilation warnings:
sha256.c: In function 'main':
sha256.c:238:20: warning: unused variable 'md' [-Wunused-variable]
sha512.c: In function 'main':
sha512.c:286:20: warning: unused variable 'md' [-Wunused-variable]
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Dmitry V. Levin [Thu, 18 May 2017 17:46:49 +0000 (17:46 +0000)]
Fix compilation warnings about functions declared in sys/xattr.h
attr commit v2.4.47-34-g7921157 removes <attr/xattr.h>
and syscall wrappers with the following wording:
"The xattr syscalls are provided by glibc since ages [...]
This removes the need for the <attr/xattr.h> header;
use <sys/xattr.h> instead."
Check for <sys/xattr.h> and include it to fix the following compilation
warnings:
create_inode.c: In function 'set_inode_xattr':
create_inode.c:136:9: warning: implicit declaration of function 'llistxattr' [-Wimplicit-function-declaration]
create_inode.c:172:16: warning: implicit declaration of function 'lgetxattr' [-Wimplicit-function-declaration]
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Wed, 13 Dec 2017 02:46:36 +0000 (21:46 -0500)]
e2fsck: fix potential Floating Point Exception in show_stats()
If the free inodes count in the superblock is equal to the inodes
count in the superblock (which is not possible with a valid file
system and will be fixed by e2fsck unless it is prevented by, for
example, e2fsck -n), it is possible for e2fsck to crash due to a
divide by zero error.
Kazuya Mio [Tue, 5 Dec 2017 00:15:38 +0000 (00:15 +0000)]
e2freefrag: print 64bit free blocks count
e2freefrag prints incorrect free blocks count when the number of free blocks
is larger than 2^32.
To fix this problem, e2freefrag uses ext2fs_free_blocks_count(),
not fs->super->s_free_blocks_count.