Commit Graph

3270 Commits (2884320016e633d987203c0286a9dbf9e62a3fd4)

Author SHA1 Message Date
Theodore Ts'o 2884320016 e2fsck: Remove some erroneously leftover blk_t casts
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-01-30 21:15:36 -05:00
Theodore Ts'o c21cde9986 libext2fs: Add some fail-safe checks to the 32-bit bitmap code
If a 64-bit bitmap is passed to a 32-bit bitmap function, add some
checks to make sure that we print a useful error message so we can
better catch potential problems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-01-30 20:20:21 -05:00
Matthias Andree de43f224d4 Add $(LIBINTL) to tst_problem linked libs.
Fixes build problem on systems where gettext() isn't in libc,
such as FreeBSD.

Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-11-16 00:31:06 -05:00
Matthias Andree d0a4e54e6a Disconnect e4defrag from build on non-Linux hosts.
Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-11-16 00:31:06 -05:00
Theodore Ts'o 4486af5b4c Merge branch 'maint' into next
Conflicts:
	misc/mke2fs.c
2009-11-16 00:30:57 -05:00
Eric Sandeen 5827d2412d mke2fs support for BLKDISCARD
Try calling the BLKDISCARD ioctl at mkfs time to pre-discard all blocks
on an ssd, or a thinly-provisioned storage device.

No real error checking; if it fails, it fails, and that's ok - it's
just an optimization.  Also, it cannot work in conjunction with
the undo io manager, for obvious reasons.

Optionally disabled with a "-K" (mnemonic: Keep) option.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-11-15 23:54:03 -05:00
Karel Zak 5f91561ae7 libext2fs: handle <=linux-2.6.19 bug in /proc/swaps
Linux <= 2.6.19 contained a bug in the /proc/swaps code where the
header would not be displayed (the first line).

This issue has been reported by Mike Frysinger for swapon(8).

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-11-13 08:48:29 -05:00
Eric Sandeen 6eb229dc5d libext2fs: don't swap extent-based journal backup
The f_illitable_flexbg test was failing on ppc, because
e2fsck_move_ext3_journal is doing a direct memcmp of i_block with
s_jnl_blocks, and failing.

This is because we don't swap extent data on read from disk; rather
we do it when we access the extents.  However, ext2fs_swap_super
was swapping s_jnl_blocks unconditionally, so these didn't match.

Looks like we need to treat s_jnl_blocks the same as i_block, and
swap it on access, not on read.  Except for the last i_size bit...

Reviewed-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-11-12 19:55:53 -05:00
Eric Sandeen d93d5bbf60 resize2fs: exit fix_sb_journal_backup early for external journal
Resizing a filesystem with an external journal fails when it tries
to read inode 0:

# touch testfs
# truncate testfs 1342177280
# touch testjournal
# truncate testjournal 134217728
# mke2fs -O journal_dev testjournal
# losetup /dev/loop0 testjournal
# mkfs.ext4 -J device=/dev/loop0 testfs 127680
# resize2fs testfs
resize2fs 1.41.9 (22-Aug-2009)
Resizing the filesystem on testfs to 327680 (4k) blocks.
resize2fs: Illegal inode number while trying to resize testfs
Please run 'e2fsck -fy testfs' to fix the filesystem
after the aborted resize operation.

I think the right, simple thing to do is just bail out early
for an external journal here, as there are no backup blocks
to update.

Reported-by: mjevans1983@gmail.com
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-11-12 19:46:56 -05:00
Theodore Ts'o 06ef971be5 libss: initialize function pointer for readline_shutdown()
Clear the function pointer for readline_shutdown() so that if libss is
linking against a readline library which doesn't supply a
readline_shutdown() function, ss_delete_invocation() won't seg fault.

