Commit Graph

299 Commits (7ef1b8b4248ab099f4ac4c921fe8c0def831f255)

Author SHA1 Message Date
Aditya Kali 624e4a6466 e2fsck: add support for checking the built-in quota files
This patch adds support for doing quota accounting during full
e2fsck scan if the 'quota' feature was set on the superblock.
If user-visible quota inodes are in use, they will be hidden
and converted to the reserved quota inodes.

Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-08-31 16:31:13 -04:00
Theodore Ts'o 95a7f15f46 e2fsck: teach e2fsck how to deal with bigalloc in non-extent-mapped inodes
Currently the bigalloc implementation in the kernel requires extents,
but this restriction might get relaxed in the future.  Also, old
versions of mke2fs that supported bigalloc during early testing
created the root and lost+found directories without using
extent-mapped inodes.  This makes it possible for e2fsck to better
support these old legacy file systems if it comes across them.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-07-10 16:25:55 -04:00
Andreas Dilger 0bd0e59320 misc: use EXT2_I_SIZE() consistently to get size
Use the EXT2_I_SIZE() macro consistently to access the inode size.
The i_size/i_size_high combination is open coded in several places.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-07-08 20:52:59 -04:00
Theodore Ts'o b2e6c86d61 mke2fs, e2fsck: fix i_blocks handling for bigalloc file systems
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-06-16 10:12:43 -04:00
Andreas Dilger cf5301d7f2 misc: clean up compiler warnings
Fix several types of compiler warnings (unused variables/labels),
uninitialized variables, etc that are hit with gcc -Wall.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-06-11 10:58:25 -04:00
Theodore Ts'o 44fe08f1fa e2fsck: add basic bigalloc support to check (but not yet repair) file systems
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-06-10 18:58:16 -04:00
Theodore Ts'o b70506bffb e2fsck: Set i_blocks_hi when correcting the i_blocks field in pass #1
For file systems with 64-bit block numbers, we need to make sure we
correct the i_blocks_hi field as well as the i_blocks field when
setting it to the correct value.

Thanks to Justin Maggard for pointing this out.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-09-24 22:57:06 -04:00
Valerie Aurora Henson 6dc64392c0 e2fsck: Fix up to be 64-bit block number safe
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>
2010-06-13 17:00:00 -04:00
Theodore Ts'o 97d26ce9e3 Merge branch 'maint' into next
Conflicts:
	e2fsck/journal.c
	e2fsck/pass1.c
	e2fsck/pass2.c
	misc/mke2fs.c
2010-06-07 12:42:40 -04:00
Eric Sandeen ae2272f845 e2fsck: correct test for EOFBLOCKS
This test, added to e2fsprogs-1.41.12, is backwards.

If EOFBLOCKS is set, then the size -should- be less than
the last physical block...

xfstests 013 caught this.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-05-19 14:55:29 -04:00
Theodore Ts'o e6238d3708 e2fsck: Explicitly reject extents that begin at physical block 0 as illegal
In the case where s_first_data_block is 1, we need to explictly reject
an extent whose starting physical block is zero.

Thanks to Jiaying Zhang <jiayingz@google.com> for finding this bug.

Addresses-Google-Bug: #2573806

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-05-14 18:06:40 -04:00
Theodore Ts'o ee74cf16b5 e2fsck: Fix segmentation fault when checking a file system
If a corrupted file system causes us to want to delete an extent, and
that causes us to want to release a block in e2fsck pass #1, it would
be preferable if e2fsck didn't seg fault.  This tends to get users
craky, as users are wont to do.  :-)

Thanks to Dirk Reiners for reporting this bug:

e2fsck crashes fixing a corrupted 3.5 TB filesystem:

0x0000000000432002 in ext2fs_unmark_generic_bitmap (bitmap=0x0, bitno=623386749)
at gen_bitmap.c:183
183             if ((bitno < bitmap->start) || (bitno > bitmap->end)) {
(gdb) bt
bitno=623386749) at gen_bitmap.c:183
block=623386749) at ../../lib/ext2fs/bitops.h:319
inuse=-1) at alloc_stats.c:78
extent.c:1509
pb=0x7fffffffdfe0, start_block=0, ehandle=0x6dcf50) at pass1.c:1709
pb=0x7fffffffdfe0, start_block=0, ehandle=0x6dcf50) at pass1.c:1737
pctx=0x7fffffffe100, pb=0x7fffffffdfe0) at pass1.c:1842
block_buf=0x6c4330 "\373\212#") at pass1.c:1920

The source of the NULL bitmap is fs on stack frame 2:

(gdb) up 2
inuse=-1) at alloc_stats.c:78
78                      ext2fs_unmark_block_bitmap(fs->block_map, blk);

Addresses-SourceForge-Bug: #2971800

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-05-13 19:00:41 -04:00
Eric Sandeen 65d71894c9 e2fsck: make block counting variable in pass1 64 bits
Justin reported that creating a 4T file with posix_fallocate led
to fsck errors:

e2fsck 1.41.10 (10-Feb-2009)
Pass 1: Checking inodes, blocks, and sizes
Inode 12, i_blocks is 8589935432, should be 840.  Fix? yes

This looks like a 32-bit overflow.

commmit 8a8f36540b added handling of
the high i_blocks number, but we accumulate blocks in the num_blocks
field, and that's still just 32 bits.

Note: we don't need to expand max_blocks for now, that's only used
in the non-extents case, and those files have smaller max sizes.

I haven't been able to replicate the problem, oddly, but Justin
reports that this patch fixed his situation.

