OSDN Git Service

android-x86/external-e2fsprogs.git
15 years agopo: update zh_CN.po (from translationproject.org)
Dark Raven [Tue, 26 May 2009 02:45:42 +0000 (22:45 -0400)]
po: update zh_CN.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 years agoresize2fs: don't try to resize below calculated minimum
Eric Sandeen [Mon, 18 May 2009 22:11:28 +0000 (17:11 -0500)]
resize2fs: don't try to resize below calculated minimum

Without a force flag, don't allow resize2fs to even start resizing
below what it thinks the minimum safe value is.

This may stop resizes which could otherwise proceed with a bit
of space still left, but seems like a reasonably safe thing to do.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 years agoresize2fs: fix minimum size calculations
Eric Sandeen [Mon, 18 May 2009 22:02:32 +0000 (17:02 -0500)]
resize2fs: fix minimum size calculations

The extra padding added to the minimum size calculations:

        /*
         * We need to reserve a few extra blocks if extents are
         * enabled, in case we need to grow the extent tree.  The more
         * we shrink the file system, the more space we need.
         */
        if (fs->super->s_feature_incompat & EXT3_FEATURE_INCOMPAT_EXTENTS)
                blks_needed += (fs->super->s_blocks_count - blks_needed)/500;

can go quite wrong if we've already added up more "blks_needed"
than our current size, and the above subtraction wraps.  This can
easily happen for a filesystem which is almost completely full.

In this case, just return the current fs size as the minimum and
be done with it.

With this fix we could probably call calculate_minimum_resize_size()
for each resize2fs invocation and refuse to resize smaller than that?

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 years agoresize2fs: fix ENOSPC corruption case
Eric Sandeen [Wed, 20 May 2009 21:36:26 +0000 (16:36 -0500)]
resize2fs: fix ENOSPC corruption case

http://people.redhat.com/esandeen/livecd-creator-imagefile.bz2
contains an image (for now) which, when resized to 578639, corrupts
the filesystem.

This is a bit crazy, I guess, because the fs currently has only
1 free block, but still, we should be graceful about the failure.
Perhaps it would make sense to check the requested valuea against
the minimum value resize2fs would compute for "-P" and fail (at
least without a force).

But in any case, this exposed 2 bugs when moving that one block
required an extent split, which is what hit the ENOSPC.

For starters, ext2fs_extent_set_bmap() in the "(re/un)mapping last
block in extent" case was replacing the old extent before the
new one was created; when the new extent creation failed, it
left us in an inconsistent state.  Simply changing the order of
the two should fix this problem.

Next, ext2fs_extent_insert was calling ext2fs_extent_delete()
on *any* error, including one caused by failure to allocate a new
block to split the node to hold that extent ... the handle was left
unchanged, and we deleted the -original- extent.

As a quick fix for this, just don't do the delete if we fail the split,
though this may need to be smarter.  I don't think we have terribly
consistent behavior about where a handle is left on various errors.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 years agoe2fsck: Fix journal replay bug which reverts changes to the bg descriptors
Theodore Ts'o [Tue, 26 May 2009 00:14:04 +0000 (20:14 -0400)]
e2fsck: Fix journal replay bug which reverts changes to the bg descriptors

Fix a regression in e2fsprogs 1.41.5 which would undo updates to the
block group descriptors after a journal replay, caused by commit
b7c5b403.  We now use ext2fs_free() instead of ext2fs_close() to make
sure we the library will never try to write out superblock or block
group descriptors.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoe2fsck: initialize error handling before journal replay
Andreas Dilger [Mon, 18 May 2009 03:03:04 +0000 (23:03 -0400)]
e2fsck: initialize error handling before journal replay

One of our customers hit a temporary IO error during an e2fsck run during
the read from the journal.  It seems that the read error resulted in
e2fsck automatically discarding the journals and recreating them on several
filesystems on this node without any prompting from the user:

   end_request: I/O error, dev sdg, sector 484832
   Buffer I/O error on device sdg, logical block 60604
   fsck-sdg[8276]: ls2-OST024c: Superblock has an invalid ext3 journal (inode 8).
   fsck-sdg[8276]: CLEARED.
   fsck-sdg[8276]: *** ext3 journal has been deleted - filesystem is now ext2
   only ***
   fsck-sdg[8276]: ls2-OST024c was not cleanly unmounted, check forced.
   fsck-sdg[8276]: ls2-OST024c: Journal inode is not in use, but contains data.
   CLEARED.
   fsck-sdg[8276]: ls2-OST024c: Recreate journal to make the filesystem ext3
   again?
   fsck-sdg[8276]: FIXED.
   fsck-sdg[8276]: Creating journal (32768 blocks):  Done.
   fsck-sdg[8276]:
   fsck-sdg[8276]: *** journal has been re-created - filesystem is now ext3 again
   ***
   fsck-sdg[8276]: ls2-OST024c: 39818/20183248 files (8.2% non-contiguous), 222122257/779902976 blocks
   fsck-sdg[8276]: exit code 1 (file system errors corrected)

The following patch moves the e2fsck error handler initialization earlier
in the e2fsck startup code before the journal is processed, so that the
user will be prompted for an action.  This is the first IO that is not
part of ext2fs_open() where fs->io is first initialized.

It doesn't seem possible to initialize the error handlers for the initial
filesystem open without changing the prototype for ext2fs_open2().  If we
are getting a new ext2fs_open3() prototype for 64-bit it might make sense
to add at least "read_error" as a parameter ("write_error" is not strictly
necessary for the open and could be set afterward).

Signed-off-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoblkid: Don't use a hard-coded path for /bin/rm in test_probe.in
Theodore Ts'o [Mon, 18 May 2009 02:19:21 +0000 (22:19 -0400)]
blkid: Don't use a hard-coded path for /bin/rm in test_probe.in

