Whamcloud - gitweb
Benno Schulenberg [Mon, 2 Jun 2014 01:23:38 +0000 (21:23 -0400)]
mke2fs: gettextize an overlooked error message
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Zheng Liu [Mon, 26 May 2014 06:55:08 +0000 (14:55 +0800)]
debugfs: fix two warning messages when compiling with LLVM
This commit fixes two warning messages when compiling with LLVM.
Reported-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Andreas Dilger [Tue, 27 May 2014 17:14:18 +0000 (13:14 -0400)]
misc: fix compile warnings on master branch
Fix compile warnings found on the master branch when using LLVM.
- Add missing format string when using the libintl _() macro
- include <limits.h> header to get PATH_MAX definition
- fix format vs. variable mismatches
- add header block for create_inode.c file
- remove use of bzero(), use ext2fs_get_memzero() instead
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 27 May 2014 17:08:52 +0000 (13:08 -0400)]
Merge branch 'maint' into next
Darrick J. Wong [Tue, 27 May 2014 17:02:12 +0000 (13:02 -0400)]
Misc coverity fixes
Fix various small resource leaks and error code handling issues that
Coverity pointed out.
Fixes-Coverity-Bugs: 1215250, 1193379, 119194[2-4], 1049160
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Tue, 27 May 2014 16:56:45 +0000 (12:56 -0400)]
filefrag: exit with error code if an error is hit
If an error is hit during filefrag operation, it will continue to run
(if multiple files are specified on the command-line), but will exit
with a non-zero value, so that callers can determine that some error
was hit.
Clean up the printing of FIEMAP flags and print some newer flags that
were missing. Also print unknown flags as hex values.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Tue, 20 May 2014 23:12:22 +0000 (17:12 -0600)]
misc: fix create_inode warnings with LLVM
Fix name clash in do_mknod_internal() due to local variables named
"major" and "minor" shadowing identical macro names.
Also, no need to set the major and minor device for a FIFO inode.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Theodore Ts'o [Tue, 27 May 2014 16:27:13 +0000 (12:27 -0400)]
Merge branch 'maint' into next
Conflicts:
debugfs/debugfs.c
Theodore Ts'o [Tue, 27 May 2014 16:24:33 +0000 (12:24 -0400)]
lib/ext2fs: clean and build ext2_types.h as necessary
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Fri, 23 May 2014 14:28:04 +0000 (10:28 -0400)]
tst_libext2fs: add new debug program which used for libext2fs unit tests
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Vitaliy Filippov [Mon, 26 May 2014 16:08:35 +0000 (12:08 -0400)]
misc: use unsigned long long for file block count in filefrag
This patch fixes incorrect reporting of file block count on 32-bit platforms.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Eric Sandeen [Mon, 26 May 2014 15:43:24 +0000 (11:43 -0400)]
e2fsprogs: don't run quota test if quota is not enabled
The default configuration still has quota disabled, but
runs the f_quota test unconditionally, so we fail by
default.
Fix that...
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Thu, 22 May 2014 22:52:27 +0000 (18:52 -0400)]
e2fsck: fix Makefile dependency for quota.o
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Andreas Dilger [Thu, 22 May 2014 06:38:07 +0000 (00:38 -0600)]
debugfs: fix debugfs/quota.c compile warnings
Fix type mismatch and unused variable warnings.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Tue, 20 May 2014 22:30:35 +0000 (16:30 -0600)]
debugfs: fix filehandle leak in copy_file()
Fix a file handle leak for the target file in copy_file() when error
handlers return without closing the file. Instead, clean up at the
end of the function to handle cleanup in normal and error cases.
Minor other code style cleanups.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Tue, 20 May 2014 22:31:10 +0000 (16:31 -0600)]
debugfs: fix string_to_time for MacOS strptime()
The strptime() function does not update fields in struct tm that are
not specified in the input format. The glibc implementation sets the
tm_yday field (%j) when any of the year (%Y), month (%m), or day (%d)
fields are changed, but the MacOS strptime() does not set tm_yday in
this case. This caused string_to_time() to calculate the wrong Unix
epoch on MacOS. If tm_yday is unset, compute it in string_to_time().
This also fixes test regression failures for FreeBSD.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Eric Sandeen [Wed, 21 May 2014 17:47:44 +0000 (12:47 -0500)]
mke2fs: use ext2fs_open_file() in check_plausibility()
The commit:
802146c mke2fs: create a regular file if necessary
caused a regression on 32-bit machines; the open() fails if
the file size is > 4G.
Using ext2fs_open_file() fixes it.
Addresses-Red-Hat-Bugzilla: #1099892
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 19 May 2014 03:05:37 +0000 (23:05 -0400)]
Merge branch 'maint' into next
Conflicts:
RELEASE-NOTES
debian/changelog
version.h
Theodore Ts'o [Mon, 19 May 2014 01:51:21 +0000 (21:51 -0400)]
Update release notes, etc. for final 1.42.10 release
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 19 May 2014 02:51:22 +0000 (22:51 -0400)]
debian: override source-is-missing false positive
See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=748421
Once a new version of Lintian is uploaded with this fixed, we can drop
this override.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 19 May 2014 02:29:01 +0000 (22:29 -0400)]
debian: fix debian/rules compatibility with gmake 4.0
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 19 May 2014 01:47:32 +0000 (21:47 -0400)]
Update translation files for 1.42.10 release
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 19 May 2014 01:36:52 +0000 (21:36 -0400)]
Fix obvious typo in German translation
Addresses-Debian-Bug: #737800
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Trần Ngọc Quân [Sun, 18 May 2014 13:46:34 +0000 (09:46 -0400)]
po: update vi.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Göran Uddeborg [Sun, 18 May 2014 13:46:34 +0000 (09:46 -0400)]
po: update sv.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Jakub Bogusz [Sun, 18 May 2014 13:46:34 +0000 (09:46 -0400)]
po: update pl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Benno Schulenberg [Sun, 18 May 2014 13:46:34 +0000 (09:46 -0400)]
po: update nl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Samuel Thibault [Sun, 18 May 2014 13:46:34 +0000 (09:46 -0400)]
po: update fr.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Benno Schulenberg [Sun, 18 May 2014 13:46:34 +0000 (09:46 -0400)]
po: update es.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Petr Pisar [Sun, 18 May 2014 13:46:34 +0000 (09:46 -0400)]
po: update cs.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 13 May 2014 15:01:07 +0000 (11:01 -0400)]
Merge branch 'maint' into next
Conflicts:
debugfs/Makefile.in
debugfs/debug_cmds.ct
debugfs/debugfs.c
debugfs/debugfs.h
e2fsck/Makefile.in
misc/Makefile.in
misc/mke2fs.c
Darrick J. Wong [Mon, 12 May 2014 04:21:29 +0000 (00:21 -0400)]
mke2fs: set gdt csum when creating packed fs
When we're creating a fs with metadata blocks packed at the beginning
(packed_meta_blocks=1 in mke2fs.conf), set the group descriptor
checksum or else we create DOA filesystems with checksum errors.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
Darrick J. Wong [Mon, 12 May 2014 03:33:08 +0000 (23:33 -0400)]
resize2fs: fix sanity check in reserve_sparse_super2_last_group()
In reserve_sparse_super2_last_group, the old_desc check should only be
performed if ext2fs_super_and_bgd_loc2() gave us a location -- a
return value of 0 means that there is no old-style GDT block.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 11 May 2014 04:23:49 +0000 (00:23 -0400)]
quota: remove mke2fs's and tune2fs's warning messages regarding quota
We no longer need to reference https://ext4.wiki.kernel.org/index.php/Quota
since we've fixed the nasty bugs associated with e2fsck and the quota
feature. The wiki page will be updated once we've done a release that
includes these fixes indicated the verison which these problems have
been fixed.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
Theodore Ts'o [Sun, 11 May 2014 04:01:33 +0000 (00:01 -0400)]
tests: add basic e2fsck regression test for fixing the quota inode
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
Theodore Ts'o [Sun, 11 May 2014 03:28:10 +0000 (23:28 -0400)]
debugfs: add commands to query the quota information
This allows us to verify quota information in an ext4 file systems
with the quota feature.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
Theodore Ts'o [Sun, 11 May 2014 03:19:12 +0000 (23:19 -0400)]
quota: support storing the quota file handles in the quota context
This makes memory management easier because when the quota context is
released, all of the quota file handles get released automatically.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
Theodore Ts'o [Sat, 10 May 2014 22:55:20 +0000 (18:55 -0400)]
quota: integrate mkquota.h into quotaio.h
There are interfaces that are used by mke2fs.c and tune2fs.c which are
in quotaio.h, and some future changes will be much simpler if we can
combine the two header files together. Also the guard #ifdef for
mkquota.h was incorrect, which caused problems when both header files
needed to be included.
Also remove quota.pc and installation rules for libquota, since this
library is never going to be something that we can export externally
anyway. Eventually we'll want to clean up the interfaces and move the
external publishable interfaces to the libext2fs library, and then
rename what's left from libquota.a to libsupport.a for internal use
only.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
Theodore Ts'o [Sat, 10 May 2014 21:29:18 +0000 (17:29 -0400)]
quota: fix memory leak in quota_compare_and_update()
The quota_handle wasn't getting closed in quota_compare_and_update().
Fix this, and also make sure that quota_file_close() doesn't
unnecessarily modify the quota inode if it's not necessary. Otherwise
e2fsck will claim that the file system is modified when it didn't need
to be.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
Theodore Ts'o [Sat, 10 May 2014 05:27:31 +0000 (01:27 -0400)]
quota: fix e2fsck to notice missing quota entries
Previously if there was a missing quota entry --- i.e., if there were
files owned by group "eng", but there was no quota record for group
"eng", e2fsck would not notice the missing entry. This means that the
usage informtion would not be properly repaired. This is unfortunate.
Fix this by marking each quota record in quota_dict that has a
corresponding record on disk, and then check to see if there are any
records in quota_dict that have not been marked as having been seen.
In that case, we know we need to update the relevant quota inode.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
Theodore Ts'o [Sat, 10 May 2014 05:11:41 +0000 (01:11 -0400)]
quota: fix e2fsck so we update the quota file correctly
In scan_dquota_callback() we were copying dqb_off from the on-disk
dquot structure to the dqot structure that we have constructed in
memory. This is a bad idea, because if we detect that the quota inode
is corrupted and needs to be replaced, when we later write out the
inode, the fact that we have a non-zero dqb_off value means that quota
routines will not bother updating the quota tree index, since
presumably the quota tree index already has an entry for this dqot.
The problem is that e2fsck, the only user of these functions, has
zapped the quota inode so it can be written from scratch. So this
means the index for the quota records are not written out, so the
kernel can not find any of the records in the quota inodes. Oops.
The fix is simple; there is no reason to copy the dqb_off field into
the quota_dict copy of struct dquot.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
Theodore Ts'o [Sat, 10 May 2014 05:09:44 +0000 (01:09 -0400)]
quota: add debugging code to print the dquot structure
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Aditya Kali <adityakali@google.com>
Darrick J. Wong [Thu, 1 May 2014 23:13:02 +0000 (16:13 -0700)]
debugfs: force logdump to display (old) journal contents
If the user passes the -O option to logdump, try to dump old log
contents. This can be used to try to track down journal problems even
after the journal has been replayed.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Mon, 12 May 2014 00:57:18 +0000 (20:57 -0400)]
debugfs: teach logdump to deal with 64bit revoke tables
The logdump command doesn't know how to deal with revoke tables in
64bit journals, so teach it to do this.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Mon, 12 May 2014 00:24:55 +0000 (20:24 -0400)]
mke2fs: always warn if 128-byte inode and inline_data
The combination of 128-byte inodes and inline_data is silly, since
there's no room in the inode table. Unfortunately, if neither
mke2fs.conf nor the mkfs command line options specify an inode size,
the default inode size is set to 128 bytes (by libext2fs) and the
warning isn't printed. Therefore, always do the check-and-warning.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Sun, 11 May 2014 22:42:23 +0000 (18:42 -0400)]
libext2fs: create sockets when populating filesystem
Since the code to copy-in a socket when creating a filesystem is
fairly simple, just do it here.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sun, 11 May 2014 22:34:50 +0000 (18:34 -0400)]
misc: coverity fixes
Fix various small resource leaks and error code handling issues that
Coverity pointed out.
Fixes-Coverity-Bugs: 11919{39-45}, 1174118, 1049160, 1049144
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sun, 11 May 2014 22:32:07 +0000 (18:32 -0400)]
misc: create better-packaged static analysis reports
Fix some minor bugs relating to passing CFLAGS to cppcheck, and
package the cppcheck output into nicer looking reports.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 11 May 2014 22:30:11 +0000 (18:30 -0400)]
Merge branch 'maint' into next
Conflicts:
e2fsck/pass1.c
Niu Yawei [Thu, 8 May 2014 02:38:53 +0000 (10:38 +0800)]
libquota: fix dict_uint_cmp()
dict_uint_cmp() returns an usigned int value in int type, which
could mess the dict key comparison when the difference of two
keys is greater than INT_MAX.
Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
David Michael [Wed, 7 May 2014 03:05:17 +0000 (23:05 -0400)]
Add a make variable for the pkgconfig install dir
Adding the pkgconfigdir variable allows specifying an installation
location for pkg-config files independent of libdir.
Signed-off-by: David Michael <fedora.dm0@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Chen Qi [Tue, 6 May 2014 01:08:42 +0000 (21:08 -0400)]
Fix cross compilation problem in parse-types.sh
The checking of types in parse-types.sh doesn't make much sense in a
cross-compilation environment, because the generated binary is
executed on build machine.
So even if asm_types.h has got correct statements for types, it's
possible that the generated binary will report an error, because these
types are for the target machine.
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 5 May 2014 05:22:22 +0000 (01:22 -0400)]
mke2fs: check for a partition table and warn if present
This supercedes the "whole disk" check, since it does a better job and
there are times when it is quite legitimate to want to use the whole
disk.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 5 May 2014 04:20:31 +0000 (00:20 -0400)]
mke2fs: print extra information about existing ext2/3/4 file systems
The basic idea is to provide a bit more context in this situation:
% ./misc/mke2fs -t ext4 /dev/sdc3
mke2fs 1.42.9 (4-Feb-2014)
/dev/sdc3 contains a ext4 file system
Proceed anyway? (y,n)
... by adding this bit of context:
% ./misc/mke2fs -t ext4 /dev/sdc3
mke2fs 1.42.9 (4-Feb-2014)
/dev/sdc3 contains a ext4 file system
last mounted on /SOX-backups on Mon May 5 08:59:53 2014
Proceed anyway? (y,n)
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 5 May 2014 03:40:58 +0000 (23:40 -0400)]
mke2fs: print a message when creating a regular file
We've added the ability to automatically recreate a file if it doesn't
exist prior to creating the file system, since this is often used (for
example) when managing file system images for use in virtual machines.
We should at least notify the user that this is going on to avoid
surprises in the case of misspelled device/file names.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 28 Apr 2014 14:07:16 +0000 (10:07 -0400)]
resize2fs: fix inode table move for the backwards move case
In the case where the new location of the inode table is before the
old inode table, the optimization which tries to optimize zero block
moves breaks. Fix it.
This fixes a bug that was tickled by the reproduction described in the
previous commit.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 28 Apr 2014 14:03:12 +0000 (10:03 -0400)]
libext2fs: fix alloc_allocate_group_table() if the flexbg_offset wraps
If the previous block group's inode table ends at the very end of file
system, wrap around to the beginning of the flex_bg.
This fixes a bug was tickled by:
mke2fs.conf:
frontload = {
features = extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize,^resize_inode,sparse_super2
hash_alg = half_md4
num_backup_sb = 0
packed_meta_blocks = 1
inode_ratio = 4194304
flex_bg_size = 262144
}
mke2fs -T frontload /tmp/foo.img 2T
resize2fs -M /tmp/foo.img
resize2fs -M /tmp/foo.img
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sun, 27 Apr 2014 19:52:48 +0000 (15:52 -0400)]
resize2fs: refine minimum required blocks for flex_bg file systems
The previous commit exposed bugs in the calculation for flex_bg file
systems. The problem is that since (by default) we keep the metadata
blocks for the flex_bg in the first block group of the flex_bg, and
because we don't want to overwrite metadata blocks used by the
original file system with data blocks make life easier in case the
resize is aborted for some reason, we need to treat all of the
metadata blocks in the existing flex_bg has in use for the purposes of
calculate_minimum_resize_size().
Even though this means we need to reserve more data blocks to avoid
running out of space, the net result of these two commits is a net
savings in how much we can shrink a file system.
Using the following test sequence:
mke2fs -F -t ext4 /tmp/foo.img 2T
resize2fs -M /tmp/foo.img
resize2fs -M /tmp/foo.img
resize2fs -M /tmp/foo.img
Here is the comparison in the resulting file systems between the old
and new resize2fs (units are in 4k blocks):
resize #1 resize #2 resize #3
old resize2fs 1117186 45679 43536
new resize2fs 48784 37413 37392
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sun, 27 Apr 2014 02:08:02 +0000 (22:08 -0400)]
resize2fs: fix overly-pessimistic calculation of minimum size required
For extent-mapped file systems, we need to reserve some extra space in
case we need to grow the extent tree. Calculate the safety margin
more intelligently, so we don't overestimate the amount of space
required.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: Dmitry Monakhov <dmonakhov@openvz.org>
Theodore Ts'o [Sun, 27 Apr 2014 03:14:47 +0000 (23:14 -0400)]
e2fsck: if any problems are fixed in pass 0, check the whole file system
If there are any PREEN_OK problems fixed in check_super_block(), don't
skip checking the full file system.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Mark Fasheh [Sun, 27 Apr 2014 00:23:00 +0000 (20:23 -0400)]
e2fsprogs/filefrag: print shared extent flag
Filefrag doesn't catch and print the shared extent flag. Add this for
users of filefrag on file systems with shared extents (such as btrfs).
Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 26 Apr 2014 23:00:50 +0000 (19:00 -0400)]
mke2fs: only print the low-level file system stats in verbose mode
Also print the file system UUID if it is non-NULL.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 26 Apr 2014 22:42:31 +0000 (18:42 -0400)]
mke2fs: check for pre-existing file system
Warn the system administrator if there is an existing file system on
the block device, and give the administrator an opportunity to abort
the mkfs operation.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 26 Apr 2014 21:34:52 +0000 (17:34 -0400)]
mke2fs: add an option in mke2fs.conf to proceed after a delay
If mke2fs needs to ask the user for permission, and the user doesn't
type anything the specified delay in the /etc/mke2fs.conf file,
proceed as if the user had said yes. The default is to do what we
currently do, which is to wait until the user answers the question one
way or the other.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 26 Apr 2014 20:17:38 +0000 (16:17 -0400)]
mke2fs: create a regular file if necessary
This is useful when creating a filesystem for use with a VM, for
example.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 26 Apr 2014 19:12:21 +0000 (15:12 -0400)]
mke2fs: don't complain if the regular file is too small
Don't ask the user if it's OK that a regular file is smaller than the
requested size. This test only makes sense if we are creating the
file system on a block device. This allow users to not need to
manually answer the "proceed?" question when creating a file system
backed by a simple file.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 26 Apr 2014 17:14:32 +0000 (13:14 -0400)]
mke2fs, tune2fs: call proceed_question() from check_plausibility()'s caller
Move the call to proceed_question() from check_plausibility() to its
caller. This allows more fine grained control by mke2fs about when it
might want to call check_plausibility().
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 26 Apr 2014 16:16:44 +0000 (12:16 -0400)]
mke2fs: don't ask the proceed question using a regular file
Very often people are creating file systems using regular files, so we
shouldn't ask the user to confirm using the proceed question.
Otherwise it encourages users to use the -F flag, which is a bad
thing.
We do need to continue to check if the external journal device is a
block device.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 22 Apr 2014 18:14:56 +0000 (14:14 -0400)]
e2fsck: skip low dtime check if the number of inodes > s_mkfs_time
We already skip the low dtime check if the number of inods is greater
than the last mount or last written time. However, if a very large
file system is resized sufficiently large that the number of inodes is
greater than when the file system was original created, we can end up
running afoul of the low dtime check. This results in a large number
of false positives which e2fsck can fix up without causing any
problems, but it can induce a large amount of anxiety for the system
administrator.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: Patrik Horník <patrik@hornik.sk>
Theodore Ts'o [Mon, 14 Apr 2014 20:37:23 +0000 (16:37 -0400)]
Merge branch 'maint' into next
Andreas Dilger [Mon, 14 Apr 2014 16:48:16 +0000 (12:48 -0400)]
tests: fix resize test tmpfs max-file-size checking
Old distros may not have the "truncate" tool, so use "dd" instead.
If tmpfs cannot handle a 2GB temp file (e.g. old RHEL5 and SLES 11
kernels) then skip the test instead of failing it. If this fails,
try to report better error messages instead of failing silently.
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Andreas Dilger [Mon, 14 Apr 2014 16:20:25 +0000 (12:20 -0400)]
fix miscellaneous build warnings
Fix various unused variable and use-uninitialized warnings.
Add generated files into .gitignore.
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Robert Yang [Mon, 14 Apr 2014 15:43:24 +0000 (11:43 -0400)]
mke2fs.c: return error when failed to populate fs
We need return retval when "mke2fs -d" failed, otherwise the "$?"
would be 0 which is misleading.
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Theodore Ts'o [Fri, 11 Apr 2014 03:16:34 +0000 (23:16 -0400)]
e4defrag: fix error reporting when ext2fs_open fails
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Jon Ernst [Fri, 11 Apr 2014 03:06:35 +0000 (23:06 -0400)]
e4defrag: open fs with EXT2_FLAG_64BITS flag
This allows e4defrag to work with 64-bit and bigalloc file systems.
Signed-off-by: Jon Ernst <jonernst07@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 8 Apr 2014 23:26:45 +0000 (19:26 -0400)]
Merge branch 'maint' into next
Eryu Guan [Thu, 27 Mar 2014 10:17:24 +0000 (18:17 +0800)]
libext2fs: fix build errors on bigendian hosts
Fix the following build errors on bigendian hosts.
- ctx is a pointer, use '->' not '.'
- add missing argument to ext2fs_dirent_swab_in2
make[2]: Entering directory `/root/e2fsprogs/lib/ext2fs'
CC inline_data.c
inline_data.c: In function ‘ext2fs_inline_data_dir_iterate’:
inline_data.c:221:5: error: request for member ‘errcode’ in something not a structure or union
ctx.errcode = ext2fs_dirent_swab_in2(fs, ctx->buf, ctx->buflen, 0);
^
inline_data.c:222:9: error: request for member ‘errcode’ in something not a structure or union
if (ctx.errcode) {
^
inline_data.c: In function ‘ext2fs_inline_data_dir_expand’:
inline_data.c:364:2: error: too few arguments to function ‘ext2fs_dirent_swab_in2’
retval = ext2fs_dirent_swab_in2(fs, buf, size);
^
In file included from inline_data.c:19:0:
ext2fs.h:1569:18: note: declared here
extern errcode_t ext2fs_dirent_swab_in2(ext2_filsys fs, char *buf, size_t size,
^
make[2]: *** [inline_data.o] Error 1
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Theodore Ts'o [Sat, 29 Mar 2014 14:25:49 +0000 (10:25 -0400)]
logsave: make message when process has a non-zero exit code to be less scary
Addresses-Debian-Bug: #468821
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Sat, 15 Mar 2014 16:12:35 +0000 (12:12 -0400)]
e2fsck: print runs of duplicate blocks instead of all of them
When pass1 finds blocks that are mapped to multiple files, it will
print every duplicated block. If there are long sequences of
duplicate blocks (e.g. the e_pblk field is wrong in an extent), this
can cause a gigantic flood of output when a range could convey the
same information. Therefore, teach pass1b to print ranges when
possible.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Sat, 15 Mar 2014 15:36:34 +0000 (11:36 -0400)]
libext2fs: fix parents when modifying extents
In ext2fs_extent_set_bmap() and ext2fs_punch_extent(), fix the parents
when altering either end of an extent so that the parent nodes reflect
the added mapping.
There's a slight complication to using fix_parents: if there are two
mappings to an lblk in the tree, the value of handle->path->curr can
point to either extent afterwards), which is documented in a comment.
Some additional color commentary from Darrick:
In the _set_bmap() case, I noticed that the "remapping last block in
extent" case would produce symptoms if we are trying to remap a
block from "extent" to "next_extent", and the two extents are
pointed to by different index nodes. _extent_replace(...,
next_extent) updates e_lblk in the leaf extent, but because there's
no _extent_fix_parents() call, the index nodes never get updated.
In the _punch_extent() case, we conclude that we need to split an
extent into two pieces since we're punching out the middle. If the
extent is the last extent in the block, the second extent will be
inserted into a new leaf node block. Without _fix_parents(), the
index node doesn't seem to get updated.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Fri, 14 Mar 2014 13:56:33 +0000 (09:56 -0400)]
libext2fs: fix memory leak when drastically shrinking extent tree depth
In ext2fs_extent_free(), h(andle)->max_depth is used as a loop
conditional variable to free all the h->path[].buf pointers. However,
ext2fs_extent_delete() sets max_depth = 0 if we've removed everything
from the extent tree, which causes a subsequent _free() to leak some
buf pointers. max_depth can be re-incremented when splitting extent
nodes, but there's no guarantee that it'll reach the old value before
the free.
Therefore, remember the size of h->paths[] separately, and use that
when freeing the extent handle.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Fri, 14 Mar 2014 13:43:11 +0000 (09:43 -0400)]
misc: fix header complaints and resource leaks in e2fsprogs
Fix a few minor bugs that cppcheck complained about.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Fri, 14 Mar 2014 13:35:01 +0000 (09:35 -0400)]
libext2fs: fix 64bit overflow in ext2fs_block_alloc_stats_range
In ext2fs_block_alloc_stats_range(), the quantity "-inuse * n" is
calculated as a signed 32-bit quantity. Unfortunately, gcc (4.6.3 on
Ubuntu 12.04) doesn't sign-extend this quantity to fill the blk64_t
parameter that ext2fs_free_blocks_count_add() wants, so the end result
is that the superblock gets a ridiculously huge free block count.
Changing the declaration of 'n' to blk64_t seems to fix this.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Fri, 14 Mar 2014 13:34:10 +0000 (09:34 -0400)]
misc: cppcheck cleanups
Fix a number of things that cppcheck complains about. Most of these
are minor resource leaks and forgotten declarations.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Fri, 14 Mar 2014 13:32:48 +0000 (09:32 -0400)]
all: Introduce cppcheck static checking for make C=1
Introduce more static checking via cppcheck.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Fri, 14 Mar 2014 13:31:02 +0000 (09:31 -0400)]
resize2fs: add inline dirs for remapping
When we're looking for directory blocks for the inode remapping step,
we need to include inline_data directories in the remap process.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Fri, 14 Mar 2014 13:30:17 +0000 (09:30 -0400)]
libext2fs: repair side effects when iterating dirents in inline dirs
In ext2fs_inline_data_dir_iterate(), we must be very careful to undo
any modifications we make to the dir_context pointer passed in by the
caller, because it's entirely possible that the caller will still want
to do something with the ctx or something inside.
Specifically, ext2fs_dblist_dir_iterate() wants to be able to free
ctx->buf, and it reuses the ctx for multiple dblist entries. That
means that assigning ctx->buf will cause weird crashes at the end of
dir_iterate().
Since we're being careful with ctx, we might as well handle adding the
INLINE_DATA flag to ctx->flags for ext2fs_process_dir_block, since the
dblist caller forgets to unset the flag before reusing the ctx.
This fixes some crashes and valgrind complaints in resize2fs, and is
necessary for the next patch, which fixes resize2fs not to corrupt
inline_data filesystems.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Fri, 14 Mar 2014 13:28:13 +0000 (09:28 -0400)]
libext2fs: during inlinedata expand, don't corrupt inode
When expanding an inline data inode, it's possible that the reduction
in the size of the EA structures causes the freeing of the EA block,
which changes the inode. If this happens, the local version of the
inode that ext2fs_inline_data_expand was modifying will be out of sync
with what's on the disk. This local copy gets written out to disk
after a block allocation, at which point it's possible that the inode
EA block and logical block zero point to the same physical block,
which is bad news.
Therefore, write the local copy to disk before removing the inline
data EA, and reread it afterwards.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Fri, 14 Mar 2014 13:26:21 +0000 (09:26 -0400)]
e2fsck: zero errcode when checking inline data blocks
When checking inline data blocks, always zero pctx->errcode because
otherwise a previous error condition could leak through and "cause" a
fatal block iteration failure. I found this by corrupting an xattr
block on an inline_data inode and fsck aborted when I tried to repair
it.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Fri, 14 Mar 2014 13:23:21 +0000 (09:23 -0400)]
libext2fs: fix iblocks correctly when expanding an inline_data file
i_blocks covers the number of blocks allocated to an inode for data,
extents, and ACL blocks. Since it's possible for a file to have a
separate ACL block and inline data, we must be careful when expanding
an inline data file to adjust, not set, the value of i_blocks.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Fri, 14 Mar 2014 13:23:03 +0000 (09:23 -0400)]
libext2fs: don't fail when doing a strict rewrite of inline data
ext2fs_inline_data_set() tries to ensure that there is sufficient free
space in the inode to store the inline data. Unfortunately, it gets
the check wrong -- ext2fs_xattr_inode_max_size() returns the amount of
unused bytes in the EA area, and _data_set() doesn't factor in the
size of the existing inline data. Therefore, a strict rewrite of an
N-byte inlinedata with another N-byte inlinedata fails.
Fix the code to do the size check correctly.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Fri, 14 Mar 2014 13:16:20 +0000 (09:16 -0400)]
e2fsck: don't rehash inline directories
If a directory's contents are stored entirely inside the inode,
there's no index to rebuild and no dirblock checksum to recompute.
As far as I know these are the only two reasons to call dir rehash.
Therefore, we can move on to the next dir instead of what we do right
now, which is try to iterate the dir blocks (which of course fails due
to the inline_data iflag being set) and then flood stdout with useless
messages that aren't even failures.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Thu, 13 Mar 2014 17:40:37 +0000 (13:40 -0400)]
libext2fs: fix build failure on big endian systems
Fix a typo that we didn't notice because all the world's an x86. :-)
Reported-by: jon ernst <jonernst07@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Wed, 12 Mar 2014 03:49:58 +0000 (23:49 -0400)]
debugfs: create commands to edit extended attributes
Enhance debugfs to be able to display and modify extended attributes, and
create some simple tests for the extended attribute editing functions.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Wed, 12 Mar 2014 03:49:13 +0000 (23:49 -0400)]
debugfs, libext2fs: minor fixups to xattr support
Add magic number checking to the extended attribute editing handle;
move inline data to the head of the attribute list when writing so
that inline data ends up in the inode area; and always zero the
attribute space before writing to ensure that we can delete the last
xattr.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Wed, 12 Mar 2014 03:40:17 +0000 (23:40 -0400)]
create_inode: fix gcc -Wall complaints
We had several functions that were not returning zero on success. Fix
this.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Wed, 12 Mar 2014 03:34:41 +0000 (23:34 -0400)]
create_inode: handle hard link inum mappings per populate_fs invocation
When calling populate_fs, the map for hardlink detection is not
cleaned up between populate_fs invocations, which could lead to
unexpected results if anyone calls populate_fs twice in the same
client program). This doesn't happen right now, but we might as well
clean it up.
The detctor fails if the external directory crosses mountpoints,
so fix that too.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Tue, 11 Mar 2014 06:54:23 +0000 (23:54 -0700)]
create_inode: move debugfs internal state back to debugfs
Since create_inode.c is shared between debugfs and mke2fs, don't
spread debugfs internal state into mke2fs.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Wed, 12 Mar 2014 03:26:58 +0000 (23:26 -0400)]
create_inode: whitespace fixes
Fix a ton of whitespace issues.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Wed, 12 Mar 2014 03:25:06 +0000 (23:25 -0400)]
create_inode: minor cleanups
Fix a couple of small style issues in the create_inode files.
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>