Reported-by: Justin Maggard <jmaggard10@gmail.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2010-05-13 13:33:53 -04:00
Theodore Ts'o a6217f5ae2 e2fsck: Fix a number of problems that were inappropriately using PROMPT_ABORT
There were a number of problems that were prompting the user whether
or not to ABORT, but then would abort regardless of whether the user
answered yes or no.  Change those to be PROMPT_NONE, PR_FATAL.

Also, fix PR_1_RESIZE_INODE_CREATE so that it recovers appropriately
after failing to create the resize inode.  This problem now uses
PROMPT_CONTINUE instead of PROMPT_ABORT, and if the user says, "no",
the code will abort.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-05-12 18:58:53 -04:00
Theodore Ts'o 2291fbb035 e2fsck: Check for cases where EOFBLOCKS_FL is unnecessarily set
Some kernels will crash if EOFBLOCKS_FL is set when it is it not
needed, and this if it is left set when it isn't needed, it is a sign
of a kernel bug.

Addresses-Google-Bug: #2604224

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-05-10 10:29:14 -04:00
Theodore Ts'o d9af85b50b Revert "e2fsck: fix spurious complaints about i_size caused by preallocated blocks"
This reverts commit 0ea910997b.

Since the Linux kernel now has support for the EXT4_EOFBLOCKS_FL flag
starting in 2.6.34, we don't need this workaround any more.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-04-08 15:51:10 -04:00
Theodore Ts'o 19f433a521 e2fsck: Fix segmentation fault when checking a file system
If a corrupted file system causes us to want to delete an extent, and
that causes us to want to release a block in e2fsck pass #1, it would
be preferable if e2fsck didn't seg fault.  This tends to get users
craky, as users are wont to do.  :-)

Thanks to Dirk Reiners for reporting this bug:

e2fsck crashes fixing a corrupted 3.5 TB filesystem:

0x0000000000432002 in ext2fs_unmark_generic_bitmap (bitmap=0x0, bitno=623386749)
at gen_bitmap.c:183
183             if ((bitno < bitmap->start) || (bitno > bitmap->end)) {
(gdb) bt
bitno=623386749) at gen_bitmap.c:183
block=623386749) at ../../lib/ext2fs/bitops.h:319
inuse=-1) at alloc_stats.c:78
extent.c:1509
pb=0x7fffffffdfe0, start_block=0, ehandle=0x6dcf50) at pass1.c:1709
pb=0x7fffffffdfe0, start_block=0, ehandle=0x6dcf50) at pass1.c:1737
pctx=0x7fffffffe100, pb=0x7fffffffdfe0) at pass1.c:1842
block_buf=0x6c4330 "\373\212#") at pass1.c:1920

The source of the NULL bitmap is fs on stack frame 2:

(gdb) up 2
inuse=-1) at alloc_stats.c:78
78                      ext2fs_unmark_block_bitmap(fs->block_map, blk);

Addresses-SourceForge-Bug: #2971800

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-03-17 13:32:52 -04:00
Theodore Ts'o c5b23f6c0e Merge branch 'maint' into next 2010-03-15 18:53:45 -04:00
Eric Sandeen 4ffafee26c e2fsck: don't complain about i_size for known blocks past EOF
This is the userspace side of Jiaying's EOFBLOCKS patch.  With
Aneesh's patches for .33, Jiaying's patch, and this one, xfstests
013/fsstress (even with direct IO enabled) has held up through many
runs.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-02-24 11:24:37 -05:00
Theodore Ts'o cc84d866e2 Merge branch 'maint' into next
Conflicts:
	e2fsck/pass1.c
2010-02-10 18:20:58 -05:00
Nick Dokos 1ec42a00a5 e2fsck: Fix the check if a file is really a directory to understand extents
Pass 1 has a test to see if a special file is really a directory.

Signed-off-by: Nick Dokos <nicholas.dokos@hp.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-02-05 10:41:42 -05:00
Theodore Ts'o 2d07b3ad98 Merge branch 'maint' into next
Conflicts:
	configure
	lib/ext2fs/alloc_tables.c
	misc/mke2fs.c
2010-01-31 18:49:08 -05:00
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 8a2cbe2c6d e2fsck: Try to update on-disk bitmap in e2fsck_get_alloc_block() callback
The e2fsck_get_alloc_block() callback is used so that if the ext2fs
library needs to allocate blocks internally (most notably by the
extents functions), e2fsck's internal block usage map is consulted
since it is the only thing that can be trusted during a large part of
e2fsck's operation.

Change it to update the on-disk bitmap if it is loaded.  This reduces
the number of spurious differences found in pass #5.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-11-29 01:24:06 -05:00
Theodore Ts'o 4607ef7d53 e2fsck: detect holes in extent-mapped directories
Directories are not allowed to be sparse; the code for scanning
extent-mapped directories was not calling ext2fs_add_dir_block() for
missing directory blocks, so we weren't catching this form of file
system corruption.  Fix this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-11-29 01:03:04 -05:00
Theodore Ts'o a49249d2e3 e2fsck: Move check to add an index to a directory after fixing i_size
The check that determines whether an directory needs to be have an
index added to it depends on i_size.  So move it after we have fixed
up i_size so that we reliable will rehash a directory that needs it,
even if its i_size field was originally incorrect.  Otherwise, a
second run of e2fsck would be needed before the directory gets an
index added.

Thanks to Mikulas Patocka for providing a sample file system which
demonstrated this problem.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-11-29 01:03:04 -05:00
Theodore Ts'o 4dbe79bcf3 e2fsck: Fix directory with holes even when i_size is wrong
The old method for detecting directories with holes depended on i_size
being correct, even though the correct value of i_size hadn't been
calculated yet.  Hence, a directory inode with holes and an i_size of
0 would require two e2fsck passes to fix completely.

