Commit Graph

4154 Commits (4718395120454ad7c193c76258ef5359f2ab3f2f)

Author SHA1 Message Date
Theodore Ts'o 4718395120 libext2fs: optimize ext2fs_bg_has_super()
Reduce the CPU time needed when checking whether a block group has a
sparse superblock.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-06-15 18:29:52 -04:00
Theodore Ts'o 3ac420165c libext2fs: remove lib/ext2fs/sparse.c
This file was never getting compiled, and there is no user of
ext2fs_list_backups() in the e2fsprogs sources.  So remove it as a
clean up.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-06-15 18:28:58 -04:00
Theodore Ts'o e2e389a1d5 tests: add new test f_extent_oobounds
This tests creates a file system where the last entry in one leaf
block overlaps with logical block range in the first entry of the next
leaf block.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-06-06 23:53:31 -04:00
David Jeffery d3f32c2db8 e2fsck: detect invalid extents at the end of an extent-block
e2fsck does not detect extents which are outside their location in the
extent tree.  This can result in a bad extent at the end of an extent-block
not being detected.

From a part of a dump_extents output:

 1/ 2  37/ 68 143960 - 146679 123826181               2720
 2/ 2   1/  2 143960 - 146679 123785816 - 123788535   2720
 2/ 2   2/  2 146680 - 147583 123788536 - 123789439    904 Uninit <-bad extent
 1/ 2  38/ 68 146680 - 149391 123826182               2712
 2/ 2   1/  2 146680 - 147583     18486 -     19389    904
 2/ 2   2/  2 147584 - 149391 123789440 - 123791247   1808

e2fsck does not detect this bad extent which both overlaps another, valid
extent, and is invalid by being beyond the end of the extent above it in
the tree.

This patch modifies e2fsck to detect this invalid extent and remove it.

Signed-off-by: David Jeffery <djeffery@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
2013-06-06 22:53:31 -04:00
Theodore Ts'o 68477355a9 e2fsck: fix gcc -Wall nits
Perhaps the most serious fix up is a type-punning warning which could
result in miscompilation with overly enthusiastic compilers.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-05-19 21:36:31 -04:00
Theodore Ts'o 577c773a60 misc: fix gcc -Wall warnings
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-05-19 20:03:48 -04:00
Theodore Ts'o e48bf256e9 libext2fs: fix gcc -Wall warnings
Primarily signed vs unsigned and const warnings.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-05-19 18:50:10 -04:00
Theodore Ts'o 25399080c5 chattr: clarify that the compression flags are not supported by ext4
... or indeed by any mainline kernel, since the compression patches
were never stablized.

Addresses-Debian-Bug: #707609

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: "Creidieki M. Crouch" <creidieki@gmail.com>
2013-05-13 09:10:16 -04:00
Theodore Ts'o 26991d026e e2fsck: don't use IO_FLAG_EXCLUSIVE for read-only root file systems
When opening the external journal, use the same logic to decide
whether or not to open the file system with EXT2_FLAG_EXCLUSIVE found
in main().

Otherwise, it's not posible to use e2fsck when the root file system is
using an external journal.

Reported-by: Calvin Owens <jcalvinowens@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-05-04 19:07:18 -04:00
Theodore Ts'o cc68e8a69a configure: update configure script to be in sync with the configure.in file
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-05-04 19:01:09 -04:00
Theodore Ts'o 5dfd5ef88d tests: add new test f_zero_xattr
E2fsck previously was complaining with zero-length extended attributes
if they appeared in the in-inode xattr space.  Test to make sure
e2fsck is now happy with such xattrs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-04-25 00:29:09 -04:00
Eric Sandeen 10fc3a63d9 e2fsprogs: allow 0-length xattr values in e2fsck
e2fsck thinks that this:

# touch mnt/testfile1
# setfattr -n "user.test" mnt/testfile1

results in a filesystem with corruption:

Pass 1: Checking inodes, blocks, and sizes
Extended attribute in inode 12 has a value size (0) which is invalid
Clear? yes

but as far as I can tell, there is absolutely nothing wrong with
a 0-length value on an extended attribute.  Just remove the check.

Reported-by: David Shaw <dshaw@jabberwocky.com>
Reported-by: Harald Reindl <h.reindl@thelounge.net>
Addresses-Red-Hat-Bugzilla: #557959
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-04-25 00:14:33 -04:00
Theodore Ts'o 9bd95a472c crcsum: remove the -b option since ext2fs_crc32c_be is dropped in 1.43.x
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-04-22 00:04:36 -04:00
Theodore Ts'o 572ef60b89 libext2fs: only use override function when reading an 128 byte inode
The ext2fs_read_inode_full() function should not use fs->read_inode()
if the caller has requested more than the base 128 byte inode
structure and the inode size is greater than 128 bytes.  Otherwise the
caller won't get all of the bytes that they were asking for, since
there's no way for the fs->read_inode override function can know what
the size of the buffer passed to ext2fs_read_inode_full().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-04-21 23:53:26 -04:00
Tomas Racek 8034d9fa0f e2image: fix flag settings in e2image.h
This prevents from SIGSEGV when -s options is used.