Thanks to Solar Designer <solar@openwall.com> for reporting this
problem to me.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-11-12 17:54:45 -05:00
Theodore Ts'o 97f466394e debian: Fix pre-depends relation for util-linux-ng
Commit 06807d9 had a typo; we need util-linux-ng >= 2.15~rc1-1, not
<< 2.15~rc1-1!

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-28 03:42:47 -04:00
Valerie Aurora Henson 054e5a9ccf Add 64bit option to known incompatible file system options
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25 22:16:19 -04:00
Theodore Ts'o b49f78fe6e Convert ext2fs_group_{first,last}_block() to *block2()
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25 21:24:06 -04:00
Theodore Ts'o 6493f8e85d Convert ext2fs_group_of_blk() to ext2fs_group_of_blk2()
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25 20:50:15 -04:00
Valerie Aurora Henson 48f23054bb Convert ext2fs_block_alloc_stats() calls to block_alloc_stats2()
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25 21:46:58 -04:00
Theodore Ts'o cf828f1a72 libext2fs: Byte-swap 64-bit block group descriptors
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25 21:46:01 -04:00
Valerie Aurora Henson d7cca6b06f Convert to use block group accessor functions
Convert direct accesses to use the following block group accessor
functions: ext2fs_block_bitmap_loc(), ext2fs_inode_bitmap_loc(),
ext2fs_inode_table_loc(), ext2fs_bg_itable_unused(),
ext2fs_block_bitmap_loc_set(), ext2fs_inode_bitmap_loc_set(),
ext2fs_inode_table_loc_set(), ext2fs_bg_free_inodes_count(),
ext2fs_ext2fs_bg_used_dirs_count(), ext2fs_bg_free_inodes_count_set(),
ext2fs_bg_free_blocks_count_set(), ext2fs_bg_used_dirs_count_set()

Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: Nick Dokos <nicholas.dokos@hp.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25 21:43:47 -04:00
Theodore Ts'o cd65a24e75 libext2fs: Convert ext2fs_bg_flag_test() to ext2fs_bg_flags_test()
After cleaning up ext2fs_bg_flag_set() and ext2fs_bg_flag_clear(),
we're left with ext2fs_bg_flag_test().  Convert it to
ext2fs_bg_flags_test().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25 21:42:12 -04:00
Eric Sandeen e633b58ac7 libext2fs: clean up ext2fs_bg_flags_ interfaces
The ext2fs_bg_flag* functions were confusing.

Currently we have this:

void ext2fs_bg_flags_set(ext2_filsys fs, dgrp_t group, __u16 bg_flags);
void ext2fs_bg_flags_clear(ext2_filsys fs, dgrp_t group,__u16 bg_flags);

(_set (unused) sets exactly bg_flags; _clear clears all and ignores bg_flags)

and these, which can twiddle individual bits in bg_flags:

void ext2fs_bg_flag_set(ext2_filsys fs, dgrp_t group, __u16 bg_flag);
void ext2fs_bg_flag_clear(ext2_filsys fs, dgrp_t group, __u16 bg_flag);

A better interface, after the patch below, is just:

ext2fs_bg_flags_zap(fs, group) /* zeros bg_flags */
ext2fs_bg_flags_set(fs, group, flags) /* adds flags to bg_flags */
ext2fs_bg_flags_clear(fs, group, flags) /* clears flags in bg_flags */

and remove the original ext2fs_bg_flags_set / ext2fs_bg_flags_clear.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25 21:41:32 -04:00
Eric Sandeen 03b9dca63a debugfs: open file systems using EXT2_FLAG_64BITS
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25 21:41:13 -04:00
Theodore Ts'o 72a729dbf9 Merge branch 'maint' into next
Conflicts:
	configure
	configure.in
