OSDN Git Service
Theodore Ts'o [Fri, 17 Feb 2012 04:16:34 +0000 (23:16 -0500)]
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>
Theodore Ts'o [Thu, 16 Feb 2012 19:33:14 +0000 (14:33 -0500)]
util: add build.profiled to list of files/directories to ignore
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Jan Kara [Wed, 15 Feb 2012 23:41:33 +0000 (18:41 -0500)]
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>
Theodore Ts'o [Wed, 15 Feb 2012 23:29:37 +0000 (18:29 -0500)]
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>
Theodore Ts'o [Wed, 15 Feb 2012 22:25:32 +0000 (17:25 -0500)]
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>
Darrick J. Wong [Wed, 15 Feb 2012 20:11:46 +0000 (15:11 -0500)]
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>
Eric Sandeen [Wed, 15 Feb 2012 20:11:35 +0000 (15:11 -0500)]
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>
Theodore Ts'o [Tue, 14 Feb 2012 22:01:48 +0000 (17:01 -0500)]
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>
Andreas Dilger [Wed, 8 Feb 2012 02:11:21 +0000 (21:11 -0500)]
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>
Theodore Ts'o [Mon, 6 Feb 2012 18:47:48 +0000 (13:47 -0500)]
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>
Yongqiang Yang [Mon, 23 Jan 2012 16:46:43 +0000 (11:46 -0500)]
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>
Theodore Ts'o [Mon, 23 Jan 2012 16:33:33 +0000 (11:33 -0500)]
debugfs: fix spelling typo in ncheck
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 17 Jan 2012 22:08:39 +0000 (17:08 -0500)]
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>
Theodore Ts'o [Tue, 17 Jan 2012 20:38:31 +0000 (15:38 -0500)]
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>
Theodore Ts'o [Mon, 16 Jan 2012 22:49:46 +0000 (17:49 -0500)]
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>
Mike Frysinger [Tue, 10 Jan 2012 02:19:48 +0000 (21:19 -0500)]
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>
Mike Frysinger [Tue, 10 Jan 2012 02:17:57 +0000 (21:17 -0500)]
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>
Lukas Czerner [Fri, 16 Dec 2011 22:31:07 +0000 (17:31 -0500)]
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>
Theodore Ts'o [Sat, 17 Dec 2011 19:01:15 +0000 (14:01 -0500)]
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>
Theodore Ts'o [Fri, 16 Dec 2011 19:55:50 +0000 (14:55 -0500)]
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>
Theodore Ts'o [Fri, 16 Dec 2011 16:26:00 +0000 (11:26 -0500)]
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>
Theodore Ts'o [Sat, 17 Dec 2011 16:56:35 +0000 (11:56 -0500)]
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>
Theodore Ts'o [Sun, 18 Dec 2011 05:31:27 +0000 (00:31 -0500)]
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>
Lukas Czerner [Sun, 18 Dec 2011 05:29:33 +0000 (00:29 -0500)]
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>
Lukas Czerner [Fri, 16 Dec 2011 01:56:27 +0000 (20:56 -0500)]
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>
Theodore Ts'o [Sun, 18 Dec 2011 04:53:47 +0000 (23:53 -0500)]
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>
Theodore Ts'o [Fri, 16 Dec 2011 16:24:23 +0000 (11:24 -0500)]
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>
Theodore Ts'o [Fri, 16 Dec 2011 20:36:40 +0000 (15:36 -0500)]
e2fsck: fix use of uninitialized value in the MMP code
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 5 Dec 2011 17:35:38 +0000 (12:35 -0500)]
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>
Theodore Ts'o [Tue, 29 Nov 2011 21:06:58 +0000 (16:06 -0500)]
Update Release Notes, Changelogs, version.h, etc. for 1.42 release
Also fixed depfix.sed
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Göran Uddeborg [Tue, 29 Nov 2011 21:01:27 +0000 (16:01 -0500)]
po: update sv.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Petr Pisar [Tue, 29 Nov 2011 21:01:27 +0000 (16:01 -0500)]
po: update cs.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 29 Nov 2011 16:24:52 +0000 (11:24 -0500)]
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>
Theodore Ts'o [Mon, 28 Nov 2011 17:31:29 +0000 (12:31 -0500)]
configure: check for msync() for portability reasons
Turns out the Hurd defines MS_SYNC but doesn't define msync(). Go
figure. So check for both.
Reported by Svante Signell.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 28 Nov 2011 16:03:08 +0000 (11:03 -0500)]
tests: add test case for multiply claimed blocks with bigalloc
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 28 Nov 2011 16:00:48 +0000 (11:00 -0500)]
e2fsck: fix handling of duplicate blocks with bigalloc file systems
We need to do an accounting of duplicate clusters on a per-cluster
instead of a per-block basis so we know when we've correctly accounted
for all of the multiply claimed blocks in a particular inode.
Thanks to Robin Dong for reporting this bug.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 28 Nov 2011 01:31:36 +0000 (20:31 -0500)]
libquota: remove use of PATH_MAX and replace it with QUOTA_NAME_LEN
PATH_MAX is not portable (for example, it doesn't exist on the Hurd).
So replace it with a new define, which defines the maximum length of
the base quota name. As it turns out, this is substantially smaller
than PATH_MAX.
Also move the definitions relating to quotaio.c from mkquota.h to
quotaio.h, as a cleanup.
Addresses-Debian-Bug: #649689
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Kazuya Mio [Sat, 26 Nov 2011 02:31:09 +0000 (21:31 -0500)]
e2fsck: fix the max size calculation for non-extent file
When I create a non-extent file with the maximum size in ext4,
e2fsck detects the following error:
Pass 1: Checking inodes, blocks, and sizes
Inode 12, i_size is
4402345721856, should be
4402345721856. Fix?
As we know, e2fsck checks the size field of the inode in pass 1.
However, in case of the ext4 with the feature of ^extent and huge_file,
the maximum file size calculated in e2fsck is less than the real one.
The patch fixes this problem.
Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 26 Nov 2011 02:23:18 +0000 (21:23 -0500)]
libext2fs: move mmp fields to preserve structure layout of ext2_filsys
This helps provide better ABI compatibility for e2fsprogs 1.42.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 26 Nov 2011 02:16:38 +0000 (21:16 -0500)]
tst_fs_struct: add program to help check ABI compatibility of ext2fs_filsys
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 21 Nov 2011 03:15:34 +0000 (22:15 -0500)]
Update for e2fsprogs 1.42-WIP-1120 release
Theodore Ts'o [Mon, 21 Nov 2011 13:23:25 +0000 (08:23 -0500)]
rdebugfs: don't install by default
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sun, 20 Nov 2011 21:13:06 +0000 (16:13 -0500)]
resize2fs: treat EINVAL to mean the new resize ioctl does not exist
Linux's compat_sys_ioctl() function, which is run when executing a
ioctl using a 32-bit binary on a 64-bit kernel, returns EINVAL when an
inode does not exist. Sigh. See /usr/src/linux/fs/compat_ioctl.c.
This is probably a kernel bug, but work around it for now.
Addresses-Debian-Bug: #644989
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Eric Sandeen [Tue, 1 Nov 2011 07:32:28 +0000 (07:32 +0000)]
e2fsck: return more status if fsck aborts
If we abort fsck (due to ENOMEM for example) we exit
with only the FSCK_ERROR flag. It seems useful
to do the same sorts of checks as we do on normal
exit, and return whether the filesystem was modified,
whether there are still uncorrected errors, etc, even
in the abort case.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sun, 20 Nov 2011 20:47:02 +0000 (15:47 -0500)]
debugfs: fix sprintf stack overflow
The htree dump code overflows a char buffer if the directory has a long
filename because the buffer is not large enough to hold the characters that are
not part of the filename. Make the buffer larger and use snprintf instead.
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Niu Yawei [Sun, 20 Nov 2011 04:08:03 +0000 (23:08 -0500)]
libext2fs: enforce a max nested link count in ext2fs_find_block_device()
Define EXT2FS_MAX_NESTED_LINKS as 8, and check the link count to make
sure we don't exceed it in ext2fs_find_block_device() and
follow_link(). This fixes a potential infinite loop in
ext2fs_find_block_device() if there are symbolic loop links in the
device directory.
Signed-off-by: Niu Yawei <niu@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Eric Sandeen [Fri, 18 Nov 2011 22:45:42 +0000 (17:45 -0500)]
e2undo: cast dptr to blk64_t to retrieve block number
A 32-bit s390 build was failing on a 64-bit s390x host, when
make check failed e2undo tests, like this:
md5sum before mke2fs
922c8a591c882dbdd1a381d18547cfd5
using mke2fs to test e2undo
Overwriting existing filesystem; this can be undone using the command:
e2undo /tmp/mke2fs-tmp.EM9XjmTA81.e2undo /tmp/tmp.EM9XjmTA81
md5sum after mke2fs
cbf32fb6c3db45280ad013f42ac294f1
Replayed transaction of size 32768 at location 0
Replayed transaction of size 32768 at location 0
Replayed transaction of size 32768 at location 0
Replayed transaction of size 32768 at location 0
Replayed transaction of size 0 at location 0
md5sum after e2undo
31b4e14307c5b7ccce5b8d300c2ad5f1
Note the "at location 0" for the block number.
A proper cast in e2undo.c fixes this up.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Thu, 17 Nov 2011 20:35:00 +0000 (15:35 -0500)]
debugfs: fix gcc -Wall complaints
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Thu, 17 Nov 2011 20:15:38 +0000 (15:15 -0500)]
debugfs: add filefrag command
Add the ability to report on the fragmentation of a file on a file
system opened using debugfs.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 15 Nov 2011 04:31:24 +0000 (23:31 -0500)]
debugfs: add the freefrag command
The freefrag command provides the functionality of e2freefrag on the
currently open file system in debugfs.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 15 Nov 2011 03:01:52 +0000 (22:01 -0500)]
debugfs: build read-only variant of debugfs
Create a version of debugfs which only supports read-only examination
of the file system metadata (but not the data blocks). The idea is
that this version of debugfs might be suitable to be setuid root, and
executable only by members of a particular group, or setgid disk, and
globally executable, depending on the security/privacy policies in
force at a particular site.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 14 Nov 2011 18:33:17 +0000 (13:33 -0500)]
libquota: log an error message if ext2fs_file_open() fails
This also fixes a format string type compiler warning.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Niu Yawei [Mon, 14 Nov 2011 16:36:12 +0000 (11:36 -0500)]
libquota: fix get_dq()
The dq_id should be set on newly created dqout.
Signed-off-by: Niu Yawei <niu@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Niu [Mon, 14 Nov 2011 15:58:28 +0000 (10:58 -0500)]
libquota: fix quota usage compute
In quota_compute_usage(), the space usage should be in bytes but
not quota block.
Signed-off-by: Niu Yawei <niu@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Niu [Mon, 14 Nov 2011 15:58:28 +0000 (10:58 -0500)]
tune2fs: preserve old limits when turn on quota feature
When turn on quota by tune2fs, if the old quota file exist, the quota
usage should be recomputed but the old limits should be preserved.
Signed-off-by: Niu Yawei <niu@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Niu [Mon, 14 Nov 2011 15:58:28 +0000 (10:58 -0500)]
libquota: quota file read support
This patch adds read quota file support, which includes:
- Improve scan dquot APIs & fix defects in scan dquot functions;
- Implement quota_file_open();
- Introduce quota_update_inode() to update usage in old quota file,
and keep the limits unchanged.
Signed-off-by: Niu Yawei <niu@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Aditya Kali [Mon, 14 Nov 2011 15:55:54 +0000 (10:55 -0500)]
mke2fs: Add extended option to select quota type
mke2fs was creating both user and group quota inodes on enabling
the quota feature. This patch adds the extended option 'quotatype'
that can be used to exclusively specify the quota type that the
user wants to initialize.
# Ex: Default behavior without extended option creates both
# user and group quota inodes:
$ mke2fs -t ext4 -O quota /dev/ram1
# To enable only user quotas:
$ mke2fs -t ext4 -O quota -E quotatype=usr /dev/ram1
# To enable only group quotas:
$ mke2fs -t ext4 -O quota -E quotatype=grp /dev/ram1
Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Aditya Kali [Mon, 14 Nov 2011 15:55:54 +0000 (10:55 -0500)]
tune2fs: Compute quota usage when turning on the 'quota' feature
When turning on the quota feature, tune2fs would create empty quota inodes and
set their inode numbers in superblock. This required e2fsck to be ran before
using the quota feature. This patch adds adds call to compute_quota() and make
sure that we write correct quota information in the quota files at tune2fs time
itself. This gets rid of the necessity for running e2fsck after setting the
quota feature. Also, tune2fs now does not use existing old quota files
(aquota.user and aquota.group) even if they exist.
Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Aditya Kali [Mon, 14 Nov 2011 15:55:54 +0000 (10:55 -0500)]
libquota: cleanup libquota code
This patch cleans up the quota code as suggested in previous reviews. This
includes
* remove BUG_ON()s and 'exit()' calls from library code
* remove calls to malloc/free and instead use ext2fs_get/free_mem functions.
* lib/quota/common.c file in not needed anymore and is removed.
* rename exported functions to start with quota_
(ex: init_quota_context --> quota_init_context)
* better error handling in quota library
Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 14 Nov 2011 15:40:43 +0000 (10:40 -0500)]
Make quota support disabled by support
Quota support can be enabled using --enable-quota. There are still
some buglets that we need to fix up before it can be considered 100%
supported, so let's disable it for the 1.42 release.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Robin Dong [Sat, 12 Nov 2011 02:15:55 +0000 (21:15 -0500)]
e2freefrag: fix "Illegal block number" errors with bigalloc file systems
After:
# mke2fs -O ^has_journal,^resize_inode,^uninit_bg,extent,meta_bg,flex_bg,bigalloc /dev/sda
# e2freefrag /dev/sda
It will report error message like:
Illegal block number passed to ext2fs_test_block_bitmap #
1732133 for block bitmap for /dev/sda
Illegal block number passed to ext2fs_test_block_bitmap #
1732134 for block bitmap for /dev/sda
Illegal block number passed to ext2fs_test_block_bitmap #
1732135 for block bitmap for /dev/sda
One bit in bitmap of bigalloc-ext4 means a cluster not a block,
therefore ext2fs_fast_test_block_bitmap2 should check cluster.
Signed-off-by: Robin Dong <sanbai@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Eric Sandeen [Sat, 12 Nov 2011 02:11:43 +0000 (21:11 -0500)]
tests: fix mmp tests on hard 4k devices
Several of the mmp tests were failing on an s390 guest because
direct IO cannot be done on sub-sector sizes, and they were
doing 1k IOs to files on a 4k logical/physical device.
A few tests could just be changed to 4k, but others
needed fixed up output as well.
With this I have all tests passing on s390 again.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Eric Sandeen [Sat, 12 Nov 2011 02:06:04 +0000 (21:06 -0500)]
libext2fs: fix write size in ext2fs_mmp_write
Without this change, we will write data past the end of the
mmp buf. Valgrind catches this:
==6373== Syscall param write(buf) points to unaddressable byte(s)
==6373== at 0x362260E470: __write_nocancel (in /lib64/libpthread-2.12.2.so)
==6373== by 0x41CF83: raw_write_blk (unix_io.c:255)
==6373== by 0x41D2BC: unix_write_blk64 (unix_io.c:757)
==6373== by 0x41A05D: ext2fs_mmp_write (mmp.c:130)
==6373== by 0x40B0C9: do_set_mmp_value (set_fields.c:806)
==6373== by 0x421B61: really_execute_command (execute_cmd.c:108)
==6373== by 0x421C54: ss_execute_line (execute_cmd.c:234)
==6373== by 0x403743: main (debugfs.c:2339)
==6373== Address 0x63f000 is not stack'd, malloc'd or (recently) free'd
and in my testing it led to silent failures while writing the mmp
block in debugfs:
write(3, "xV4\22PMM\342\325V\274N\0\0\0\0host.name."..., 4096) = -1 EFAULT (Bad address)
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Eric Sandeen [Sat, 12 Nov 2011 02:06:04 +0000 (21:06 -0500)]
debugfs: tidy up mmp handling
Several small fixes:
* Gracefully fail mmp commands if fs is not open
* Show magic number in dump_mmp command
* Fix header in output for set_mmp_value -l
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Eric Sandeen [Sat, 12 Nov 2011 02:06:04 +0000 (21:06 -0500)]
debugfs.8: add documentation of the mmp commands
Document the dump_mmp and set_mmp_value commands in
the debugfs manpage.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Thu, 10 Nov 2011 12:33:02 +0000 (07:33 -0500)]
libext2fs: use HAVE_FSTAT64 instead of HAVE_STAT64 for ext2fs_stat()
Commit
6b56f3d92d introduced the use of HAVE_STAT64 without arranging
that it be defined in configure.in. Previously ext4.h used
HAVE_OPEN64, but apparently there are (broken) platforms that have
open64() but not stat64(). Go figure.
We do need to consistently use a single test for ext2fs_stat(),
ext2fs_fstat(), and struct ext2fs_struct_stat, or we could end up
passing a struct stat64 to a fstat() system call, or some such. I've
elected to use HAVE_FSTAT64 because: (a) it's already defined in the
configure script, and (b) if we ever come across a really broken
platform that defines fstat64() but not stat64(), we can always
emulate stat64() using open64() followed by a fstat64().
This commit fixed a bug whose symptoms were that mke2fs would not work
if given a file > 2GB on 32-bit platforms.
Addresses-Debian-Bug: #647245
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Eric Sandeen [Thu, 10 Nov 2011 12:02:04 +0000 (07:02 -0500)]
libext2: advance group in ext2fs_open2 during swapping
Without this change, we go back to getting group descriptor
"0" each time we go around the "for i" loop. It must properly
advance through the filesystem.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 7 Nov 2011 01:27:04 +0000 (20:27 -0500)]
po: rebuild the .gmo files in the debian/rules file
This commit reverts commit
aff534958b0 and transfers the
responsibility of rebuilding the .gmo files to the debian/rules file,
as updating the gmo files can cause problems for other distribution's
building systems. (We do this because we don't update the .gmo files
when doing a mid-release snapshot, since binary files can't be
represented in diff files. So we only update the .po files, and let
the package build process take care of the .gmo files.)
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 5 Nov 2011 18:51:51 +0000 (14:51 -0400)]
libext2fs: don't leak tdb_null out of the shared library namespace
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 17 Oct 2011 02:12:07 +0000 (22:12 -0400)]
Update for e2fsprogs 1.42-WIP-1016 release
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Göran Uddeborg [Mon, 17 Oct 2011 01:53:39 +0000 (21:53 -0400)]
po: update sv.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Jakub Bogusz [Mon, 17 Oct 2011 01:53:39 +0000 (21:53 -0400)]
po: update pl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Benno Schulenberg [Mon, 17 Oct 2011 01:53:39 +0000 (21:53 -0400)]
po: update nl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Samuel Thibault [Mon, 17 Oct 2011 01:53:39 +0000 (21:53 -0400)]
po: update fr.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Philipp Thomas [Mon, 17 Oct 2011 01:53:39 +0000 (21:53 -0400)]
po: update de.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Petr Pisar [Mon, 17 Oct 2011 01:53:39 +0000 (21:53 -0400)]
po: update cs.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 17 Oct 2011 01:50:26 +0000 (21:50 -0400)]
libext2fs: allow ext2fs_get_memalign() to compile w/o posix_memalign()
Addresses-Sourceforge-Bug: #
3219173
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 17 Oct 2011 00:29:00 +0000 (20:29 -0400)]
libext2fs: ext2fs_[set_]file_acl_block needs to check for 64-bit feature flag
The ext2fs_file_acl_block() and ext2fs_set_file_acl_block() needs to
only check i_file_acl_high if the 64-bit flag is set. This is needed
because otherwise we will run into problems on Hurd systems which
actually use that field for h_i_mode_high.
This involves an ABI change since we need to pass ext2_filsys to these
functions. Fortunately these functions were first included in the
1.42-WIP series, so it's OK for us to change them now. (This is why
we have 1.42-WIP releases. :-)
Addresses-Sourceforge-Bug: #
3379227
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sun, 16 Oct 2011 23:29:40 +0000 (19:29 -0400)]
resize2fs: don't fail when shrinking an empty file system
This commit fixes a failure when running the commands:
dd if=/dev/zero of=fs bs=1k count=100k; mke2fs fs; resize2fs -Mp fs
We should not try truncating the file system if there is only a single
block group in the file system.
Addresses-Sourceforge-Bug: #
3404051
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Lukas Czerner [Sun, 16 Oct 2011 22:18:51 +0000 (18:18 -0400)]
resize2fs: Do not fail if EXT4_IOC_RESIZE_FS ioctl doesn't exist
Commit
9f6ba888f027ba added support for new online resize ioctl
EXT4_IOC_RESIZE_FS. It is also trying to avoid failure when this
ioctl() is not supported by the kernel however it is checking wrong
error code (EINVAL).
When the ioctl does not exist, errno is set to ENOTTY, so we should
check for that, rather than EINVAL which means that ioctl arguments
are not valid. So change the code to check for ENOTTY and allow
resize2fs to try to use the old approach. Also add some comments.
Addresses-Red-Hat-Bugzilla: #746284
Addresses-Debian-Bug: #644989
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 10 Oct 2011 00:49:36 +0000 (20:49 -0400)]
Update for e2fsprogs 1.42-WIP-1009 release
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 10 Oct 2011 01:08:47 +0000 (21:08 -0400)]
debian: Add explicit source format to specify 3.0 (quilt)
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Göran Uddeborg [Mon, 10 Oct 2011 01:11:55 +0000 (21:11 -0400)]
po: update sv.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Samuel Thibault [Mon, 10 Oct 2011 01:11:55 +0000 (21:11 -0400)]
po: update fr.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Petr Pisar [Mon, 10 Oct 2011 01:11:55 +0000 (21:11 -0400)]
po: update cs.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 9 Oct 2011 22:18:01 +0000 (18:18 -0400)]
filefrag: fix infinite loop in filefrag
Commit
a00be17e4768 was missing a patch hunk needed to prevent
filefrag from looping forever when it is run without the -v option.
Addresses-Debian-Bug: #644792
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sun, 9 Oct 2011 21:08:47 +0000 (17:08 -0400)]
Fix more spelling errors found by translators and add pluralization
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sun, 9 Oct 2011 20:13:50 +0000 (16:13 -0400)]
po: add @-expansion for @q to the at-expand.pl script
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sun, 9 Oct 2011 19:13:34 +0000 (15:13 -0400)]
e2fsck: fix problem message for PR_1_QUOTA_BAD_MODE
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 8 Oct 2011 17:50:10 +0000 (13:50 -0400)]
dumpe2fs.8.in: add man page warning about mounted file systems
This should be obvious, but apparently not to all users...
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Darrick J. Wong [Sat, 8 Oct 2011 17:36:52 +0000 (13:36 -0400)]
e2fsck: recover revoke blocks on 64bit filesystems correctly
Since the advent of 64bit filesystems, revoke blocks store 64-bit
block numbers instead of 32-bit block numbers. Therefore we need to
be able to handle that case.
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 8 Oct 2011 17:32:00 +0000 (13:32 -0400)]
Fix spelling errors pointed out by translators
Also remove the _("<foo>") marker from a string that was all numbers
and hence didn't need punctuation.
Thanks to Philipp Thomas and Goeran Uddeborg for reporting these
buglets.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 8 Oct 2011 17:28:53 +0000 (13:28 -0400)]
debian: fix gcc-multilib dependency for mipsel as well as mips
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 7 Oct 2011 22:43:50 +0000 (18:43 -0400)]
debian: update the changelog for the e2fsprogs 1.42~WIP-2011-10-05-2 release
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 7 Oct 2011 22:01:31 +0000 (18:01 -0400)]
debian: add a mips-specific dependency on gcc-multilib
The debian mips package has to do some wierd things to include a
64-bit library in the 32-bit binary package.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Thu, 6 Oct 2011 17:28:07 +0000 (13:28 -0400)]
libext2fs: make ext2fs_open_file() always use 3 arguments instead of varargs
Some architectures have narrow mode_t's which can cause some
portability warnings with varargs.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Wed, 5 Oct 2011 19:32:36 +0000 (15:32 -0400)]
debian: Add a dependency on the 1.42~WIP-2011-1005-1 version of libcom_err
Addresses-Debian-Bug: #644425
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Wed, 5 Oct 2011 19:03:59 +0000 (15:03 -0400)]
uuidgen: don't use set_com_err_gettext()
The uuidgen program doesn't use libcom_err.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Wed, 5 Oct 2011 18:47:09 +0000 (14:47 -0400)]
e2fsck: make e2fsck sigcatcher use SIGCHLD rather than SIGCLD
SIGCHLD is more portable than SIGCLD, which is a Linux specific thing
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Wed, 5 Oct 2011 17:26:59 +0000 (13:26 -0400)]
libquota: remove flag argument to commit_dquot()
The flag parameter wasn't being used, and using it meant that we had
to define the COMMIT_* flags, which relied on the QIF_* flags being
present. Removing this allows for increased portability.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>