The replacement method for determining whether or not
ext2fs_add_dir_block() should be called is more reliable, and reduces
the size of e2fsck and makes the code more readable as a bonus.

Thanks to Mikulas Patocka for providing a sample file system which
demonstrated this problem.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-11-29 01:02:46 -05: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
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 72a729dbf9 Merge branch 'maint' into next
Conflicts:
	configure
	configure.in
2009-10-24 15:14:54 -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
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 24a117abd0 Convert to use io_channel_read_blk64() and io_channel_write_blk64()
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07 21:14:24 -04:00
Valerie Aurora Henson c5d2f50dee e2fsck: Convert e2fsck to new bitmap interface
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-08-22 22:29:02 -04:00
Theodore Ts'o 9a7fe4bdc9 e2fsck: Only ask to relocate a block group's inode table once
If multiple blocks of a block group's inode table overlaps with other
file system blocks, only ask once for each block group.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-08-18 23:14:03 -04:00
Theodore Ts'o 617446e4aa e2fsck: Teach new_table_block() to allocate new itables/bitmaps with FLEX_BG
If the filesystem feature FLEX_BG is enabled, the inode table and
bitmap blocks can be located anywhere in the inode table.  So for
FLEX_BG filesystems, new_table_block() now tries allocate in the block
group's flex_bg first, and if there is no space in the local flex_bg,
then try to allocate from the whole filesystem.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-08-18 23:06:30 -04:00
Theodore Ts'o 8a48035095 Fix encoding for rec_len in directories for >= 64k blocksize file systems
Previously e2fsprogs interpreted 0 for a rec_len of 65536 (which could
occur if the directory block is completely empty in 64k blocksize
filesystems), while the kernel interpreted 65535 to mean 65536.  The
kernel will accept both to mean 65536, and encodes 65535 to be 65536.
This commit changes e2fsprogs to match.

We add the encoding agreed upon for 128k and 256k filesystems, but we
don't enable support for these larger block sizes, since they haven't
been fully tested.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-06-21 21:07:38 -04:00
number9652 84b239aea4 libext2fs: add ext2fs_extent_open2
The patch below adds a function, ext2fs_extent_open2(), that behaves
as ext2fs_extent_open(), but will use the user-supplied inode
structure when opening an extent instead of reading the inode from
disk.  It also changes several of the calls to extent_open() to use
this enhancement.

Signed-off-by: Nic Case <number9652@yahoo.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-05-28 16:33:38 -04:00
Ken Chen 9facd076ae Add empty function for init_resource_track() and print_resource_track()
in the case of ! defined RESOURCE_TRACK, so that we can clean up #ifdef
throughout e2fsck source.

Signed-off-by: Ken Chen <kenchen@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-05-28 09:55:10 -04:00
Theodore Ts'o 0a68b181c1 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>
2009-05-17 08:42:52 -04:00
Theodore Ts'o 911ec62615 e2fsck: On a 32-bit filesystem, make sure i_file_acl_high is zero
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-04-23 21:31:16 -04:00
Theodore Ts'o 7518c17686 e2fsck: Fix an unhandled corruption case in scan_extent_node()
A corrupted interior node in an extent tree would cause e2fsck to
crash with the error message:

Error1: Corrupt extent header on inode 107192
Aborted (core dumped)

Handle this and related failures when scanning an inode's extent tree
more robustly.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-12-25 22:42:38 -05:00
Theodore Ts'o d5a74ff10b e2fsck: Fix double-counting of non-contiguous extent-based inodes
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-12-22 01:23:59 -05:00
Theodore Ts'o 100d4701d5 e2fsck: Enhance fragcheck report with file/directory information
Report whether a fragmented inode is a directory or a file, as this is
highly useful for determining what is going on with an ext4 filesystem.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-12-08 22:00:13 -05:00
Theodore Ts'o ce44d8cafa e2fsck: In verbose mode, distinguish between fragmented directories/files
Track the number of non-contiguous files and directories so we can
give more detailed information in verbose mode.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-12-08 21:33:11 -05:00
Theodore Ts'o 03fa6f8ae2 Fix various signed/unsigned gcc warnings
Some of these could affect filesystems between 2^31 and 2^32-1 blocks.