Addresses-Sourceforge-Bug: #2780205

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoe2fsck: Don't crash if an inode with a bad extent header is not cleared
Theodore Ts'o [Sun, 17 May 2009 12:42:52 +0000 (08:42 -0400)]
e2fsck: Don't crash if an inode with a bad extent header is not cleared

If ext2fs_extent_open() fails due to a corrupt extent header, and the
user declines to clear the inode, check_blocks_extents() should bail
out; otherwise, it will cause a core dump due a null pointer
dereference.

Addresses-Sourceforge-Bug: #2791794

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoAdd missing file: lib/ext2fs/fiemap.h
Theodore Ts'o [Mon, 4 May 2009 11:39:56 +0000 (07:39 -0400)]
Add missing file: lib/ext2fs/fiemap.h

This file is needed so the updated filefrag program will compile.  I
missed a "git add"; oops.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoblkid: use /sys/block/dm-<N>/dm/name
Karel Zak [Mon, 27 Apr 2009 13:00:58 +0000 (15:00 +0200)]
blkid: use /sys/block/dm-<N>/dm/name

The Linux kernel (since 2.6.29, patch 784aae735d9b0bba3f8b9faef4c8b30df3bf0128)
exports the real DM device names in /sys/block/<ptname>/dm/name.

The sysfs based solution is nicer and faster than scan for devno in
/dev/mapper/.

CC: Milan Broz <mbroz@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 years agoblkid: use /dev/mapper/<name> rather than /dev/dm-<N>
Karel Zak [Mon, 27 Apr 2009 13:00:57 +0000 (15:00 +0200)]
blkid: use /dev/mapper/<name> rather than /dev/dm-<N>

The libblkid (since v1.41.1) returns private device-mapper names (e.g.
/dev/dm-0). It's because the probe_one() function scans /dev before
/dev/mapper.

brw-rw---- 1 root disk 253, 0 2009-04-27 13:41 /dev/dm-0
brw-rw---- 1 root disk 253, 0 2009-04-27 13:41 /dev/mapper/TestVolGroup-TestLogVolume

Old version:
  # blkid -t LABEL="TEST-LABEL" -o device
  /dev/dm-0

Fixed version:
  # blkid -t LABEL="TEST-LABEL" -o device
  /dev/mapper/TestVolGroup-TestLogVolume

Addresses-Red-Hat-Bug: #497259
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 years agoe2fsck: cleanup whitespace in problem.c and problem.h
Andreas Dilger [Tue, 28 Apr 2009 18:59:07 +0000 (12:59 -0600)]
e2fsck: cleanup whitespace in problem.c and problem.h

Cleanup whitespace in the problem.h and problem.c files.  Removes a
bunch of places where tabs follow spaces, whitespace on empty lines, etc.
I didn't reformat the indenting of the entire problem.h error codes,
but there is some room for doing this...

Signed-off-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 years agoe2fsck: Add test code in problem.c to verify problem codes
Andreas Dilger [Mon, 27 Apr 2009 22:59:24 +0000 (16:59 -0600)]
e2fsck: Add test code in problem.c to verify problem codes

We've hit a number of cases where the error codes in problem.h have
been assigned duplicate values compared to problems in our own e2fsck
patches, and this can lead to confusing and difficult to find bugs
in e2fsck (e.g. wrong problem messages, incorrect repair action, etc).

Attached is a test case for the problem.c file to ensure that the
problem table is sorted and does not contain any duplicate values.
Having the problem table sorted allows the correctness checking to be
very simple, and if it ever became important for performance we could
use binary searching of the problem table for the specific problem code.

Signed-off-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 years agofilefrag: Add support to use the FIEMAP ioctl
Kalpak Shah [Sun, 3 May 2009 01:02:29 +0000 (21:02 -0400)]
filefrag: Add support to use the FIEMAP ioctl

The FIEMAP ioctl is more efficient and doesn't require root
privileges.  So if it is available, use it in preference to repeated
FIBMAP calls.

Signed-off-by: Kalpak Shah <kalpak.shah@sun.com>
Signed-off-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoAvoid unneeded updates of block group descriptors in ext2fs_closefs()
Theodore Ts'o [Sun, 3 May 2009 00:59:04 +0000 (20:59 -0400)]
Avoid unneeded updates of block group descriptors in ext2fs_closefs()

If the superblock is clean, and we only need to update
s_kbytes_written, then we only need to update the superblock.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoe2fsck: Skip journal checks if the fs is mounted and doesn't need recovery
Theodore Ts'o [Tue, 28 Apr 2009 13:09:44 +0000 (09:09 -0400)]
e2fsck: Skip journal checks if the fs is mounted and doesn't need recovery

If we are checking a mounted filesystem (typically the root
filesystem, mounted read/only) and the NEEDS_RECOVERY flag is not set,
skip all of the checks associated with making sure the journal is
consistent.  There is the very slight possibility we could lose if the
NEEDS_RECOVERY flag was somehow cleared even though there was data in
the journal, but this has practically never happend in practice, and
it reduces the number of reads required at boot-time, which is a big
deal when trying to reduce boot times with HDD's.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agodebian: Add a build depends indicating we need a dietlibc newer than 0.30
Theodore Ts'o [Sat, 25 Apr 2009 17:02:15 +0000 (13:02 -0400)]
debian: Add a build depends indicating we need a dietlibc newer than 0.30

