Commit Graph

4327 Commits (a25fffae5cbdb9349fa3c358c9714584e9de7b33)

Author SHA1 Message Date
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
Samuel Thibault 14620a1d03 po: update fr.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-01-16 14:09:21 -05:00
Philipp Thomas d027517fb6 po: update de.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-01-16 14:09:21 -05:00
Petr Pisar 4af197366d po: update cs.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-01-16 14:09:21 -05:00
Theodore Ts'o 3bbb613ccb Update misc/Makefile.in using "make depend"
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-16 14:09:21 -05:00
Phillip Susi 0e51f5ae16 e2image: add -a switch to include all data
Normally the raw and QCOW2 images only contain fs metadata.
Add a new switch ( -a ) to include all data.  This makes it
possible to use e2image to clone a whole filesystem.

Signed-off-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-16 14:09:20 -05:00
Theodore Ts'o 390e49aab7 tests: create test for debugfs creating special files
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-16 14:09:20 -05:00
Theodore Ts'o e1e961cb80 debugfs: fix mknod command so that it updates the block group statistics
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-16 14:09:20 -05:00
Darren Hart 4df6a37bd3 debugfs: add symlink command
Add support for symbolic links using a new symlink command.  Modeled
after the do_mkdir() command.

Testing demonstrates both fastlinks and slowlinks work correctly.
Very long target paths fail as the command parsing appears to truncate
the input to somewhere around 256 bytes.

Signed-off-by: Darren Hart <dvhart@infradead.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Andreas Dilger <adilger@dilger.ca>
2013-01-16 14:09:20 -05:00
Darren Hart f01c1a6bce libext2fs: add the ext2fs_symlink() function
Creating symlinks is a complex affair when accounting for slowlinks.

Create a new function, ext2fs_symlink(), modeled after ext2fs_mkdir().
Like ext2fs_mkdir(), ext2fs_symlink() takes on the task of allocating a
new inode and block (for slowlinks), setting up sane default values in
the inode, copying the target path to either the inode (for fastlinks)
or to the first block (for slowlinks), and accounting for the inode and
block stats.  Disallow link targets longer than blocksize as the Linux
kernel prevents this.

It does not attempt to expand the parent directory, instead returning
EXT2_ET_DIR_NO_SPACE and leaving it to the caller to expand just as
ext2fs_mkdir() does.  Ideally, I think both of these functions should
make a single attempt to expand the directory.

[ Fixed a few bugs discovered when creating a test case for ext2fs_symlink() ]

Signed-off-by: Darren Hart <dvhart@infradead.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: Andreas Dilger <adilger@dilger.ca>
2013-01-16 14:09:17 -05:00
Theodore Ts'o 53f2a1eaf0 libext2fs: add error codes from 1.43.x development branch
To maintain the error codes numbering, we need to pull in the changes
from the 1.43.x development branch for the libext2's error table.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-16 14:07:25 -05:00
Zheng Liu 0f680ee8f2 mke2fs: document bigalloc and cluster-size
Bigalloc feature has been used for a long time, but the documentation
in mke2fs is still missing.  So add it.