Thanks to Valerie Aurora Henson for pointing out the problems in
lib/ext2fs/alloc_tables.c, which led me to do a "make gcc-wall" scan
over the source tree.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-11-16 10:06:59 -05:00
Theodore Ts'o 0eeec8ac61 Fix compiling under diet libc
Some recent changes had caused diet libc support to bitrot.  Fix up
missing header files and other portability fixups needed for dietlibc.
(Many of these changes also improve general portability.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-09-12 09:10:39 -04:00
Theodore Ts'o efc6f628e1 Remove trailing whitespace for the entire source tree
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 23:07:54 -04:00
Theodore Ts'o 5dd77dbe5a Add support for with empty directory blocks in 64k blocksize filesystems
The rec_len field in the directory entry is 16 bits, so if the
filesystem is completely empty, rec_len of 0 is used to designate
65536, for the case where the directory entry takes the entire 64k
block.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-25 21:08:19 -04:00
Theodore Ts'o 0ea910997b e2fsck: fix spurious complaints about i_size caused by preallocated blocks
For inodes with blocks preallocated with FALLOC_FL_KEEP_SIZE, e2fsck
complained about i_size being too small.  Fix this.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-17 23:14:30 -04:00
Theodore Ts'o 3ec7be439a e2fsck: Fix max size calculation for extent files
A misunderstanding C's precedence rules and the meaning of
s_log_block_size meant that we were capping the maximum size of
extent-based files at 8GB instead of the 64TB that it should be for
filesystems with 4k block sizes.

Addresses-Kernel-Bugzilla: #11341

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-17 09:41:38 -04:00
Theodore Ts'o 8da6d1a18a e2fsck: Fix ind/dind/tind statistics and add extent depth statistics
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-14 09:48:07 -04:00
Theodore Ts'o f4e2c991ef e2fsck: Fix signed/unsigned error in fragcheck report for indirect blocks
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-12 22:11:02 -04:00
Theodore Ts'o 63b5e354d9 e2fsck: Fix check to see if an extent-based file is fragmented
Also added support for "e2fsck -E fragcheck" which issues a
comprehensive report of discontiguous file extents.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-10 22:43:24 -04:00
Eric Sandeen 7c1e090ce1 e2fsck: Fix i_size checking for large extent-based files
This:

Truncating bigfile to 14680064000000
Pass 1: Checking inodes, blocks, and sizes
Inode 49154, i_size is 14680064000000, should be 0.  Fix<y>?

is a bit unexpected.  It's because the size is being checked against
the max sizes for bitmap files, not extent-based files.

Nick saw this with his 14TB file.

Patch below applies different size limits to the different file
formats.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-07-07 11:01:36 -04:00
Theodore Ts'o 2acad6b489 Fix gcc -Wall warnings in e2fsck
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-06-07 11:04:10 -04:00
Theodore Ts'o d5a8f9a9f2 e2fsck: Detect unordered extents in an extent node
The logical block numbers must be monotonically increasing, and there
must not be any overlapping extents.  If any are found, report them as
filesystem corruption.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-06-02 20:33:30 -04:00
Theodore Ts'o 16bd349e1f e2fsck: Wire up callback functions for _alloc_block() and _block_alloc_stats()
Wire up callback functions for ext2fs_alloc_block() and
ext2fs_block_alloc_stats() so that we use the ctx->block_found_map
block bitmap to determine which new block we should allocate, and then
to update the block_found_map bitmap if the extent functions need to
allocate or release blocks.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-06-02 18:52:12 -04:00
Theodore Ts'o 11de9261c1 e2fsck: Don't double count an extent after deleting the last extent
ext2fs_extent_delete() will leave the extent handle pointing at the
next extent --- except if the last extent in the node.  To deal with
this last case, call ext2fs_get_extent_info() and stop scanning after
processing info->num_entries extents.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-05-30 15:23:24 -04:00
Theodore Ts'o 73e5abcfe4 e2fsck: Don't skip an extent after deleting an invalid extent
ext2fs_delete_extent() deletes the current extent and moves to the
next extent (if present).  So we need to skip moving to the next
extent and get the (new) current extent and check it before moving on.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-05-28 04:54:44 -04:00
Eric Sandeen 7a1eac2fbe e2fsck: Only check PR_1_EXTENT_ENDS_BEYOND for leaf nodes
pass1 was checking that an "extent's" start+len did not extend
past the last filesystem block, but unless we are at a leaf
block, the physical block is that of a node in the tree, and
the length may include sparseness.  The test is only valid
for leaf blocks.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2008-04-17 17:16:47 -04:00
Theodore Ts'o 1ca1059fd0 Add support for the HUGE_FILE feature
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-04-17 16:38:13 -04:00
Eric Sandeen dfc870c718 e2fsck: Fix extent flag validity tests in pass1 on big endian boxes.
Extent data is shared with the i_block[] space in the inode,
but it is always swapped on access, not when the inode is read.

In e2fsck/pass1.c we must be careful when checking validity
of the extents flag on the inode.  If the flag was set when
the inode was read & swapped, then the extents data itself
(in ->i_block[]) was NOT swapped, so testing for a valid
extent header requires some swapping first.  Then, if we
ultimately set the extents flag, all of i_block[] must be
re/un-swapped.

This passes the f_extent regression test on both ppc & x86.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-04-01 15:18:44 -04:00
Theodore Ts'o cb23cad5b7 e2fsck: Don't object to extents flags on deleted fast symlinks
Thanks to Aneesh Kumar for pointing this out.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-24 08:17:24 -04:00
Eric Sandeen 85b59c40f4 Fix ext2fs_extent_get for uninit leaf extents
The ext2fs_extent_get() function was not OR-ing together UNINIT
and LEAF flags in the case where an extent was both; so if we
had an extent which was both uniint and leaf, pass1 would bail
out where depth == max_depth but was not marked as leaf, and
e2fsck (from the next branch) would abort with:

e2fsck 1.40.8 (13-Mar-2008)
Pass 1: Checking inodes, blocks, and sizes
Error1: No 'down' extent
Aborted

Also, if the error is encountered again, print the inode number
to aid debugging until it's properly handled, at least.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-20 15:45:27 -04:00
Theodore Ts'o ee19c902e6 e2fsck: Check for fast symlinks that have EXTENTS_FL set
These shouldn't show up in the wild, but if they do, e2fsck will offer
to clear them.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-13 23:13:18 -04:00
Theodore Ts'o 7cadc57780 e2fsck: Support long symlinks which use extents
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-13 23:05:00 -04:00
Theodore Ts'o a040a99b6c Merge branch 'maint'
Conflicts:

	lib/ext2fs/ext2_err.et.in
2008-03-13 10:53:26 -04:00
Theodore Ts'o 2cd1233839 e2fsck: Fix directory i_size handling
If a directory's i_size is bigger than the number of blocks, don't try
to allocate extra empty blocks to the end of the directory; there's no
real point to do that.  Also, if a directory's i_size is not a
multiple of the blocksize, flag that as a mistake so it can be fixed.

This more elegantly addresses the problem which was found on Bas van
Schaik's filesystem.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-13 00:58:54 -04:00
Theodore Ts'o 7dc099887c e2fsck: Account for index nodes in the extent tree for i_blocks
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-22 15:53:50 -05:00
Andreas Dilger fefaef39e0 Improve support for in-inode EA's
Add vertificaton of the in-inode EA information, and allow in-inode
EA's to have a checksum.

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-18 21:20:26 -05:00
Theodore Ts'o 15d482ba6e e2fsck: Add support for extents
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-18 20:06:18 -05:00
Theodore Ts'o e3df15abdb e2fsck: factor out code to clear an inode into e2fsck_clear_inode()
Factor out code to clear a bogus inode and update e2fsck's internal
data structures accordingly into a common routine,
e2fsck_clear_inode().  This saves about 200 bytes in the compiled x86
e2fsck executable, and makes the code more maintainable in the
long-term.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-18 15:27:04 -05:00
Theodore Ts'o d9099eec8e Merge branch 'cl/remove-masix' into next 2007-11-01 01:54:22 -04:00
Coly Li 5b57d921b4 e2fsck: remove masix support
This patch remove masix support from e2fsck.

Signed-off-by: Coly Li <coyli@suse.de>
2007-11-01 01:53:56 -04:00
Dmitry V. Levin da938f20ac check_ea_in_inode: Cleanup e2fsck_write_inode_full() call
Avoid pointer cast and call e2fsck_write_inode_full() the same way
as check_inode_extra_space() does.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2007-11-01 00:32:32 -04:00
Theodore Ts'o aef2283196 Merge branch 'maint' 2007-08-03 23:21:34 -04:00
Theodore Ts'o 9f0288d3bb e2fsck: Allow i_size to be rounded up to the size of a VM page
Allow files to be preallocated on-disk up to the next multiple of the
system's page size without complaining about extra blocks.

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: Girish Shilamkar <girish@clusterfs.com>
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-08-03 20:43:37 -04:00
Theodore Ts'o 6d96b00d57 Add I/O statistics to e2fsck
This patch instruments the libext2fs unix I/O manager and adds bytes
read/written and data rate to e2fsck -tt pass/overall timing output.

Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-08-03 20:07:09 -04:00
Andreas Dilger a34c6ffd68 e2fsck: added sanity check for xattr validation
Add an extra validity test in check_ext_attr().  If an attribute's
e_value_size is zero the current code does not allocate a region for it
and as a result the e_value_offs value is not verified.  However, if
e_value_offs is very large then the later call to
ext2fs_ext_attr_hash_entry() can dereference bad memory and crash
e2fsck.

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: Jim Garlick <garlick@llnl.gov>
2007-06-22 02:22:38 -04:00
Theodore Ts'o f954ba012f Fix gcc -Wall issues in e2fsck sources
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
2007-05-22 20:53:01 -04:00
Kalpak Shah 1a8c2c4a89 Remove check in e2fsck which requires EA's in inodes to be sorted
This patch removes a code snippet from check_ea_in_inode() in pass1 which checks
if the EA values in the inode are sorted or not. The comments in fs/ext*/xattr.c
state that the EA values in the external EA block are sorted but those in the
inode need not be sorted. I have also attached a test image which has unsorted
EAs in the inodes. The current e2fsck wrongly clears the EAs in the inode.

Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
2007-05-08 01:07:30 -04:00
Theodore Ts'o 0eeb154937 Fix e2fsck's check_is_really_dir logic
Fix a typo which could cause e2fsck to throw an I/O error while doubling
checking whether or not a special device file was really an inode.
Also, don't do this tests on symbolic links since for filesystems with a
large numbers of symlinks it could degrade performance and increases the
risk for false positives.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-04-14 12:01:39 -04:00
Theodore Ts'o e94bc63164 Improve I/O error messages in e2fsck
Add better ehandler_operation() markers so it is clearer what e2fsck was
doing when an I/O error is reported.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-04-14 09:29:02 -04:00
Theodore Ts'o 34b9f79639 Enable e2fsck to use the tdb library for the inode count abstraction
If e2fsck.conf configures a scratch_files directory which is available,
and the number of directories exceeds scratch_files.numdirs_threshold,
then try to use the tdb library to store the inode count abstraction.
This allows us to check very large filesystems without needing as much
physical memory.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-04-06 18:43:11 -04:00
Theodore Ts'o 86bc90f4f1 Fix potential reference (and free) to an uninitialized pointer in e2fsck
This was introduced recently when fixing a problem noted by Coverty.
Oops!

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-04-04 21:42:42 -04:00
Theodore Ts'o fbc3f90194 e2fsck: Recover a special file which looks an awful lot like a directory
This is probably only useful in artificial test cases, but it will be
useful if we ever do the "inodes in directory" idea for ext4.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-04-02 10:08:59 -04:00
Theodore Ts'o 441ab1e020 Fix edge case when i_size doesn't get fixed until second e2fsck run
Don't assume that a special device is bogus just because i_blocks is
non-zero.  The i_blocks field could get adjusted later, and if this
happens it will confuse the e2fsck_process_bad_inode() in pass 2.  In
practice true garbage inodes will have random non-zero in
i_blocks[4..15], so there's no point doing the check for an illegal
i_blocks value.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-31 18:56:09 -04:00
Brian Behlendorf 9d45b6ef7e [COVERITY] Fix (error case only) memory leak in e2fsck pass #1
Coverity ID: 37: Resource Leak
Coverity ID: 38: Resource Leak

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2007-03-28 11:57:20 -04:00
Brian Behlendorf 5469d76759 [COVERITY] Fix memory leak when parsing extended options in e2fsck
Coverity ID: 36: Resource Leak

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2007-03-28 11:41:40 -04:00
Theodore Ts'o 642935c082 Fix misc. gcc -Wall complaints in the misc and e2fsck directories
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-11-14 23:38:17 -05:00
Theodore Ts'o 5d17119d14 On-disk format definition for huge files
- EXT4_FEATURE_RO_COMPAT_HUGE_FILE (0x0008) - change i_blocks to be
  in units of s_blocksize units instead of 512-byte sectors, use
  l_i_frag and l_i_fsize as i_blocks_hi (could also be part of 64BIT).

E2fsck and debugfs changed to support i_blocks_hi instead of l_i_frag and
l_i_fsize.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-11-11 06:32:03 -05:00
Eric Sandeen d1b4b85c3a Fix more rounding overflows for filesystems that have 2**32-1 blocks
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
2006-09-12 14:56:18 -04:00
Eric Sandeen abf23439d5 Create new ext2fs library inlines: ext2fs_group_{first,last}_block()
Create new ext2fs library inline functions in order to calculate
the starting and ending blocks in a block group.

Signed-off-by: Eric Sandeen <esandeen@redhat.com>
2006-09-12 14:56:16 -04:00
Eric Sandeen 62c6d1403e Remove unused variables
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
2006-09-12 14:56:12 -04:00
Theodore Ts'o 2743159572 Fix false positives from valgrind: memcpy via no-op structure copy
Don't do a structure copy via an assignment in e2fsck's pass #1 when
it is a no-op in order to avoid false positives from valgrind.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-07-25 11:36:43 -05:00
Theodore Ts'o 1f3ad14a5a Use a centrally stored current time for "now" which
can be overridden using the E2FSCK_TIME environment 
variable, for better reproducibility for regression tests.
2005-04-14 14:07:53 -04:00
Theodore Ts'o 4147d9f029 pass1.c (e2fsck_pass1): If the superblock last mount time (not
just the last write time) looks insane, then assume that
	we can't do the LOW_DTIME checks.