Addresses-Debian-Bug: #506064

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agodebian: Fix distribution name in changelog to be unstable
Theodore Ts'o [Fri, 24 Apr 2009 12:32:07 +0000 (08:32 -0400)]
debian: Fix distribution name in changelog to be unstable

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoUpdate release notes, version string, etc. for E2fsprogs 1.41.5 release
Theodore Ts'o [Fri, 24 Apr 2009 02:44:16 +0000 (22:44 -0400)]
Update release notes, version string, etc. for E2fsprogs 1.41.5 release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoUpdate translation template file for 1.41.5 release
Theodore Ts'o [Fri, 24 Apr 2009 02:25:18 +0000 (22:25 -0400)]
Update translation template file for 1.41.5 release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoUpdate lib/ext2fs/Makefile.in using "make depend"
Theodore Ts'o [Fri, 24 Apr 2009 02:24:51 +0000 (22:24 -0400)]
Update lib/ext2fs/Makefile.in using "make depend"

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoe2fsck: On a 32-bit filesystem, make sure i_file_acl_high is zero
Theodore Ts'o [Fri, 24 Apr 2009 01:31:16 +0000 (21:31 -0400)]
e2fsck: On a 32-bit filesystem, make sure i_file_acl_high is zero

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoInterim commit for Debian release -- 1.41.4-3
Theodore Ts'o [Thu, 23 Apr 2009 05:57:51 +0000 (01:57 -0400)]
Interim commit for Debian release -- 1.41.4-3

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agolibext2fs: read the block group descriptors more efficiently
Theodore Ts'o [Thu, 23 Apr 2009 05:30:42 +0000 (01:30 -0400)]
libext2fs: read the block group descriptors more efficiently

When opening a filesystem, make ext2fs_open2() much more efficient by
reading the normal block group descriptors all at once, instead of one
block at a time.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoe2fsck: Reduce unnecessary I/O when checking backup superblock
Theodore Ts'o [Thu, 23 Apr 2009 05:27:07 +0000 (01:27 -0400)]
e2fsck: Reduce unnecessary I/O when checking backup superblock

E2fsck needs to check to see if the backup superblock differs from the
primary superblock.  Previously it was doing so by calling
ext2fs_open(), which does a lot of unnecessary work, including reading
all of the backup block group descriptors.  Avoid this by reading in
the backup superblock directly.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoe2fsck: Don't test the resize_inode if the filesystem is clean
Theodore Ts'o [Thu, 23 Apr 2009 04:39:06 +0000 (00:39 -0400)]
e2fsck: Don't test the resize_inode if the filesystem is clean

Move check_resize_inode() out of check_super_block(), since we only
need to test the resize_inode for correctness only if the filesystem
requires checking.  This change avoids a lot of I/O operations which
slows down a 1 second boot.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoblkid: remove whole-disk entries from cache when partitions are found
Eric Sandeen [Thu, 23 Apr 2009 03:51:51 +0000 (22:51 -0500)]
blkid: remove whole-disk entries from cache when partitions are found

We can get into a situation in blkid where whole disks remain
in the cache, even though partitions are found.  For labels
such as sun disklabels which may have the first partition
beginning at sector 0, this is even somewhat likely.

1) create a sun disklabel w/partitions
2) mkfs the first partition (at sector 0)
3) remove the partition table
4) run blkid - this finds the fs on the whole disk, places in cache
5) recreate the partition table
6) run blkid - this finds the partition, places in cache

And now we have both /dev/sda and /dev/sda1 in cache.

There are heuristics in probe_all to avoid putting the whole disk
in cache if it has partitions, but there is nothing to remove the
whole-disk entry in the above case.  I think the below patch
suffices, although I haven't quite convinced myself that setting
the lens[which]=0; is the right logic for that bit of state...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agomke2fs.8: Clarify in the man page that fs defaults come from mke2fs.conf
Theodore Ts'o [Thu, 23 Apr 2009 02:36:36 +0000 (22:36 -0400)]
mke2fs.8: Clarify in the man page that fs defaults come from mke2fs.conf

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agolibext2fs: Skip relative pathnames in /etc/mtab in ismounted.c
Theodore Ts'o [Thu, 23 Apr 2009 02:20:22 +0000 (22:20 -0400)]
libext2fs: Skip relative pathnames in /etc/mtab in ismounted.c

The functions which test to see if a device is mounted can get
confused by entries in /etc/mtab for virtual filesystems:

rootfs / rootfs rw 0 0
none /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0

If the device name doesn't start with a slash, ignore the /etc/mtab
entry, so that relative pathnames passed into functions such as
ext2fs_check_mount_point() or ext2fs_check_if_mounted() don't return
false positives.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agotune2fs: Fix format string warnings
Theodore Ts'o [Wed, 22 Apr 2009 19:13:37 +0000 (15:13 -0400)]
tune2fs: Fix format string warnings

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agologsave: Fix warn_unused_result warnings from gcc
Theodore Ts'o [Wed, 22 Apr 2009 19:12:40 +0000 (15:12 -0400)]
logsave: Fix warn_unused_result warnings from gcc

Fixed a potential bug where by partial returns from the write(2)
system call could some bytes to be lost when writing to the log file.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoresize2fs: Print a warning message if the ftruncate system call fails
Theodore Ts'o [Wed, 22 Apr 2009 19:10:36 +0000 (15:10 -0400)]
resize2fs: Print a warning message if the ftruncate system call fails

Resize2fs will attempt to truncate an image file of a filesystem down
to size for the convenience of the system administrator.  If the
truncate operation fails, print a warning message.  This also avoids a
gcc warning message.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoe2fsck: Fix warn_unused_result warnings from gcc
Theodore Ts'o [Wed, 22 Apr 2009 19:09:41 +0000 (15:09 -0400)]
e2fsck: Fix warn_unused_result warnings from gcc