Signed-off-by: Tomas Racek <tracek@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
2013-04-21 23:49:04 -04:00
Tomas Racek fdaf34f8c0 e2image: require that -a option is used only with raw or QCOW2 image
All data cannot be included in normal image file so e2image should exit
in this case.

Signed-off-by: Tomas Racek <tracek@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
2013-04-21 23:21:46 -04:00
Tomas Racek ef21356fc0 e2image: man: fix typo
Signed-off-by: Tomas Racek <tracek@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-04-21 23:21:32 -04:00
Tomas Racek d55e68a660 e2image: remove useless exit call
Exit is called right after the install_image anyway so this one can
be removed.

Signed-off-by: Tomas Racek <tracek@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-04-21 23:21:32 -04:00
Akira Fujita fab0d286ec tune2fs: disallow tune2fs to set inode size larger than block size
Disallow tune2fs command to set the inode size to be larger than the
block size.  Without this patch, tune2fs makes the file system to be
unmountable.

Steps to reproduce:

1.Create ext4 without flex_bg (or just create ext3)
  # mke2fs -t ext4 -O ^flex_bg DEV

2.Set inode size larger than block size
  # tune2fs -I 8192 DEV

3. We failed to mount FS
  # mount DEV MP
    mount: wrong fs type, bad option, bad superblock on /dev/sda7,
           missing codepage or helper program, or other error
           In some cases useful info is found in syslog - try
           dmesg | tail  or so

Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-04-21 23:14:28 -04:00
Theodore Ts'o e79a9395b3 tests: add more tests for off-line resizing
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-03-31 20:41:23 -04:00
Theodore Ts'o 28e6662403 tests: create crcsum progam to support resizing tests
The only checksum program which we can reliably count upon being
installed on all systems is "sum", which is not a particular robust
checksum.  The problem with using md5sum or sha1sum is it hat it may
not be installed on all systems.  So create a crcsum program which is
used so we can validate that a data file on a resized file system has
not been corrupted.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-03-31 20:41:23 -04:00
Theodore Ts'o 447da244eb mke2fs: don't display bigalloc/quota fs feature warnings in quiet mode
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-03-31 20:41:22 -04:00
Theodore Ts'o f026f1a370 resize2fs: fix off-line resize of file systems with flex_bg && !resize_inode
When doing an off-line resize2fs of an initially very small file
system, it's possible to run out of reserved gdt blocks (which are
reserved via the resize inode).  Once we run out, we need to move the
allocation bitmaps and inode table out of the way to grow the gdt
blocks.  Unfortunately, when moving these metadata blocks, it was
possible that a block that had been just been newly allocated for a
new block group could also get allocated for a metadata block for an
existing block group that was being moved.

To prevent this, after we grow the gdt blocks and allocate the
metadata blocks for the new block groups, make sure all of these
blocks are marked as reserved.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reported-by: John Jolly <john.jolly@gmail.com>
2013-03-31 20:40:57 -04:00
Theodore Ts'o 871ad94264 blkid: remove no-op statement which caused a clang warning
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-03-13 14:34:08 -04:00
Theodore Ts'o 16b1fcf87d debugfs: fix command failures for extent_inode commands that take arguments
The extent_inode commands split_node, replace_node, and insert_node
take arguments which resulted in confusing error messages after
succeeding.  Fix this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-03-13 14:19:16 -04:00
Theodore Ts'o d3f58ef166 e2fsck: fix build failure with --enable-jbd-debug
Commit e3507739e4 introduced a build failure if e2fsprogs is
configured with --enable-jbd-debug.  Fix this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-03-13 14:02:53 -04:00
Jan Kara 5084088215 libext2fs: Provide prototype for ext2fs_symlink()
New function ext2fs_symlink() doesn't have a prototype in ext2fs.h and
thus debugfs compilation gives warning:

debugfs.c:2219:2: warning: implicit declaration of function 'ext2fs_symlink'

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-02-28 20:12:30 -05:00
Jan Kara 9e20cf223a e2p: Fix 's' handling in parse_num_blocks2()
parse_num_blocks2() wrongly did:
	num << 1;
when log_block_size < 0. That is obviously wrong as such statement has
no effect (and the compiler properly warns about it). Callers expect
returned value to be in bytes when log_block_size < 0 so fix the
statement accordingly.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-02-28 20:12:30 -05:00
Theodore Ts'o bb21ddf596 chattr: allow clearing the extent flag
In order to support kernels which support conversion of extent-mapped
files to direct/indirect mapped files, remove the sanity check which
prevented clearing the extent flag in chattr.  Kernels which don't
support this will simply give an Operation Not Supported error.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-02-22 22:23:05 -05:00
Theodore Ts'o 7c1384c324 debugfs: add sanity check to make sure we never shift 64 bits right
In the tables which are used to parse the fields for the set_fields
command, there should never be a entry which has a size set to 8
bytes, and two pointers defined.  Not only would it result in
undefined behavior in the compiled code, it doesn't make any sense and
is definitely a bug.