2005-04-06 14:55:53 -04:00
Theodore Ts'o cebe48a1ec Integrate code from Alex Thomas at Clusterfs to check extended attributes
stored in inodes into e2fsck.

There are a number of bug fixes and enhancements over the original lustre fsck
BK repository.  The biggest one is that this extended attribute values must
be aligned on 4-byte boundaries.
2005-03-21 13:15:45 -05:00
Theodore Ts'o dc71f23e63 Fix bug in e2fsck where we don't notice if a file with an extended
attribute block is so big that i_blocks wraps to zero.
2005-03-20 16:57:10 -05:00
Theodore Ts'o c3ffaf833b Add support to detect corrupted resize_inode's to e2fsck. 2004-12-24 01:42:22 -05:00
Theodore Ts'o d323f8fb36 Add support for on-line resizing ala the resize inode. This patch
is taken from Fedora Core 3's e2fsprogs 1.35-11.2.src.rpm's 
e2fsprogs-resize.patch.
2004-12-15 14:39:16 -05:00
Theodore Ts'o 8421fb67f2 pass1.c (process_block): Change the limit of directory size from
32 MB to 2GB.
2004-07-26 20:11:49 -04:00
Matthias Andree 83e692e88b unix_io.c, pass1.c:
int -> unsigned for 1 bit wide bitfields - we cannot have a value and a sign in 1 bit.
  Fixes some of the Intel C++ 8.0 warnings (-w1 level).