Fixed a potential bug where by partial returns from the write(2)
system call could lost characters to be sent to external progress bar
display program.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agodebugfs: Fix format string warnings in htree_dump_leaf_node()
Theodore Ts'o [Wed, 22 Apr 2009 19:08:36 +0000 (15:08 -0400)]
debugfs: Fix format string warnings in htree_dump_leaf_node()

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agolibext2fs: Fix format string type warnings in alloc_stats.c
Theodore Ts'o [Wed, 22 Apr 2009 19:07:00 +0000 (15:07 -0400)]
libext2fs: Fix format string type warnings in alloc_stats.c

Fix gcc warnings caused by wrong types passed com_err() in
ext2fs_inode_alloc_stats2 and in ext2fs_block_alloc_stats().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agolibss: Fix warn_unused_result warnings from gcc
Theodore Ts'o [Wed, 22 Apr 2009 18:48:59 +0000 (14:48 -0400)]
libss: Fix warn_unused_result warnings from gcc

Fixed a potential bug where by partial returns from the write system
call could the fallback pager to drop characters.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agolibss: ss_execute_line: reflect any error codes from system() to the caller
Theodore Ts'o [Wed, 22 Apr 2009 18:46:48 +0000 (14:46 -0400)]
libss: ss_execute_line: reflect any error codes from system() to the caller

This is primarily to silence a gcc warning, but it's better to reflect
the error from system() up to the caller.  In this case we don't
actually use it for anything, but that's OK.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agolibcom_err: Declare prototypes for et_list_lock/unlock in com_err.h
Theodore Ts'o [Wed, 22 Apr 2009 18:41:32 +0000 (14:41 -0400)]
libcom_err: Declare prototypes for et_list_lock/unlock in com_err.h

Define the prototypes for et_list_lock() and et_list_unlock() in
com_err.h.  This promotes better error checking and avoids warnings
when compiling the library and programs that call these functions.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agolibe2p: Declare prototypes for the journal feature name functions in e2p.h
Theodore Ts'o [Wed, 22 Apr 2009 18:35:45 +0000 (14:35 -0400)]
libe2p: Declare prototypes for the journal feature name functions in e2p.h

Define the prototypes for e2p_jrnl_feature2string() and
e2p_jrnl_string2feature() in e2p.h.  This promotes better error
checking and avoids warnings when compiling the library and programs
that call these functions.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoconfigure.in: add --disable-libblkid option
Theodore Ts'o [Wed, 22 Apr 2009 13:18:30 +0000 (09:18 -0400)]
configure.in: add --disable-libblkid option

Add an option to switch between the private (in-tree) libblkid and
public (in-system installed) library.  The private version is still
enabled by default.

If --disable-libblkid is specified the findfs(8) program, which is a
variant of tune2fs, is also not built or installed.

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoExplain the significance of the 'T' attribute in the chattr.1 man page
Theodore Ts'o [Wed, 22 Apr 2009 02:18:19 +0000 (22:18 -0400)]
Explain the significance of the 'T' attribute in the chattr.1 man page

Addresses-Debian-Bug: #365619

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agopo: Add Chinese (simplified) translation from the Translation Project
Theodore Ts'o [Wed, 22 Apr 2009 02:09:01 +0000 (22:09 -0400)]
po: Add Chinese (simplified) translation from the Translation Project

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agodebian: Update debhelper compat level to 7
Theodore Ts'o [Mon, 20 Apr 2009 12:12:15 +0000 (08:12 -0400)]
debian: Update debhelper compat level to 7

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agodebian: Update copyright files to point the correct common license files
Theodore Ts'o [Mon, 20 Apr 2009 11:49:26 +0000 (07:49 -0400)]
debian: Update copyright files to point the correct common license files

This fixes the Lintian warning:

   The copyright file refers to the versionless symlink in
   /usr/share/common-licenses for the full text of the GPL, LGPL, or GFDL
   license, but the package does not appear to allow distribution under
   later versions of the license. This symlink will change with each
   release of a new version of the license and may therefore point to a
   different version than the package is released under. debian/copyright
   should instead refers to the specific version of the license that the
   package references.

   For example, if the package says something like "you can redistribute it
   and/or modify it under the terms of the GNU General Public License as
   published by the Free Software Foundation; version 2 dated June, 1991,"
   the debian/copyright file should refer to
   /usr/share/common-licenses/GPL-2, not /GPL.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agodebian: Put the *-dbg packages in the debug section as requested by Lintian
Theodore Ts'o [Mon, 20 Apr 2009 11:46:08 +0000 (07:46 -0400)]
debian: Put the *-dbg packages in the debug section as requested by Lintian

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoInterim commit for Debian release -- 1.41.4-2
Theodore Ts'o [Mon, 20 Apr 2009 03:06:45 +0000 (23:06 -0400)]
Interim commit for Debian release -- 1.41.4-2

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoresize2fs: Fix corruption bug impacting ext4 filesystems with uninit_bg
Theodore Ts'o [Sun, 19 Apr 2009 02:42:13 +0000 (22:42 -0400)]
resize2fs: Fix corruption bug impacting ext4 filesystems with uninit_bg

Due to a fencepost bug, when skipping a block group whose block bitmap
was uninitialized (and hence could not contain any blocks eligible for
relaocation), the block immediately following the block group wasn't
checked as well.  If it was in use and required relocation, it
wouldn't get properly relocated, with the result that an inode using
such a block would end up, post resize, with a pointer to a block now
outside the bounds of the filesystem.

This commit fixes this fencepost error.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoresize2fs: Fix data corruption bug when shrinking the inode table for ext4
Theodore Ts'o [Sun, 19 Apr 2009 02:32:03 +0000 (22:32 -0400)]
resize2fs: Fix data corruption bug when shrinking the inode table for ext4