Addresses-Debian-Bug: #669730

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-01-15 14:13:10 -05:00
Theodore Ts'o dd4f565d5a libext2fs: avoid 32-bit overflow in ext2fs_initialize with a 512M cluster size
If the user attemps to create a 512MB cluster, we need to adjust the
defaults to avoid a 32-bit overflow of s_blocks_per_group.  Also check
to make sure that the caller of ext2fs_initialize() has not given a
value of s_clusters_per_group that would result in an overflow of
s_blocks_per_group.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
2013-01-15 14:08:18 -05:00
Theodore Ts'o 86a985e749 mke2fs: teach mke2fs to understand -b 4k and -C 256M
The -b and -C options now use parse_num_blocks2() instead of strtol,
so that users can specify -C 256M instead of the much less convenient
-C 268435456.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
2013-01-15 14:06:55 -05:00
Theodore Ts'o 35d886b679 libe2p: teach parse_num_blocks2() to return bytes if log_block_size < 0
Previously the behavior of parse_num_block2 was undefined if
log_block_size was less than zero.  It will now return a number in
units of bytes.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
2013-01-15 14:06:32 -05:00
Theodore Ts'o 2a3b1c6ea2 mke2fs: the -g option will now specify the clusters per block group
If bigalloc is enabled, then -g will specify the clusters per block
group.  (If bigalloc is not enabled, then a cluster == a block, so the
meaning of -g is not changed.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
2013-01-15 14:05:48 -05:00
Theodore Ts'o 4b20ea2691 mke2fs: enforce that the cluster size must be greater that the block size
In addition, do not allow a cluster size of 1024, since that will be
interpreted by ext2fs_initialize() as requesting the default cluster
size.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
Reported-by: Zheng Liu <wenqing.lz@taobao.com>
2013-01-15 14:03:53 -05:00
Zheng Liu 9cf69bb825 mke2fs: require the bigalloc feature explicity if the cluster size is set
When cluster-size is specified without the bigalloc feature, mke2fs
will ignore this argument silently.  But user might think bigalloc
feature has been enabled unless they use the dumpe2fs command.  So now
we ask user to set bigalloc feature explicity when cluster-size is
enabled.  This can make sure that users understand what they are doing
because bigalloc might impact the performance for some workloads.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-14 16:54:09 -05:00
Theodore Ts'o 9e85208e84 debugfs: fix gcc-wall complaints
Fix the missing function prototypes from the recently added new
debugfs commands, plus some signed vs unsigned comparison complaints.

Also change the abbreviation of the block_dump command from "bp" to
the more appropriate "bp".

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-14 16:54:09 -05:00
Theodore Ts'o 5a760d4906 resize2fs: add debugging code to test the old online resizing interfaces
The old online resize ioctl interfaces are still present in the
kernel, and we want to make it easy to test both the kernel code for
those older interfaces, and resize2fs's use of those interfaces in a
relatively easy manner.

To do this, resize2fs will now check the environment variable
RESIZE2FS_KERNEL_VERSION.  If the version given is less than 3.3, then
do not try using the new resizing ioctl, but instead use the resizing
ioctls that were used before Linux version 3.3.

If the version given is less than 3.7, then emulate sanity checks
which get done to protect against the fact that the new resizing ioctl
prior to 3.7 did not handle meta_bg resizing.  (This was previously
tested via the presence of the RESIZE2FS_NO_META_BG_RESIZE environment
variable.  But the new environment variable, RESIZE2FS_KERNEL_VERISON,
is more general.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
2013-01-14 16:53:50 -05:00
Eric Sandeen 85a24385b6 debugfs: document zap_block & block_dump
What little docs there were had a cut & paste error.
We can do better. :)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2013-01-12 19:26:37 -05:00
Eric Whitney da489dd2f3 config: silence printf format warnings
The printfs in the asm_types.c code contained within parse-types.sh
expect sizeof to return an int.  Fix this for architectures where this
isn't true (x86_64, etc.) so we don't see warning messages while
running the configure script.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-08 21:04:03 -05:00
Theodore Ts'o f0257d8891 libext2fs: ext2fs_open2() should not set ret_fs after a MMP failure
The addition of MMP code was added in the wrong place, so ret_fs could
get set (and EXT2_FLAG_NOFREE_ON_ERROR was cleared as well, which
could confuse e2fsck which depends on this flag being cleared if
ext2fs_open2() succeeded.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-08 20:47:11 -05:00
Nickolai Zeldovich a046da5963 e2fsck: avoid memory corruption on ext2fs_open2 failure
In try_open_fs(), if ext2fs_open2() returns an error, do not try to
access the struct ext2_filesys.  The previous check 'if (ret_fs)' was
always true, but even 'if (*ret_fs)' might be incorrect in some cases,
so check 'retval==0' instead.

Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-08 20:42:26 -05:00
Nickolai Zeldovich 6dd83548f4 e2fsck: do not crash on long log file names
Previously e2fsck would corrupt memory if the log file name was longer
than 100 bytes (e.g., a long log_filename value in e2fsck.conf or a
pattern that expands out to more than 100 bytes).  This was due to
incorrectly calling realloc() in append_string() on the struct string
instead of the malloc'ed char* buffer, among other problems.  This
patch fixes the call to realloc() and also ensures that the buffer is
grown by sufficiently many bytes (not just by 2x).

Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-08 20:36:48 -05:00
Eric Sandeen bf50beb9f6 e2fsck: show size requested when memory allocation fails
"e2fsck: Can't allocate dx_block info array"
is only so helpful - it'd be nice to know how much it tried to allocate.

In particular, since I think malloc(0) can return NULL,
it'd be nice to know if maybe we passed in an uninitialized (or
0-initialized) size.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-08 10:41:08 -05:00
Zheng Liu f45011df2b mke2fs: check extents feature when bigalloc feature is enabled
When bigalloc feature is enabled in mkfs, extents feature also needs
to be enabled.  But now when bigalloc feature is enabled without
extents feature, users will not get any warning messages until they
try to mount this file system.

Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-01-08 10:35:45 -05:00
Theodore Ts'o 027b0577d4 Fix 32-bit overflow problems: dgrp_t * s_blocks_per_group
There are a number of places where we multiply a dgrp_t with
s_blocks_per_group expecting that we will get a blk64_t.  This
requires a cast, or using the convenience function
ext2fs_group_first_block2().

This audit was suggested by Eric Sandeen.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
2013-01-05 10:14:11 -05:00