Reported-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-28 09:06:23 -05:00
Philipp Thomas 1bdc4f306a po: update de.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-01-27 22:44:56 -05:00
Philipp Thomas 0d89e5acea Fix warnings about functions not returning a value
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-27 22:41:50 -05:00
Andreas Dilger b55705e0ba build: quiet build warnings for "gcc -Wall"
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-27 22:29:01 -05:00
Zheng Liu dc18a3b305 contrib: add missing '-p' to fallocate's usage message
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-24 23:27:30 -05:00
Phillip Susi 274d46e1d3 libext2fs: fix ext2fs_llseek on i386
ext2fs_llseek() was using lseek instead of lseek64.  The
only time it would use lseek64 is if passed an offset that
overflowed 32 bits.  This works for SEEK_SET, but not
SEEK_CUR, which can apply a small offset to move the file
pointer past the 32 bit limit.

The code has been changed to instead try lseek64 first, and
fall back to lseek if that fails.  It also was doing a
runtime check of the size of off_t.  This has been moved to
compile time.

This fixes a problem which would cause e2image when built for
x86-32 to bomb out when used with large file systems.

Signed-off-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-24 23:04:01 -05:00
Theodore Ts'o 511ba985c0 Update Release Notes, Changelogs, version.h, for final 1.42.7 release
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-21 22:03:18 -05:00
Theodore Ts'o a713a7fe5a mke2fs, tune2fs, resize2fs: add warning messages for bigalloc and quota
The bigalloc and quota features have some known issues, so issue
warnings in case users try to use them.

More information can be found here:
	https://ext4.wiki.kernel.org/index.php/Bigalloc
	https://ext4.wiki.kernel.org/index.php/Quota

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-21 19:07:38 -05:00
Theodore Ts'o c64929d9c3 contrib: fix namespace leakage in spd_readdir
Declare the internal symbols alloc_dirstruct() and cache_dirstruct()
as static so they don't leak out into the global namespace.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-21 17:19:50 -05:00
Theodore Ts'o 0b64f50f71 contrib: add thread locking and readdir64_r support to spd_readdir
This is part of a series of improvements from a 2008 version of
spd_readdir.c that somehow didn't make it into the version which we
checked into e2fsprogs git tree.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-21 17:15:25 -05:00
Theodore Ts'o 635c7a57c0 contrib: add safe_getenv() support to spd_readdir
This is part of a series of improvements from a 2008 version of
spd_readdir.c that somehow didn't make it into the version which we
checked into e2fsprogs git tree.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-21 16:35:16 -05:00
Theodore Ts'o d1a1a583c1 resize2fs: move a cluster at a time with bigalloc file systems
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-20 00:25:00 -05:00
Theodore Ts'o 1773c87c7e resize2fs: correctly account for clusters when calculating summary stats
Fixes resize2fs so it correctly calculates the number of free clusters
in each block group for file systems with the bigalloc feature
enabled.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-19 23:58:13 -05:00
Theodore Ts'o 3e1816b8cc libext2fs: teach the ext2fs_*_block_bitmap_range2() about clusters
The ext2fs_{mark,unmark,test}_block_bitmap2() functions understand
about clusters, and will take block numbers and convert them to
clusters before checking the bitmap.  The
ext2fs_*_block_bitmap_range2() functions did not do this, which made
them inconsistent.  Fortunately, nothing has depended on this
incorrect behavior, and in fact most of the usage of these functions
have only recently been added, and only for optimizations that were
only enabled for non-bigalloc file systems.

So this is a change in previously exported functions, but (a) it
doesn't change the behavior at all for non-bigalloc file systems, and
(b) the change is more likely to fix bugs for bigalloc file systems.
For example, this change fixes a problem with resize2fs and bigalloc
file systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-19 23:21:11 -05:00
Theodore Ts'o 8359f626a4 Update Release Notes, Changelogs, version.h, etc. for 1.42.7 release
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-16 14:09:22 -05:00
Theodore Ts'o 921b79bcfd resize2fs: check in test-resize script
This should be made into a more formal, automated test case, but for
now, save this as script since it's useful for validating resize2fs's
handling of very large file systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-16 14:09:21 -05:00
Theodore Ts'o c253c3b982 Update config.{guess,sub} to the latest version
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-16 14:09:21 -05:00
Trần Ngọc Quân 6b9722db49 po: update vi.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-01-16 14:09:21 -05:00
Göran Uddeborg ad35a91e3b po: update sv.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-01-16 14:09:21 -05:00
Jakub Bogusz b675f58835 po: update pl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-01-16 14:09:21 -05:00
Benno Schulenberg 667c54f390 po: update nl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-01-16 14:09:21 -05:00