If we need to shrink the inode table, we need to make sure the inodes
contained in the part of the inode table we are vacating don't get
reused as part of the filesystem shrink operation.  This wasn't a
problem with ext3 filesystems, since the inode table was located in
the block group that was going away, so that location was not eligible
for reallocation.

However with ext4 filesystems with flex_bg enabled, it's possible for
a portion of the inode table in the last flex_bg group to be
deallocated, but in a part of the filesystem which could be used as
data blocks.  So we must mark those blocks as reserved to prevent
their reuse, and adjust the minimum filesystem size calculation to
assure that we don't shrink a filesystem too small for the resize
operation to succeed.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoresize2fs: Fix data corruption bug when growing an ext4 filesystem off-line
Theodore Ts'o [Sat, 18 Apr 2009 17:31:54 +0000 (13:31 -0400)]
resize2fs: Fix data corruption bug when growing an ext4 filesystem off-line

When allocating a new set of block group metadata as part of growing
the filesystem, the resize2fs code assumes that the bitmap and inode
table blocks are in their own block group; an assumption which is
changed by the flex_bg feature.  This commit works around the problem
by temporarily turning off flex_bg while allocating the new block
group metadata, to avoid potentially overwriting previously allocated
data blocks.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agotune2fs: Clarify manpage regarding how to see the current settings
Theodore Ts'o [Sat, 18 Apr 2009 15:39:22 +0000 (11:39 -0400)]
tune2fs: Clarify manpage regarding how to see the current settings

Addresses-Debian-Bug: #515693

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agodebian: Add homepage field to the control file
Theodore Ts'o [Sat, 18 Apr 2009 15:37:35 +0000 (11:37 -0400)]
debian: Add homepage field to the control file

Addresses-Debian-Bug: #506279

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoe2fsck, tune2fs: Fix Hurd compilation problem due to lack of PATH_MAX
Theodore Ts'o [Sat, 18 Apr 2009 14:53:32 +0000 (10:53 -0400)]
e2fsck, tune2fs: Fix Hurd compilation problem due to lack of PATH_MAX

Hurd doesn't define PATH_MAX, so calculate the exact size needed for
the tdb filename, and allocate it dynamically.

Addresses-Debian-Bug: #521602

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agodebugfs: Teach the set_inode_fields_command how to set i_file_acl_high
Theodore Ts'o [Sat, 18 Apr 2009 13:41:04 +0000 (09:41 -0400)]
debugfs: Teach the set_inode_fields_command how to set i_file_acl_high

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agodebugfs: Print 64-bit file acl
Theodore Ts'o [Sat, 18 Apr 2009 13:40:26 +0000 (09:40 -0400)]
debugfs: Print 64-bit file acl

This is necessary so we can debug filesystem corruptions caused by the
i_file_acl bogusly getting set.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agouuidd: Fix warn_unused_result warnings from gcc
Theodore Ts'o [Sat, 18 Apr 2009 13:14:31 +0000 (09:14 -0400)]
uuidd: Fix warn_unused_result warnings from gcc

Fixed a potential bug caused by partial returns from the write system
call (especially possible for network connections).

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agolibuuid: Close all file descriptors before running uuidd
Theodore Ts'o [Wed, 15 Apr 2009 17:05:09 +0000 (13:05 -0400)]
libuuid: Close all file descriptors before running uuidd

This avoids problems when the calling program has open file
descriptors (especially sockets) open.

Also fix up some warn_unused_result warnings from gcc.

Addresses-Launchpad-bug: #305057

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoe2fsck: print unsigned RAM usage statistics
Andreas Dilger [Tue, 28 Oct 2008 20:44:21 +0000 (14:44 -0600)]
e2fsck: print unsigned RAM usage statistics

Running e2fsck against a 14.5TB filesystem with -tt it reported
-200904kB for RAM usage in pass3 instead of the correct 2300773kB.
The RAM usage statistics were being printed with %d instead of %u.

Also fix a few places using %ld for inode numbers instead of %lu.

Signed-off-by: Andreas Dilger <adilger@sun.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoe2fsck: ignore differing NEEDS_RECOVERY flag on backup sbs
Eric Sandeen [Sat, 22 Nov 2008 15:02:48 +0000 (09:02 -0600)]
e2fsck: ignore differing NEEDS_RECOVERY flag on backup sbs

When we resize online, the primary superblock gets copied to all
the backups, and of course since we're mounted the NEEDS_RECOVERY
flag is set.  A subsequent fsck will find the backups have the
NEEDS_RECOVERY flag set while the primary does not, and this
forces a full fsck pass.

I think this flag can be safely ignored in the flag comparisons.

Addresses-Red-Hat-Bugzilla: #471925

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agomke2fs: Don't try to create the journal in super-only mode
Theodore Ts'o [Tue, 31 Mar 2009 11:42:24 +0000 (07:42 -0400)]
mke2fs: Don't try to create the journal in super-only mode

Since we aren't initializing the inode table, creating the journal
will just fail.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agopo: update cs.po (from translationproject.org)
Petr Pisar [Tue, 17 Mar 2009 02:26:52 +0000 (22:26 -0400)]
po: update cs.po (from translationproject.org)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 years agolibext2fs: external journal devices should not cause ext2fs_open2 to fail
Theodore Ts'o [Tue, 17 Mar 2009 02:16:44 +0000 (22:16 -0400)]
libext2fs: external journal devices should not cause ext2fs_open2 to fail

This fixes a regression introduced in commit 79a9ab14 which caused
attempts to open external journals to fail due to overly strict
filesystem consistency checks.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agodebugfs: Fix typos in logdump's error messages
Manish Katiyar [Sun, 8 Mar 2009 18:15:31 +0000 (23:45 +0530)]
debugfs: Fix typos in logdump's error messages

