Commit Graph

3998 Commits (7dc67c0ad5daa7cbdf6d79a73bb34e04d55f7406)

Author SHA1 Message Date
Theodore Ts'o ad880a0e2b e2fsck: check new sysfs interface to determine if we are on battery
...since the old way is deprecated.

Addresses-SourceForge-Bug: #3439277

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-02-20 19:10:19 -05:00
Theodore Ts'o 12b25067ab libquota: fix invalid return in non-void function
quota_inode_truncate() returns an errcode_t, not void.

Addresses-SourceForge-Bug: #3468423

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-02-20 18:24:31 -05:00
Theodore Ts'o 5d0e1f99bc debian: fix dpkg-buildflags so it works when the shell is dash
The buildd's use dash as the shell, so we can't use >& in the rules
file.  This was causing the buildd-built e2fsprogs binary packages to
be built without the hardening flags.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-02-20 18:18:13 -05:00
Theodore Ts'o f921eda1ab debian: build with V=1 for more information in buildd logs
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-02-20 18:17:37 -05:00
Theodore Ts'o 5ab3487232 Fix missing version.h update
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-02-17 22:58:30 -05:00
Theodore Ts'o 91b9eadeab Update for e2fsprogs 1.42.1 release
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-02-17 15:54:37 -05:00
Theodore Ts'o 70218a0381 Update e2fsprogs.pot file for translators
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-02-17 15:28:22 -05:00
Gran Uddeborg 0afb7fa595 po: update sv.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-02-17 15:28:22 -05:00
Jakub Bogusz 309b1c254b po: update pl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-02-17 15:28:21 -05:00
Benno Schulenberg 561809aceb po: update nl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-02-17 15:28:21 -05:00
Samuel Thibault 6369f689e8 po: update fr.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-02-17 15:28:21 -05:00
Petr Pisar b248a68aaf po: update cs.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-02-17 15:28:21 -05:00
Theodore Ts'o 4a4a44d7b1 badblocks: honor the -s option when in read-only -t mode
Addresses-Debian-Bug: #646629

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-02-17 15:28:21 -05:00
Theodore Ts'o 991211f676 libext2fs, libe2p: Reserve RO_COMPAT_REPLICA feature
The replica is a feature which stores multiple copies of the key
metadata blocks so a single block failure in failure-prone media
(read: certain types of flash storage) doesn't take out the entire
file system.

Discussion on the upstream list proved not to be very positive on this
feature; the arguments were that it added complexity that wasn't
warrented, since common practice in industry is to insist on reliable
media, and if media is unreliable, you're kind of toast anyway (unless
the file system is being used as the back-end store of a cluster file
system where checksuming and data replication is happening above the
local disk file system level).  So, this feature is being developed
out of tree.

We reserve the code points so that other people won't accidentally
step on them.  Since it's not upstream, it's a soft reservation, but
it's not like we have any shortage of RO_COMPAT features.  We are a
bit more tight on reserved inodes, but EXT2_BOOT_LOADER_INO and
EXT2_UNDEL_DIR_INO are not currently used anywhere, and
EXT2_EXCLUDE_INO is a reservation for another out-of-tree feature.
There are no features currently being discussed which require a
reserved inode, but if a need were to arise, we can claw back code
point reservations that were never used or not in tree, as those will
always be considered lower priority than in-tree features.

Cc: Aditya Kali <adityakali@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-02-17 15:28:21 -05:00
Darrick J. Wong 3ae682bb0a libext2fs: Add ext2fs_file_get_inode_num call (for fuse2fs)
Add a function to return the inode number of an open file.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-02-17 15:28:21 -05:00
Theodore Ts'o 50a676e944 e2image: attempt to use ftruncate64 to set i_size for raw images
If ftruncate64() exists, try to use it to set i_size.  This isn't
guaranteed to work, per SuSv3, but if it doesn't work, it's guaranteed
to return an error.  So for file systems and/or operating systems that
don't support extending i_size via ftruncate64(), fall back to writing
the trailing null.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-02-17 15:28:21 -05:00
Theodore Ts'o 2b7a30cc52 e2image: fix logic bug which could cause a raw image not to be extended
If the size of the last "hole" in the raw file was an exact multiple
of a megabyte, then we wouldn't write a null at the end of the file in
order to extend the size of the raw image to correspond with the file
system size.  Thanks to Lukas Czerner for suggesting the fix, and
Phillip Susi for pointing out the problem.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-02-17 15:28:20 -05:00
Theodore Ts'o ba9e0afc5a mke2fs: allow file systems w/ uninit_bg to be recovered with mke2fs -S
The command mke2fs -S is used as a last ditch recovery command to
write new superblock and block group descriptors, but _not_ to destroy
the inode table in hopes of recovering from a badly corrupted file
system.  If the uninit_bg feature is enabled, we need to make sure to
clear the unused inodes count field in the block group descriptors or
else e2fsck -fy will leave the file system completely empty.