2004-03-30 04:17:14 +02:00
Matthias Andree b969b1b8a5 Fix more compiler warnings. 2003-12-28 13:04:35 +01:00
Theodore Ts'o 544349270e Fix gcc -Wall nitpicks 2003-12-07 01:28:50 -05:00
Theodore Ts'o 000ba4046f pass1.c (e2fsck_pass1), problem.h (PR_1_BB_FS_BLOCK),
problem.c (PR_1_BB_FS_BLOCK, PR_1_BBINODE_BAD_METABLOCK_PROMPT): 
	Fix up the handling of corrupted indirect blocks in the 
	bad block.  We now correctly handle the case where there
	is an overlap between a block group descriptor or
	a superblock and a bad block indirect block.  In the case
	where the indirect block is corrupted, we now suggest
	"e2fsck -c".
2003-11-21 10:41:58 -05:00
Theodore Ts'o ef344e13d2 Centeralize calculation of which blocks are reserved/used for
the superblock and block group descriptors into two functions:
ext2fs_reserve_super_and_bgd, found in lib/ext2fs/alloc_sb.c, and
ext2fs_super_and_bgd_lock, found in lib/ext2fs/close.c.

Change e2fsck/pass1.c (mark_table_blocks), lib/ext2fs/closefs.c
(ext2fs_flush), lib/ext2fs/initialize.c (ext2fs_initialize),
and misc/dumpe2fs.c (list_desc) to use these functions.

e2fsck/ChangeLog
    pass1.c (mark_table_blocks): Use the new function
    	ext2fs_reserve_super_and_bgd to calculate the blocks to be
    	reserved.

lib/ext2fs/ChangeLog
    closefs.c (ext2fs_super_and_bgd_loc): New function which
    	centralizes the calculation of the superblock and block
    	group descriptors.
    	(ext2fs_flush): Use ext2fs_super_and_bgd_lock to figure
    	out where to write the superblock and block group
    	descriptors.
    
    alloc_sb.c (ext2fs_reserve_super_and_bgd): New function which
    	reserves space in the block bitmap using
    	ext2fs_super_and_bgd_loc.
    
    initialize.c (ext2fs_initialize): Use
    	ext2fs_reserve_super_and_bgd to initialize the block bitmap.

misc/ChangeLog
    dumpe2fs.c (list_desc): Use ext2fs_super_and_bgd_loc to
    	determine the locations of the superblock and block group
     	descriptors.