Below patch fixes some trivial typos found during code reading

Signed-off-by : Manish Katiyar <mkatiyar@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 years agolibss: Avoid leak upon failed realloc in ss_add_request_table()
Jim Meyering [Mon, 23 Feb 2009 17:26:05 +0000 (18:26 +0100)]
libss: Avoid leak upon failed realloc in ss_add_request_table()

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 years agolibext2fs: don't leak strdup'd dev name in dosio.c upon error
Jim Meyering [Mon, 23 Feb 2009 16:47:30 +0000 (17:47 +0100)]
libext2fs: don't leak strdup'd dev name in dosio.c upon error

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 years agoremove useless if-before-free tests
Jim Meyering [Mon, 23 Feb 2009 17:07:50 +0000 (18:07 +0100)]
remove useless if-before-free tests

In case you're wondering about whether this change is safe from a
portability standpoint, fear not.  This has been beaten to death
in other forums.  Here are a few threads:

  http://thread.gmane.org/gmane.comp.version-control.git/74187
  http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/12712
  http://thread.gmane.org/gmane.emacs.devel/98144
  http://thread.gmane.org/gmane.comp.lib.glibc.alpha/13092

There has been debate about whether it's a good idea from a
performance standpoint, too, but imho you'll have a hard time
finding an instance where this sort of change induces a
measurable performance penalty.  If you do, please let me know.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 years agofix libext2fs info page name
Eric Sandeen [Thu, 29 Jan 2009 22:52:13 +0000 (17:52 -0500)]
fix libext2fs info page name

In Red Hat bug #481620 Jerry reported that the libext2fs info page
is not accesable via "info libext2fs" but is via "info libext2fs.info"
and suggested that the following change should fix it.

Additional info from Jerry:
The problem is that makeinfo 4.12 interprets the dot in "libext2fs.info"
to be the end of the description portion of the info entry, even though
it hasn't seen the closing parenthesis yet.  Making the reference be to
just "libext2fs" works.

Addresses-Red-Hat-Bugzilla: #481620

Reported-by: Jerry James <loganjerry@gmail.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 years agodebugfs: fix segfault on "stat" command with no open fs
Eric Sandeen [Thu, 29 Jan 2009 22:46:28 +0000 (17:46 -0500)]
debugfs: fix segfault on "stat" command with no open fs

This is a regression from commit
8fdf29117f922419bd5b3f741e5d554b1d5b8893, which attempts to access
current_fs via a feature check before we check that it's open.

Just moving the feature check below the open check should fix it.

Reported-by: Andrew Hecox <ahecox@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 years agotests: Filter out "Lifetime writes" from the dumpe2fs display
Theodore Ts'o [Sun, 8 Mar 2009 23:01:03 +0000 (19:01 -0400)]
tests: Filter out "Lifetime writes" from the dumpe2fs display

The Lifetime writes field will probably not be stable as we add new
features to e2fsprogs, so filter it out to avoid spurious test failures.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoblkid: Add fallback to ext4 for 2.6.29+ kernels if ext2 is not present
Theodore Ts'o [Sun, 8 Mar 2009 22:56:41 +0000 (18:56 -0400)]
blkid: Add fallback to ext4 for 2.6.29+ kernels if ext2 is not present

Starting in 2.6.29, ext4 can be used to support filesystems without a
journal.  So if ext2 is not present, and the kernel version is greater
than 2.6.29, and ext4 is present, return a filesystme type of ext4.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoblkid: recognize ext4(dev) without journal
Eric Sandeen [Wed, 25 Feb 2009 05:17:54 +0000 (23:17 -0600)]
blkid: recognize ext4(dev) without journal

ext4/ext4dev no longer require a journal.

w/o this blkid doesn't recognize after:

# mkfs.ext4 /dev/blah
# tune2fs -O ^has_journal
# blkid /dev/blah

We still must have one ext3-incompat-feature to flag
as ext4(dev) so we shouldn't ever mis-recognize it.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 years agoe2fsprogs: blkid.static make target
Eric Sandeen [Wed, 25 Feb 2009 05:15:33 +0000 (23:15 -0600)]
e2fsprogs: blkid.static make target

Nice for testing w/o needing to swizzle around system
libraries...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 years agoe2fsprogs: fix potential null ptr defef in check_for_modules()
Eric Sandeen [Tue, 24 Feb 2009 21:13:39 +0000 (15:13 -0600)]
e2fsprogs: fix potential null ptr defef in check_for_modules()

The coverity scanner found this one.

If a line in modules.dep has a ":" but no "/" then:

                if ((cp = strchr(buf, ':')) != NULL)
                        *cp = 0;
                else
                        continue;
                if ((cp = strrchr(buf, '/')) != NULL)
                        cp++;
                /* XXX else cp is still null */
                i = strlen(cp);

... we will deref a null pointer (cp).  This can be
demonstrated by putting a line like:

foo.ko:

into modules.dep.  The below change just says that if no "/" is
found, treat the whole string as the module name.

Addresses-Red-Hat-Bugzilla: #486997

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agomke2fs, tune2fs: Do not allow the reserved_ratio to be negative
Theodore Ts'o [Fri, 6 Mar 2009 07:23:59 +0000 (02:23 -0500)]
mke2fs, tune2fs: Do not allow the reserved_ratio to be negative

Add a check to make sure the argument to the -m option (which
specifies the reserved ratio) is greater than zero.

Addresses-Debian-Bug: #517015

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoAdd support for a new superblock field: s_kbytes_written
Theodore Ts'o [Fri, 6 Mar 2009 00:40:20 +0000 (19:40 -0500)]
Add support for a new superblock field: s_kbytes_written