Thanks to Akira Fujita for reporting this problem.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-02-17 15:28:20 -05:00
Theodore Ts'o 564826e284 util: add build.profiled to list of files/directories to ignore
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-02-17 15:28:12 -05:00
Jan Kara ba8bfa1a6d resize2fs: take s_first_data_block into account for resize2fs -M
calculate_minimum_resize_size() forgot to account s_first_data_block
into minimum filesystem size. Thus in case the size of filesystem was
such that the last group had the minimal size (50 blocks + metadata
overhead), the code in adjust_fs_info() decided the group is unneeded,
removed it, and in some cases the resizing then failed with ENOSPC.

Fix the issue by properly accounting for s_first_data_block in
calculate_minimum_resize_size().

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-02-17 14:32:18 -05:00
Theodore Ts'o 910fae94a5 debian: enable use of dpkg-buildflags if present
On newer Debian-based distributions, dpkg-buildflags should be called
by the debian rules file to get the appropriate values for CFLAGS,
LDFLAGS, etc.  This will also allow Debian to build with security
hardened build flags, which is a release goal for Debian Wheezy.

If dpkg-buildflags is not present, then use some safe defaults (what
is currently being set by dpkg-buildpackage in Ubuntu 10.04 LTS, which
is a common enough ancient distribution that many people might still
care about).

Addresses-Debian-Bug: #654457

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-02-17 14:32:18 -05:00
Theodore Ts'o a204236eaf libext2fs: fix BLOCK_ABORT handling in the block iterator for extents
When processing files that contain extents, the block iterator
functions were not properly handling the BLOCK_ABORT bit.  This could
cause problems such as ext2fs_link() adding a directory entry multiple
times.