2003-11-21 09:02:21 -05:00
Theodore Ts'o c4e3d3f374 ext2fs_getmem(), ext2fs_free_mem(), and ext2fs_resize_mem()
all now take a 'void *' instead of a 'void **' in order to 
avoid pointer aliasing problems with GCC 3.x.
2003-08-01 09:41:07 -04:00
Theodore Ts'o f364093b19 Update debugfs and e2fsck to use the blkid library. 2003-03-01 19:47:44 -05:00
Theodore Ts'o 4f489285b6 pass1.c (check_blocks): Use the EXT2_I_SIZE macro. 2003-01-22 18:28:15 -05:00
Theodore Ts'o 299d742427 Change e2fsck to force out changes to the backup copies of the
superblock and block group descriptors when important changes
are made to those data structures.
2002-11-08 11:10:28 -05:00
Theodore Ts'o be93ef0c14 pass1.c (e2fsck_pass1): Check the superblock write time to see
whether or not we can safely do the LOW_DTIME checks.
	(Addresses Sourceforge bug #620980)
2002-10-31 18:38:55 -05:00
Theodore Ts'o 76dd5e5c28 Add support for the meta_bg feature flag to the resize2fs program.
Fix bug in meta_bg support in mke2fs, e2fsck, and dumpe2fs; we were 
incorrectly reserving the legacy block groups desriptor blocks.
2002-10-30 23:07:21 -05:00
Theodore Ts'o c046ac7f2e Add support for the meta_blockgroup filesystem format. 2002-10-20 00:38:57 -04:00
Theodore Ts'o 3e69906495 Fix gcc -Wall nits.
Fix format bug if NLS is in use.

Add extra so that the info directory looks OK on OpenWall.
2002-10-13 23:56:28 -04:00
Theodore Ts'o d237a78e4e Handle BAD_BLOCK_IN_INODE_TABLE even at the beginning of the
inode table, and shrink code by reorganizing the while loop so 
to eliminate duplicate calls to ext2fs_get_next_inode().
2002-10-03 01:09:35 -04:00
Theodore Ts'o f044b4d8a0 Update and clarify man pages (addresses Debian Bug #145044).
Let e2fsck allow use of the TEA hash.

Mke2fs will no longer abort if it can't zero blocks at the end of the
filesystem.  (Addresses Debian Bug #155007)
2002-08-17 13:32:21 -04:00
Theodore Ts'o 0684a4f33b Overhaul extended attribute handling. Should now be correct with
respect to the latest V2 bestbits ACL code.
2002-08-17 10:19:44 -04:00
Theodore Ts'o 3214a453db pass1.c (e2fsck_pass1): If e2fsck is run with -n, don't create
the dirs_to_hash list, since we don't want to reindex
	directories if the filesystem is opened read-only.
2002-07-23 12:00:00 -04:00
Theodore Ts'o b7a00563b2 Add support to e2fsck to reindex directories to use hash trees. 2002-07-20 00:28:07 -04:00
Theodore Ts'o 503f9e7f6e Add support for the half-MD4 HTREE hash.
Add HTREE root node tests.
2002-06-26 16:52:10 -04:00
Theodore Ts'o 8fdc9985c1 Add initial support for htree directories. 2002-06-25 23:26:34 -04:00
Theodore Ts'o 0d63467ddb Update to support the V2 Bestbits EA format. 2002-05-22 00:22:38 -04:00
Theodore Ts'o da307041e7 Check for inodes which are too big (either too many blocks, or
would cause i_size to be too big), and offer to truncate the inode.
Remove old bogus i_size checks.

Add test case which tests e2fsck's handling of large sparse files.
Older e2fsck with the old(er) bogus i_size checks didn't handle
this correctly.
2002-05-21 21:19:14 -04:00
Theodore Ts'o bcf9c5d401 Fix up Andreas' changeset. Avoid use of dynamic automatic arrays,
and check for EXT2_INDEX_FL for special devices, and consider them to
be invalid if they are set.
2002-05-21 09:14:17 -04:00
Andreas Dilger b94a052a25 Add more complete tests for symlinks: nul termination of long links and length
Improve the f_badsymlinks test case for these new tests.
2002-05-18 13:16:30 -06:00
Theodore Ts'o 7823dd6572 Fix fencepost error in allocating space for array. 2002-05-17 23:37:42 -04:00
Theodore Ts'o 31e29a12d1 Fix up Andreas's 8k blocksize changes to fix a number of bugs,
and to make the page size determined at run-time instead of 
compile time.
2002-05-17 10:53:07 -04:00
Andreas Dilger 932a489cdf Add support for creating and checking 8192-byte blocksize filesystems.
We complain if you try to create such a filesystem on a system with 4096
byte PAGE_SIZE.

Add checks for valid inode size for undocumented -I option.
2002-05-16 03:20:07 -06:00
Theodore Ts'o 4ea7bd0439 Fix various gcc -Wall nits. Fixed a bug in mke2fs where a bogus
error message could be printed on an malloc() failure, and e2image
was optimized to avoid needless system calls by using the stashed
inode functions.
2001-12-16 23:23:37 -05:00
Andreas Dilger 59f27247f8 mke2fs.c (main): Zap the second sector of the disk, along with
any sectors in the same filesystem block after the superblock.
        The latter will remove (for example) swapspace signatures
        on 4kB+ blocksize filesystems.  Also when zeroing the "end"
        of the filesystem don't actually zero the start of a very
        small device (less than 128kB).
2001-08-30 15:39:04 -06:00
Theodore Ts'o b1f204f7f9 pass1.c (e2fsck_pass1): For EXT2_RESIZE_INO, allow its i_mode to
either be zero or a regular file (for compatibility with
	Andreas's on-line resizing programs).
2001-08-30 16:42:09 -04:00
Theodore Ts'o 53abed0afa Deal with libc5's lack of strnlen.
Stop checking for strdup in the configure script since we don't 
care about that symbol.
2001-08-27 12:18:16 -04:00
Theodore Ts'o a40ecbb1fc e2fsck/pass1.c (e2fsck_pass1_check_device_inode): If i_blocks is
non-zero, then assume that the device/socket/fifo inode
	is bogus.
2001-08-13 06:15:36 -04:00
Theodore Ts'o 85645a6ff3 pass1.c (check_size): Fix logic in check_size; the previous code
only offered to clear the inode size fields if both size
	and i_size_high were zero.
2001-08-13 06:11:39 -04:00
Theodore Ts'o a474269147 pass1.c, pass2.c, problem.c, problem.h: Fix bug introduced by
Andreas's symlink code; check_blocks() was unconditionally testing
	inode_bad_map without checking to see if it existed first.  Fixed
	problem a different way; we now no longer check inode_bad_map at all,
	since the file might not get deleted in pass 2 anyway.  We move the
	large file feature reconciliation code to to e2fsck_pass2(), and in
	deallocate_inode() in pass2.c, we decrement the large files counter if
	we're about to delete a large file.
2001-08-09 04:14:04 -04:00
Theodore Ts'o d007cb4cbb Cleanup changes to Andreas' symlink patch. Remove use of EXT2_LINK_DIR
Also cleaned up the symlink handling code to make it a bit more
compact and to test for a bad symlink block earlier.
2001-08-04 20:39:39 -04:00
Andreas Dilger 67052a8aee Add extra checks for bad symlinks, including zero length symlinks,
too long i_size for slow and fast symlinks, i_size_high set, multiple
blocks for slow symlinks.
2001-08-04 00:51:18 -06:00
Theodore Ts'o fd77b2c78a pass1.c (e2fsck_pass1): Check for symlinks that have the
immutable flag set (and offer to clear them).
2001-07-27 22:10:01 -04:00
Theodore Ts'o 24ceb248ab pass1.c (e2fsck_pass1): Free ctx->block_ea_map at the end of pass 1.
This avoids increasing the memory footprint of e2fsck by 10%!
2001-07-26 09:02:56 -04:00
Theodore Ts'o 14fe1c3314 Apply fixes reported by Andreas Gruenbacher:
pass1.c (check_ext_attr): Skip zero-length EA entries.

problem.c: PR_1_EA_ALLOC_COLLISION shouldn't abort, but should prompt
	to clear the EA block.
2001-07-25 19:48:24 -04:00
Theodore Ts'o 55fd07ed0a This patch completes the initial extended attribute/ACL support for
e2fsck.  We now check the entire EA block to make sure that the all
of the EA entries look sane.
2001-07-19 16:31:25 -04:00
Theodore Ts'o b5acdb6ae2 pass1.c (e2fsck_pass1): Defer inodes which have an extended attribute
block for later processing to avoid extra seeks across the disk.
	(process_inode_cmp): If there is no indirect block, sort by the
	extended attribute (i_file_acl) block.
2001-07-07 22:27:40 -04:00
Theodore Ts'o e8a3ee628a Add code to check and fix incorrect reference counts in the extended
attribute blocks.
2001-07-07 11:12:50 -04:00
Theodore Ts'o 342d847db3 Add initial support for extended attribute blocks 2001-07-02 11:54:09 -04:00
Theodore Ts'o fdbdea09b8 ChangeLog, pass1.c, pass2.c, problem.c, problem.h:
pass1.c (mark_inode_bad): Replace alloc_bad_map with a function which
  	sets the bit in the bad inode bitmap.
  	(e2fsck_pass1): Check for fast symlinks with an invalid size, and set
  	the bad inode map in that case.
  pass2.c (e2fsck_process_bad_inode): Check for fast symlinks with an
  	invalid size and prompt the user if the inode should be cleared.
  problem.h, problem.c (PR_2_SYMLINK_SIZE): Added new problem code.
2001-06-02 04:26:26 +00:00
Theodore Ts'o 71d521c609 ChangeLog, pass1.c, pass1b.c:
pass1.c (pass1_get_blocks, pass1_read_inode, pass1_write_inode,
  	pass1_check_directory): Add a safety check to make sure
  	ctx->stashed_inode is non-zero.
  pass1b.c (pass1b): Use e2fsck_use_inode_shortcuts() to disable the
  	inode shortcut processing, instead of manually clearing only half of
  	the function pointers that needed to be NULL'ed out.  This caused
  	nasty bugs if the last inode in the filesystem needed dup block
  	processing.
  pass1b.c (clone_file_block): When cloning a directory's metadata
  	block, don't try to update the directory block list database, since
  	indirect blocks aren't stored in the database and the resulting error
  	will abort the file clone operation.
2001-06-01 19:29:36 +00:00
Theodore Ts'o 21afac096d ChangeLog, pass1.c, problem.c, problem.h, problemP.h:
pass1.c: Treat inodes with a low dtime (that were from a corrupted
  	orphan list) specially.
  problem.c, problem.h: Add new problem codes PR_1_LOW_DTIME and
  	PR_1_ORPHAN_LIST_REFUGEES, and a new latch group, PR_LATCH_LOW_DTIME.
  problemP.h: Expand the size of the problem flag to be an int instead
  	of a short.  Expand space in the flag word which is reserved for
  	problem latch flags from 3 bits to 8 bits.
ChangeLog, expect.1, expect.2, image.gz, name:
  f_badorphan: New test which verifies corrupted orphan list handling.
2001-05-14 12:47:41 +00:00