This field tracks the lifetime amount of writes to the filesystem.  It
will be updated by the kernel as well as by e2fsprogs programs which
write to the filesystem.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoUpdate release notes, changelog, etc., for e2fsprogs 1.41.4 release
Theodore Ts'o [Wed, 28 Jan 2009 00:51:00 +0000 (19:51 -0500)]
Update release notes, changelog, etc., for e2fsprogs 1.41.4 release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoUpdate e2fsprogs translation template.
Theodore Ts'o [Tue, 27 Jan 2009 01:43:10 +0000 (20:43 -0500)]
Update e2fsprogs translation template.

15 years agoe2fsck: Add missing newlines when reporting errors in pass 3A
Theodore Ts'o [Mon, 26 Jan 2009 21:41:46 +0000 (16:41 -0500)]
e2fsck: Add missing newlines when reporting errors in pass 3A

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoe2fsck: Change PR_3_CREATE_LPF_ERROR to be a non-fatal problem
Theodore Ts'o [Thu, 22 Jan 2009 21:05:29 +0000 (16:05 -0500)]
e2fsck: Change PR_3_CREATE_LPF_ERROR to be a non-fatal problem

The other problem codes associated with failing to create the
lost+found directory are non-fatal, and this one should be non-fatal
as well.  The two places which call e2fsck_get_lost_and_found()
already deal with a failure to create the directory, so there's no
point making this be a fatal error.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agolibext2fs: Add sanity checks to ext2fs_{block,inode}_alloc_stats
Theodore Ts'o [Thu, 22 Jan 2009 21:01:38 +0000 (16:01 -0500)]
libext2fs: Add sanity checks to ext2fs_{block,inode}_alloc_stats

If ext2fs_inode_alloc_stats2() or ext2fs_block_alloc_stats() is passed
an insanely large inode or block number, it's possible for these
functions to overrun an array boundary and cause the calling program
to crash with a memory error.

Detect this case, and since these functions don't return an error
code, print a warning message, much like we do in ext2fs_warn_bitmap2().

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoext2fs_new_inode(): Add sanity check to assure a valid inode number
Theodore Ts'o [Thu, 22 Jan 2009 20:55:49 +0000 (15:55 -0500)]
ext2fs_new_inode(): Add sanity check to assure a valid inode number