Thanks to Darrick Wong <djwong@us.ibm.com> for reporting this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-02-17 14:32:17 -05:00
Darrick J. Wong 9e89dbbd46 libext2fs: when truncating file, punch out blocks at end
Currently, ext2fs_file_set_size2 punches out data blocks between the
end of the file and infinity when truncate_block <= old_truncate
(i.e. when you've made the file longer).  This is not a useful
behavior, particularly since it *fails* to punch out the data blocks
when the file is shortened (i.e. truncate_block < old_truncate).  This
seems to be the result of the test being backwards, so fix the code to
punch only when the file is getting shorter.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-02-17 14:32:10 -05:00
Eric Sandeen 237b7b23fe mke2fs: recognize mke4fs program name
We shipped "mke4fs" alongside mke2fs in RHEL5, so that ext4-capable
utilities could be installed without disturbing the venerable e2fsprogs-1.39
shipped in RHEL5 from the beginning.  But it surprised some users that
"mke4fs" created ext2 filesystems by default rather than ext4.
While it was my intent to have the renamed binaries behave exactly
like the stock ones, it seems that there is some precedence for
handling "mkeNfs" in the code, so seems reasonable to add
mke4fs -> ext4 as well.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-02-15 16:18:50 -05:00
Theodore Ts'o 8a1da3c5ae debugfs: use ss_safe_getenv() instead of getenv()
In the case where debugfs (or rdebugfs) is installed setgid disk, or
some such, we need to disable the use of environment variables for the
obvious reasons.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-02-15 16:18:29 -05:00
Andreas Dilger 454ac9d56a libext2fs: quiet spurious group checksum errors
If we have to read the backup group descriptor checksums, the UNINIT
flags are cleared to ensure that all of the inodes in the filesystem
are scanned.  However, the code that reset the UNINIT flags did not
reset the group checksum, and this produced many spurious error
messages in e2fsck.

Group descriptor 0 checksum is invalid.  FIXED.
Group descriptor 1 checksum is invalid.  FIXED.
:
:

Recompute checksums after modifying group descriptors to avoid these
error messages.  Remove expected error messages in f_illitable_flexbg.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-02-07 21:11:21 -05:00
Theodore Ts'o 40b9cc5173 e2fsck: allow the block bitmap to be uninit when the inode bitmap is in use
Removing this check will allow us to eventually eliminate code from
the kernel which forcibly initialized the block bitmap when the inode
bitmap is first used.  This would eliminate a required journal credit
and extra disk write.

Addresses-Google-Bug: #5944440

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-02-06 13:47:48 -05:00
Yongqiang Yang 8dbcbe1c4a mke2fs: correct help text for option -G of mke2fs
The option '-G' is used to pass number of groups in a flex_bg, the
previous help text - 'meta-group-size' - could confuse users with
meta_bg.

Signed-off-by: Yongqiang Yang <xiaoqiangnk@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-01-23 11:46:43 -05:00
Theodore Ts'o 622cee8833 debugfs: fix spelling typo in ncheck
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-01-23 11:33:33 -05:00
Theodore Ts'o 8bf1e9184e debugfs: add ncheck -c option
Add a -c option to ncheck will verifies the file type information in
the directory entry.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-01-17 17:08:39 -05:00
Theodore Ts'o 1f572d1f88 libext2fs: display partial path if fs corrupted in ext2fs_get_pathname()
The function ext2fs_get_pathname() used to return EXT2_ET_NO_DIRECTORY
if one of the directories in an inode's pathname is not a directory.
This is not very useful in an emergency, when the file system is
corrupted.  This commit will cause ext2fs_get_pathname() to return a
partial pathname, which should help system administrators trying to
use debugfs to investigate a corrupted file system.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-01-17 15:38:31 -05:00
Theodore Ts'o 2b1cae7a26 debugfs: optimize ncheck and improve its error checking
Don't call ext2fs_get_pathname() for every single directory; instead,
only call it if we find a matching directory entry.  In addition, if
ext2fs_get_pathname() fails, print the number of the parent directory
in angle parents so the user gets some additional information.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-01-16 17:49:46 -05:00
Mike Frysinger 24d364fc43 libext2fs: change getpagesize to sysconf
Newer versions of glibc no longer export the getpagesize() prototype when
using recent versions of POSIX (_XOPEN_SOURCE).  So building tdb.c gives
use implicit function declaration warnings.  Fix the issue by using the
portable sysconf() function which returns the same answer.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-01-09 21:19:48 -05:00
Mike Frysinger 65794cf159 mke2fs: fix -T/-t usage output
There is a slight desync between the mke2fs(8) man page and the mke2fs
help output when it comes to the -t/-T options.  Since the man page is
correct, update the mke2fs usage string to match.

Reported-by: Ben Kohler <bkohler@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2012-01-09 21:17:57 -05:00
Lukas Czerner 9288e3be66 libext2fs: add bitmap statistics
This feature is especially useful for better understanding how e2fsprogs
tools (mainly e2fsck) treats bitmaps and what bitmap backend can be most
suitable for particular bitmap. Backend itself (if implemented) can
provide statistics of its own as well.

[ Changed to provide basic statistics when enabled with the
  E2FSPROGS_BITMAPS_STATS environment variable -- tytso]

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18 01:12:44 -05:00
Theodore Ts'o 4a61d17c7c libext2fs: adjust the description when copying a bitmap
Label the copy of a bitmap as "copy of ..." so that the bitmap's
description is more descriptive.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18 01:12:44 -05:00
Theodore Ts'o 830b44f438 e2fsck: use different bitmap types as appropriate
Now that we have multiple backend implementations of the bitmap code,
this commit teaches e2fsck to use either the most appropriate backend
for each use case.

Since we don't know for sure if we will get it all right, the default
choices can be overridden via e2fsck.conf.  The various definitions
are shown here, with the current defaults (which may change as we add
more bitmap implementations and as learn what works better).

; EXT2FS_BAMP64_BITARRAY is 1
; EXT2FS_BMAP64_RBTREE is 2
; EXT2FS_BMAP64_AUTODIR is 3
[bitmaps]
	inode_used_map = 2	; pass1
	inode_dir_map = 3	; pass1
	inode_reg_map = 2	; pass1
	block_found_map = 2	; pass1
	inode_bad_map = 2	; pass1
	inode_imagic_map = 2	; pass1
	block_dup_map = 2	; pass1
	block_ea_map = 2	; pass1
	inode_link_info = 2	; pass1
	inode_dup_map = 2	; pass1b
	inode_done_map = 3	; pass3
	inode_loop_detect = 3	; pass3
	fs_bitmaps = 2

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18 01:12:44 -05:00
Theodore Ts'o 0ff7bf3007 libext2fs: use the rbtree bitmap by default when initializing a file system
This change causes the max resident memory of mke2fs, as reported by
/usr/bin/time, to drop from 9296k to 5328k when formatting a 25
gig volume.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18 01:12:44 -05:00
Theodore Ts'o e35ff9b92a e2fsck: fix pass5 bug when using two different bitmap backends
The pass5 checks would fail if the expected and current {inode,block}
bitmaps used different back ends that returned different non-zero
values from the test_*_bitmap() functions.  Fix this by changing
"(actual == bitmap)" to "(!actual == !bitmap)".

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18 01:12:44 -05:00
Theodore Ts'o d182831a15 libext2fs: add pseudo bitmap backend type EXT2FS_BMAP64_AUTODIR
This backend type will automatically switch between the bitarray and
the rbtree backend based on the number of directories in the file
system.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18 01:12:43 -05:00
Lukas Czerner c1359d9195 libext2fs: add a bitmap implementation using rbtree's
For a long time we had a bitarray backend for storing filesystem
metadata bitmaps, however today this approach might hit its limits with
todays huge data storage devices, because of its memory utilization.

Bitarrays stores bitmaps as ..well, as bitmaps. But this is in most
cases highly unefficient because we need to allocate memory even for the
big parts of bitmaps we will never use, resulting in high memory
utilization especially for huge filesystem, when bitmaps might occupy
gigabytes of space.

This commit adds another backend to store bitmaps. It is based on
rbtrees and it stores just used extents of bitmaps. It means that it can
be more memory efficient in most cases.

I have done some limited benchmarking and it shows that rbtree backend
consumes approx 65% less memory that bitarray on 312GB filesystem aged
with Impression (default config). This number may grow significantly
with the filesystem size, but also it may be a lot lower (even negative)
if the inodes are very fragmented (need more benchmarking).

This commit itself does not enable the use of rbtree backend.

[ Simplified the code by avoiding unneeded memory allocation and
  deallocation of del_ext.  In addition, fixed a bug discovered by the
  tst_bitmaps tests: rb_unamrk_bmap() must return true if the bit was
  previously set in bitmap, and zero otherwise -- tytso ]

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18 01:12:40 -05:00
Lukas Czerner 5db745a283 libext2fs: add rbtree library
This commit adds rbtree library into e2fsprogs so it can be used for
various internal data structures. The rbtree implementation is ripped of
kernel rbtree implementation with small changes needed for it to work
outside kernel.

[ I prefixed the exported symbols and interface with ext2fs_ to keep
  avoid pulluting the namespace exported by the libext2fs shared
  library.  -- tytso ]

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18 01:00:44 -05:00
Theodore Ts'o b8ad88b3e7 libext2fs: add tests for the bitmap functions
These tests allow us to be sure that the new bitmap backends are
correctly implemented.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18 01:00:38 -05:00
Theodore Ts'o 67861e5bf3 libext2fs: add default_bitmap_type to the ext2_filsys structure
This allows a program to control the bitmap backend implementation
that will get used without needing to change the current library API.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-18 00:28:43 -05:00
Theodore Ts'o 24c91184d6 e2fsck: fix use of uninitialized value in the MMP code
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-16 15:36:40 -05:00
Theodore Ts'o ba37bb704f libext2fs: don't break when ext2fs_clear_generic_bmap() for 32-bit bitmaps
This is only an issue for programs compiled against e2fsprogs 1.41
that manipulate bitmaps directly.  Fortunately there are very few
programs which do that, especially those that try to clear a bitmap.

Addresses-Sourceforge-Bugs: #3451486

Reported-by: robi6@users.sourceforge.net
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-12-05 12:35:38 -05:00
Theodore Ts'o 499d5ec558 Update Release Notes, Changelogs, version.h, etc. for 1.42 release
Also fixed depfix.sed

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-29 16:48:14 -05:00
Gran Uddeborg 15dd651324 po: update sv.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-29 16:01:27 -05:00
Petr Pisar 2ab9252566 po: update cs.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-11-29 16:01:27 -05:00
Theodore Ts'o 4e523bbe00 e2fsck: speed up runs when using tdb for large atypical filesystems
Optimize how the tdb library so that running with [scratch_files] in
/etc/e2fsck.conf is more efficient.  Use a better hash function,
supplied by Rogier Wolff, and supply an estimate of the size of the
hash table to tdb_open instead of using the default (which is way too
small in most cases).  Also, disable the tdb locking and fsync calls,
since it's not necessary for our use in this case (which is
essentially as cheap swap space; the tdb files do not contain
persistent data.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-11-29 11:24:52 -05:00