2009-10-24 15:14:54 -04:00
Theodore Ts'o 06807d9fa6 debian: Add pre-depends for util-linux for util-linux-ng builds
Addresses-Debian-Bug: #551795

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-24 15:04:54 -04:00
Michael Roth ca3b06e700 Update .gitignore
Signed-off-by: Michael Roth <mroth@nessie.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-10-24 14:28:23 -04:00
Theodore Ts'o c5fbf38855 tune2fs.8: Clarify tune2fs's -i option
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-24 14:25:39 -04:00
Theodore Ts'o 77f464fb19 dumpe2fs: Fix usage message for -o superblock=<num> and -o blocksize=<num>
Addresses-Launchpad-Bug: #448099

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-24 14:15:55 -04:00
Eric Sandeen beb736b4c4 configure.in: Fix typo: remove '2' from blkid_probe_get_topology2
I think vim <esc>wq turned into <esc>2wq or something; in any case
blkid_probe_get_topology2 is not the right thing to search for.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
2009-10-21 03:43:02 -04:00
Theodore Ts'o 5d10807070 libext2fs: Fix FEATURE_RO_COMPAT_HUGE_FILE && !HUGE_FILE_FL
If the RO compat HUGE_FILE feature flag is set, but the inode's
HUGE_FILE_FL flag is not set, we should still pay attention to the
high 32 bits of the i_blocks filed.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-21 01:46:58 -04:00
Theodore Ts'o ba5131f6d4 e2fsck: Accept superblock times to be fudged by up to 24 hours by default
Unfortunately, due to Windows' unfortunate design decision to
configure the hardware clock to tick localtime, instead of the more
proper and less error-prone UTC time, many users end up in the
situation where the system clock is incorrectly set at the time when
e2fsck is run.

Historically this was usually due to some distributions having buggy
init scripts and/or installers that didn't correctly detect this case
and take appropriate countermeasures.  However, it's still possible,
despite the best efforts of init script and installer authors to not
be able to detect this misconfiguration, usually due to a buggy or
misconfigured virtualization manager or the installer not having
access to a network time server during the installation process.  So
by default, we allow the superblock times to be fudged by up to 24
hours.  This can be disabled by setting options.accept_time_fudge to
the boolean value of false in e2fsck.conf.  The old
options.buggy_init_scripts is left for backwards compatibility.

Since we are now accepting the 24 hour time fudge by default, there is
no longer a need to install an Ubuntu-specific e2fsck.conf file, so we
can remove it.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-16 20:59:20 -04:00
Theodore Ts'o 8a8f36540b e2fsck: Fix handling of non-zero i_blocks_high field
E2fsck was not properly printing the i_blocks field in filesystem
corruption messages, and it was not properly checking i_blocks_hi and
i_blocks_lo, either.  This commit fixes this.

Thanks to Felipe Conteras for pointing this out.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-12 21:59:37 -04:00
Theodore Ts'o 95bcea9fc1 Merge branch 'maint' into next
Conflicts:
	configure
	configure.in
	misc/mke2fs.c
2009-10-04 20:40:46 -04:00
Theodore Ts'o 695706ca21 e2fsck: Interpret negative blkcount in file system problem reports
Non-expert users get confused when they see messages like this:

Illegal block #-1 (2291965952) in inode 176. CLEARED.

So change it to be something a little bit more understandable:

Illegal indirect block (2291965952) in inode 176.  CLEARED.

Addresses-SourceForge-Bug: #2871782

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-04 18:02:24 -04:00
Theodore Ts'o f790bc33b2 libext2fs: Always build file_io.c
Commit 1d9b818: dumpe2fs: Print more information about the inline journal
caused dumpe2fs to use ext2fs_file_open2().  Previously the file_io
functions were only used by debugfs, so if debugfs was disabled,
file_io was not built.  Now that dumpe2fs is also using file_io, we
need to build it unconditionally.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-04 16:29:17 -04:00
Theodore Ts'o a321afa8b7 tests: Account for new mke2fs topology information
The previous commit adds a new line printed by mke2fs with the
filesystem/device topology information.  Update the regression test's
expected output to account for this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-04 16:21:13 -04:00
Eric Sandeen 9ed8e5fec2 mke2fs: get device topology values from blkid
Handle automatic selection of stride/stripe:

mke2fs 1.41.9 (22-Aug-2009)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=16 blocks, Stripe width=32 blocks
...

And warn on block device misalignment:

mke2fs 1.41.9 (22-Aug-2009)
/dev/sdc1 alignment is offset by 32256 bytes.
This may result in very poor performance, (re)-partitioning suggested.
Proceed anyway? (y,n)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-10-04 15:09:18 -04:00
Theodore Ts'o e1f0850795 Don't use in-tree header files if using system uuid or blkid libraries
This commit forces the use of the system-provided blkid or uuid header
files if we are using the system-provided blkid or uuid libraries.
This avoids using the in-tree header files with the system libraries.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-04 14:45:08 -04:00
Theodore Ts'o 61a9d2b33e e2fsck: Use the correct problem code in the case of LAST_WRITE_FUDGED
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-03 23:17:45 -04:00
Theodore Ts'o 7822f784f1 blkid: Avoid a potentially error message when running "make clean"
This error isn't terribly important, but apparently it causes some
users/developers distress.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-03 22:33:47 -04:00
Peng Tao 2d7ef236b7 debugfs: add matching fclose
If the cmd_file is not stdin, we should close the file handle via fclose().
Thanks David Binderman to point this out.

Addresses-Novell-Bugzilla: #524526

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-10-03 22:30:37 -04:00
Cristian Rodríguez 484ddc8767 fix fd leak that causes fsck to fail with "too many open files"
fsck leaks fds when invoked with -R -A -M -a -t noopts=nofail

Signed-off-by: Cristian Rodríguez <crrodriguez@opensuse.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-10-03 13:38:47 -04:00
Theodore Ts'o 04f13d6685 libext2fs: Add error table initialization to test programs
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-08 21:33:03 -04:00
Theodore Ts'o 1d4a493fa2 e2undo: Initialize com_err error tables for the ext2fs library
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-08 21:29:21 -04:00
Valerie Aurora Henson 048786d7e8 debugfs: Convert to support 64-bit filesystems
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: Nick Dokos <nicholas.dokos@hp.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07 22:46:17 -04:00
Valerie Aurora Henson 4efbac6fed Convert uses of super->s_*_blocks_count to ext2fs_*_blocks_count()
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: Nick Dokos <nicholas.dokos@hp.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07 20:46:34 -04:00
Valerie Aurora Henson a63745e81c Use ext2fs_file_acl_block() instead of using .i_file_acl directly
This provides support for 48-bit file acl blocks.

Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07 22:29:45 -04:00
Valerie Aurora Henson c5b7b6babe Fix overflow in calculation of total file system blocks
Blocks per group and group desc count are both 32-bit; multiplied they
produce a 32-bit quantity which overflowed.

Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07 21:23:03 -04:00
Theodore Ts'o 51e6459491 libext2fs: Round up the bitmap size when allocating a new bitmap
The x86 BT assembly instructure can overshoot the end of a bit array
when testing a bit at the end of the bit array, even if it never needs
to look at those memory locations.  This can cause a spurious
segmentation fault.  If we allocate a little extra memory, it avoids
this problem.  See:

	http://faydoc.tripod.com/cpu/bt.htm

This doesn't happen on Linux, probably because of the glibc's malloc()
function works, but apparently it's a major problem on the *BSD
operating systems.

Addresses-Sourceforge-Bug: #2328708

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07 16:21:49 -04:00
Theodore Ts'o 7a9f055f0e mke2fs.8.in: Clarify flex_bg feature description
Add a more explicit description of how specifying the flex_bg file
system feature changes the layout of the per-block group metadata.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07 16:21:32 -04:00
Theodore Ts'o 73ebdf9972 tune2fs.8: Document the flex_bg file system option in the man page
Addresses-Sourceforge-Bug: #2822186

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07 16:21:32 -04:00
Peng Tao 2884d208a3 resize2fs: fix minimum resize size calculation with flex_bg
When flex_bg is on, calculate_minimum_resize_size() should add more meta
blocks for newly added flex_bg.

Addresses-RedHat-Bugzilla: #519131
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-09-07 16:21:19 -04:00
Peng Tao 1d8af189bd resize2fs: calculate minimal fs size only once
When running resize2fs -M, no need to recalculate the minimal fs size.

Signed-off-by: "Peng Tao" <bergwolf@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-09-07 14:20:52 -04:00