Add a sanity check to makesure that even if the superblock field
s_first_inode is insane, that we won't return an invalid inode number.
(The function will return the error EXT2_ET_INODE_ALLOC_FAIL in that
case.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoe2fsck: Add superblock check to make sure s_first_ino is valid
Theodore Ts'o [Thu, 22 Jan 2009 20:52:50 +0000 (15:52 -0500)]
e2fsck: Add superblock check to make sure s_first_ino is valid

An deliberately corrupted filesystem with an insanely large
s_first_ino field could cause e2fsck to crash with a seg fault.

Thanks to Eric Sesterhenn for supplying test cases which demonstrated
this issue.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agomke2fs: If the device size is exactly 16TB treat it as if it had 16TB - 1 block
Theodore Ts'o [Tue, 20 Jan 2009 19:03:03 +0000 (14:03 -0500)]
mke2fs: If the device size is exactly 16TB treat it as if it had 16TB - 1 block

This allows users who create a 16TB LVM to have mke2fs do (mostly) the
right thing automatcally.

15 years agoext2fs_get_device_size: Fix error handling
Theodore Ts'o [Tue, 20 Jan 2009 18:37:47 +0000 (13:37 -0500)]
ext2fs_get_device_size: Fix error handling

The previous patch would return EFBIG for any failure called from
ext2fs_get_device_size2().  (I didn't merge this fix with the
preceeding commit to allow merges to happen more easily.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoAdd 64-bit getsize interface.
Jose R. Santos [Wed, 20 Aug 2008 17:34:07 +0000 (12:34 -0500)]
Add 64-bit getsize interface.

Added interface capable of opening 64-bit block device.

Signed-off-by: Jose R. Santos <jrs@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agomke2fs: Add -U option to specify the UUID for the new filesystem
Theodore Ts'o [Tue, 20 Jan 2009 18:18:23 +0000 (13:18 -0500)]
mke2fs: Add -U option to specify the UUID for the new filesystem

Patch integrated from Mandriva

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoUse format strings directly to prevent -Werror=format-security failures
Theodore Ts'o [Tue, 20 Jan 2009 18:05:25 +0000 (13:05 -0500)]
Use format strings directly to prevent -Werror=format-security failures

Gcc is too stupid to realize that:

    const char *usage="String which has no percent signs";

    com_err(progname, 0, usage);

is OK.  I refuse to bow to stupidity with:

   com_err(progname, 0, "%s", usage);

but I will use the string directly for the sake of people who like to
build with -Werror=format-security.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoblkid: Add support for detecting user-level suspend as a swsuspend signature
Theodore Ts'o [Tue, 20 Jan 2009 17:07:31 +0000 (12:07 -0500)]
blkid: Add support for detecting user-level suspend as a swsuspend signature

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agomke2fs: Treat an argv[0] of "mke3fs" the same as "mkfs.ext3"
Theodore Ts'o [Tue, 20 Jan 2009 17:02:40 +0000 (12:02 -0500)]
mke2fs: Treat an argv[0] of "mke3fs" the same as "mkfs.ext3"

Mandriva apparently uses "mke3fs" as an alias for mkfs.ext3.  I'm not
particularly fond of that practice, but we'll include it as legacy
support.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agotune2fs: Fix tune2fs -I so it won't corrupt RAID filesystems
Theodore Ts'o [Tue, 20 Jan 2009 16:49:17 +0000 (11:49 -0500)]
tune2fs: Fix tune2fs -I so it won't corrupt RAID filesystems

If a filesystem is built with the stride extended-option (which is
often used in RAID filesystems to make sure the block and inode
allocation bitmaps don't end up hitting one disk platter harder than
the rest), this can cause tune2fs -I to corrupt the filesystem because
it fails to handle the case where the allocation bitmaps are located
after the inode table, where the inode table needs to grow.  Handle
this case correctly.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agotune2fs: General (whitespace) cleanup
Theodore Ts'o [Tue, 20 Jan 2009 07:34:39 +0000 (02:34 -0500)]
tune2fs: General (whitespace) cleanup

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agotune2fs: Don't allow the -I option if the flex_bg feature is enabled
Theodore Ts'o [Tue, 20 Jan 2009 06:50:07 +0000 (01:50 -0500)]
tune2fs: Don't allow the -I option if the flex_bg feature is enabled

With flex_bg usually the inode table for most block groups are packed
right against each other, so expanding the inode table size needs
special handling that's not currently in tune2fs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoblkid: recognize btrfs
Eric Sandeen [Thu, 8 Jan 2009 21:08:16 +0000 (15:08 -0600)]
blkid: recognize btrfs

Add btrfs detection to libblkid, now that the disk format should be
recognizable in the future.

# misc/blkid /tmp/fsfile
/tmp/fsfile: LABEL="mylabel" UUID="102b07f0-0e79-4b42-8a4e-1dde418bbe6d" TYPE="btrfs"

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 years agodebian: Add "set -e" to uuid-runtime's prerm script
Theodore Ts'o [Tue, 20 Jan 2009 05:55:32 +0000 (00:55 -0500)]
debian: Add "set -e" to uuid-runtime's prerm script

This addresses a Lintian warning.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoresize2fs: Reserve some extra space for -P/-M for ext4 filesystems
Theodore Ts'o [Tue, 20 Jan 2009 05:46:06 +0000 (00:46 -0500)]
resize2fs: Reserve some extra space for -P/-M for ext4 filesystems

Some extra blocks may be needed to expand some extent allocation trees
while we are shrinking the filesystem.  We don't know exactly how
much, so we use a hueristic.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoext2fs_open2: Add more checks for filesystem consistency
Thiemo Nagel [Tue, 20 Jan 2009 04:16:10 +0000 (23:16 -0500)]
ext2fs_open2: Add more checks for filesystem consistency

Add more checks to assure the filesystem is sane to avoid later
division by zero errors.

Patch adds consistency checks on superblock to fix serveral crashes:
* require EXT2_INODES_PER_GROUP != 0
* require EXT2_DESC_PER_BLOCK != 0
* require s_first_data_block < s_blocks_count
* require group_desc_count * EXT2_INODES_PER_GROUP == s_inodes_count

Signed-off-by: Thiemo Nagel <thiemo.nagel@ph.tum.de>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoext2fs_read_inode_full: Add safety check to avoid SEGV's on corrupted fs's
Theodore Ts'o [Tue, 20 Jan 2009 04:09:37 +0000 (23:09 -0500)]
ext2fs_read_inode_full: Add safety check to avoid SEGV's on corrupted fs's

Thanks to Thiemo Nagel for suggesting this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agodebian: Add mkfs.ext4 symlink to the e2fsprogs-udeb package
Theodore Ts'o [Tue, 20 Jan 2009 02:05:49 +0000 (21:05 -0500)]
debian: Add mkfs.ext4 symlink to the e2fsprogs-udeb package

This patch is needed for Ubuntu Januty.

Addresses-Debian-Bug: #511207

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoext2fs_block_iterate2: Preserve the uninit flag in extents
Theodore Ts'o [Tue, 20 Jan 2009 00:30:59 +0000 (19:30 -0500)]
ext2fs_block_iterate2: Preserve the uninit flag in extents

When modifying a block via the block_iterate interface, preserve the
uninit flag in the extent.  Resize2fs uses this interface, so we have
to preserve the uninit status when relocating a block.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoext2fs_block_iterate2: Reflect errors from ext2fs_extent_set_bmap to caller
Theodore Ts'o [Mon, 19 Jan 2009 19:22:52 +0000 (14:22 -0500)]
ext2fs_block_iterate2: Reflect errors from ext2fs_extent_set_bmap to caller

If the callback function tries to change a block, and
ext2fs_extent_set_bmap() fails for some reason (for example, there
isn't enough disk space to split a node and expand the extent tree,
make sure that error is reflected back up to the caller.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
15 years agoresize2fs: Release bitmap and itable blocks in flex_bg filesystems
Theodore Ts'o [Mon, 19 Jan 2009 14:02:55 +0000 (09:02 -0500)]
resize2fs: Release bitmap and itable blocks in flex_bg filesystems

Previously resize2fs assumed that bitmap and inode table blocks were
always located in their respective block group.  However, this is no
longer true with flex_bg.  So it is necessary to check all of the
block groups which will be truncated to see if they have metadata
blocks that need to be marked as no longer being in use in the new,
shrunk filesystem.

This bug fixes resize2fs -M, which would otherwise fail because
without the released blocks, there would not be enough space in the
filesystem.  This bug also avoids (mostly harmless) filesystem
corruptions reported by e2fsck regarding blocks marked in use but not
actually used (these being the bitmap and inode table blocks
associated with the truncated block groups).

Note: in theory it is possible to have block group N utilize bitmap
and inode table blocks in block group N+X with flex_bg.  At the moment
neither mke2fs nor e2fsck will create filesystems like this, which is
good, because resize2fs doesn't handle this case correctly.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>