Commit Graph

299 Commits (7ef1b8b4248ab099f4ac4c921fe8c0def831f255)

Author SHA1 Message Date
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
Theodore Ts'o a5c33f26db ChangeLog, pass1.c:
pass1.c (check_blocks): Fix large file checking code so that files >
  	2GB are considered large files, and restrict directories from being >
  	2GB.
version.h:
  Update for WIP release.
2001-01-18 02:34:03 +00:00
Theodore Ts'o a9ca2016e1 ChangeLog, pass1.c, problem.c, problem.h:
pass1.c (e2fsck_pass1): Cap the maximum legal size of a file by the
  	limit caused by the fact that i_blocks is in 512 byte units, and that
  	the Linux buffer cache also fundamentally assumes 512 byte sectors.
  	Make sure that the journal inode is a regular file, and when clearing
  	an unused journal inode, make sure the icount db is updated.
  problem.c, problem.h (PR_1_JOURNAL_BAD_MODE): Add new problem code.
ChangeLog, journal.c:
  journal.c (e2fsck_journal_fix_unsupported_super): Remove unused
  	function.  Add FIXME notes to e2fsck_get_journal(), from Andreas
  	Dilger.
2001-01-12 21:53:25 +00:00
Theodore Ts'o 5ba23cb149 ChangeLog, e2fsck.h, flushb.c, iscan.c, unix.c:
iscan.c, unix.c, e2fsck.h: Don't use NOARGS, and use
  	ext2fs_sync_device() instead of using BLKFLSBUF.
  flushb.c: Don't use NOARGS anymore; everything is STDC these days.
ChangeLog, pass1.c:
  pass1.c (process_block): Remove dead code which was never getting
  	executed.
2001-01-11 19:15:02 +00:00
Theodore Ts'o 86c627ec11 Many files:
dirinfo.c, e2fsck.h, emptydir.c, iscan.c, jfs_user.h, journal.c,
  	message.c, pass1.c, pass1b.c, pass2.c, pass3.c, pass4.c, pass5.c,
  	problem.h, scantest.c, super.c, swapfs.c: Change ino_t to ext2_ino_t.
2001-01-11 15:12:14 +00:00
Theodore Ts'o 53ef44c40a Many files:
journal.c, pass1.c, pass1b.c, pass3.c, recovery.c, revoke.c, super.c,
  	unix.c, util.c: Fix random gcc -Wall complaints.
  jfs_user.h: Use more sophisticated inline handling to allow building
  	with --enable-gcc-wall
2001-01-06 05:55:58 +00:00
Theodore Ts'o f18996c8eb ChangeLog, pass1.c, problem.c, problem.h:
pass1.c (e2fsck_pass1): Moved journal inode handling out to its own
  	block; if the journal inode is not in use, and it contains data, offer
  	to clear it.
  problem.h, problem.c (PR1_JOURNAL_INODE_NOT_CLEAR): Add new problem
  	code.
  problem.c: Modified problem table to use a new abbreviations.
2001-01-03 16:57:24 +00:00
Theodore Ts'o 5dd8f963d0 ChangeLog, journal.c, pass1.c, super.c, unix.c:
journal.c, pass1.c, super.c, unix.c: Replace use of struct ext2fs_sb
  	with struct ext2_super_block.
ChangeLog, debugfs.c:
  debugfs.c Replace use of struct ext2fs_sb with struct ext2_super_block.
2001-01-01 15:51:50 +00:00
Theodore Ts'o f5ae75e5f0 ChangeLog, pass1.c:
pass1.c (check_blocks): Remove use of EXT2_HAS_*_FEATURE macros.
2001-01-01 14:52:52 +00:00
Theodore Ts'o 8188c9e6b3 ChangeLog, pass1.c:
pass1.c (e2fsck_pass1): Offer to update the filesystem revision level
  	if we need to set large files flag.  Patch from Andreas Dilger.
2000-12-13 18:39:14 +00:00
Theodore Ts'o b09a4b0c90 ChangeLog, pass1.c:
pass1.c (e2fsck_pass1): Don't check the i_mode field for the journal
  	inode, if it is in use.
2000-10-24 21:16:09 +00:00
Theodore Ts'o 9cbfb8d0d9 ChangeLog, pass1.c:
pass1.c (e2fsck_pass1): Check to see if the ext3 s_last_orphan field
  	is set; if so, clear it, so that ext3 mounting code won't get confused
  	by the fact that we've cleared out the orphaned inodes.
2000-07-04 19:51:22 +00:00
Theodore Ts'o d647a1ea4d ChangeLog, pass1.c, problem.c, problem.h:
pass1.c (pass1, check_size): Apply patch from Chris Wedgewood
  	(cw@foof.org) which checks to see if special devices have a non-zero
  	size, and deals with it.
  problem.c, problem.h (PR1_SET_NONZSIZE): Add new problem code.
2000-05-27 14:40:09 +00:00
Theodore Ts'o 01fbc70141 ChangeLog, pass1.c, problem.c:
pass1.c (check_immutable, e2fsck_pass1_check_device_inode): Check for
  	the append-only as well as the immutable flag.
  problem.c (PR_1_SET_IMMUTABLE): Adjust message to include append-only
  	flag.  Fix comment for compression flag.
2000-04-03 13:57:21 +00:00
Theodore Ts'o 1917875fcd Many files:
unix.c (main): If compression is enabled on the filesystem, print a
  	warning message (for now).
  message.c: Add new compression shortcut: @c == compress
  problem.c, problem.h (PR_1_COMPR_SET): Add new error code.
  pass1.c (check_blocks): If the inode has EXT2_COMPRBLK_FL flag set,
  	check to see if the filesystem supports compression.  If it does pass
  	this information down to process_block() so it can treat the
  	compressed block flag words correctly.  If not, offer to clear the
  	flag, since it shouldn't be set.
  	(process_block): If an inode has the compressed inode flag set, allow
  	EXT2FS_COMPRESSED_BLKADDR.
  pass1b.c (process_pass1b_block, delete_file_block, clone_file_block):
  pass2.c (deallocate_inode_block): Use HOLE_BLKADDR to check to see if
  	the block can be skipped.
ChangeLog, Makefile.in:
  Makefile.in: Exclude the internationalization files from being
  	distributed.
ChangeLog, configure, configure.in:
  configure.in: Add support for --enable-compression.  This is
  	experimental code only for now, which is why it's under --enable test.
  	Once it's stable, it will always be compiled in.
TODO:
  Commit additional TODO items.
2000-02-11 15:55:07 +00:00
Theodore Ts'o 80c5d7e45f ChangeLog, e2fsck.h, pass1.c, pass1b.c:
e2fsck.h:
  pass1.c (mark_table_blocks, e2fsck_pass1): Remove
  	ctx->block_illegal_map, since it's not needed by pass1, and pass1b has
  	been modified to calculate it manually if needed.  This reduces the
  	memory footprint needed by e2fsck.
  pass1b.c (check_if_fs_block): New static function which returns
  	whether or not a block overlaps with filesystem metadata.  This
  	replaces consulting the block_illegal_map bitmap.
util.c:
  Make resource tracking message more concise.
2000-02-08 23:19:32 +00:00
Theodore Ts'o 0c4a07264e Many files:
badblocks.c, e2fsck.h, ehandler.c, emptydir.c, extend.c, flushb.c,
  	iscan.c, message.c, pass1.c, pass1b.c, pass3.c pass4.c, pass5.c,
  	problem.c, scantest.c, swapfs.c, unix.c, util.c: Add
  	Internationalization support as suggested by Marco d'Itri
  	<md@linux.it>.
2000-02-07 03:11:03 +00:00
Theodore Ts'o 86a63e92eb ChangeLog, pass1.c:
pass1.c (process_inodes): Add shortcut handling; if
  	process_inodes_count is zero, return right away, to avoid calling
  	qsort with a non-positive count.
1999-11-23 13:52:48 +00:00
Theodore Ts'o 6fdc7a325c ChangeLog, e2fsck.h, pass1.c, pass2.c, pass3.c, problem.c, problem.h, util.c:
pass1.c (e2fsck_pass1): If the filesystem does not support imagic
  	inodes, if an inode has the imagic flag set, offer to clear the imagic
  	flag.  If a valid device/fifo/socket has the immutable flag set, call
  	the new helper function check_immutable() to offerto clear the
  	immutable flag.
  pass2.c (check_filetype): Use the new ext2_file_type() helper function
  	instead of calculating the file_type information manually.
  pass3.c (e2fsck_reconnect_file): When adding a link to lost+found,
  	calculate the filetype information so that ext2fs_link() can use the
  	information if applicable.  (get_lost_and_found): Create the
  	/lost+found directory with the correct filetype information if
  	applicable.
  util.c (ext2_file_type), e2fsck.h: New function which returns the
  	directory entry file type information given the inode's mode bits.
  problem.c, problem.h: Added new problem codes PR_1_SET_IMAGIC and
  	PR_1_SET_IMMUTABLE.
ChangeLog, mke2fs.8.in:
  mke2fs.8.in: Update manual page so that the sparse_option filesystem
  	option is properly named.
1999-11-10 13:34:40 +00:00
Theodore Ts'o aa4115a47c Many files:
pass4.c (e2fsck_pass4): If an inode is set in the inode_imagic_map
  	bitmap, don't check to see if it is disconnected from the inode tree
  	(because it almost certainly will be).  Free inode_imagic_map at the
  	end of pass 4.
  pass2.c (check_dir_block, check_filetype): If the FILETYPE feature is
  	set, check the directory entry's filetype information field, and
  	fix/set it if necessary.  (e2fsck_pass2): Free the inode_reg_map
  	bitmap at the end of pass 2.
  pass1.c (e2fsck_pass1, alloc_imagic_map): Allocate and fill in
  	information for inode_reg_map and inode_imagic_map, which indicates
  	which inodes are regular files and AFS inodes, respectively.
  	Since only the master superblock is written during a restart, force
  	that superblock to be used after a restart; otherwise changes to the
  	block group descriptors end up getting ignored.
  problem.c, problemP.h: If e2fsck is run -n, make def_yn variable be 0
  	for "no".  Add support for a new flag, PR_NO_NOMSG, which supresses
  	the problem message if e2fsck is run with the -n option.
  problem.c, problem.h (PR_2_SET_FILETYPE, PR_2_BAD_FILETYPE): Add new
  	problem codes.
  message.c (expand_dirent_expression): Add support for %dt which prints
  	the dirent type information.
  e2fsck.c (e2fsck_reset_context): Free new bitmaps (inode_reg_map and
  	inode_imagic_map).
  e2fsck.h (e2fsck_t): Add new inode_reg_map and inode_magic_map to the
  	context structure.
ChangeLog, nt_io.c:
  nt_io.c: New file which supports I/O under Windows NT.
ChangeLog, gen_uuid_nt.c:
  gen_uuid_nt.c: New file which creates a UUID under Windows NT.
Many files:
  Add support for non-Unix compiles
1999-10-21 19:33:18 +00:00
Theodore Ts'o 5596defa1e Many files:
unix.c: Add support for calculating a progress bar if the -C0 option
  	is given.  The function e2fsck_clear_progbar() clears the progress bar
  	and must be called before any message is issued.  SIGUSR1 will enable
  	the progress bar, and SIGUSR2 will disable the progress bar.  This is
  	used by fsck to handle parallel filesystem checks.  Also, set the
  	device_name from the filesystem label if it is available.
  e2fsck.h: Add new flags E2F_FLAG_PROG_BAR and E2F_FLAG_PROG_SUPRESS.
  	Add new field in the e2fsck structure which contains the last tenth of
  	a percent printed for the user.
  message.c (print_e2fsck_message): Add call to e2fsck_clear_progbar().
  pass1.c (e2fsck_pass1):
  pass2.c (e2fsck_pass2):
  pass3.c (e2fsck_pass3):
  pass4.c (e2fsck_pass4):
  pass5.c (e2fsck_pass5): Add call to e2fsck_clear_progbar when printing
  	the resource tracking information.
  pass5.c (check_block_bitmaps, check_inode_bitmaps): If there is an
  	error in the bitmaps, suppress printing the progress bar using the
  	suppression flag for the remainder of the check, in order to clean up
  	the display.
1999-07-19 15:27:37 +00:00
Theodore Ts'o e72a9ba394 ChangeLog, e2fsck.h, pass1.c, pass2.c, pass4.c, swapfs.c:
e2fsck.h:
  pass1.c (pass1_get_blocks, pass1_read_inode, pass1_write_inode,
  	pass1_check_directory, e2fsck_use_inode_shortcuts): Make pass1_* be
  	private static functions, and create new function
  	e2fsck_use_inode_shortcuts which sets and clears the inode shortcut
  	functions in the fs structure.
  e2fsck.h:
  pass2.c (e2fsck_process_bad_inode): Make process_bad_inode() an
  	exported function.
  pass4.c (e2fsck_pass4): Call e2fsck_process_bad_inode to check if a
  	disconnected inode has any problems before connecting it to
  	/lost+found.  Bug and suggested fix by Pavel Machek <pavel@bug.ucw.cz>
ChangeLog, swapfs.c:
  swapfs.c (ext2fs_swap_inode): Add compatibility for Linux 2.3 kernels
  	that use i_generation instead of i_version.  Patch supplied by Jon
  	Bright <sircus@sircus.demon.co.uk>.
ChangeLog, mke2fs.8.in:
  mke2fs.8.in: Fix typo in man page which caused the badblocks command
  	to not show up in the "SEE ALSO" section.
ChangeLog, expect.1, expect.2, image.gz, name:
  f_recnect_bad: New test which checks the case where a disconnect inode
  	also bad inode fields; we need to make sure e2fsck offers to fix the
  	inode (or clear the inode, as necessary).
1999-06-25 15:40:18 +00:00
Theodore Ts'o 1dde43f0c1 ChangeLog, mke2fs.c, tune2fs.8.in:
tune2fs.8.in: Fix minor display bug in the nroff.
  mke2fs.c (show_stats, write_inode_tables): Use the log10 function to
  	calculate the display of block numbers so that things look nice on an
  	80 character display.
  mke2fs.c (usage): Add the sparse-super-flag to the usage message.
ChangeLog, e2fsck.c, pass1.c, pass2.c, problem.c, problem.h, unix.c:
  unix.c (main): Move ext2fs_close() after e2fsck_free_context() since
  	e2fsck_free_context may reference data in ctx->fs.
  e2fsck.c (e2fsck_reset_context): Make sure ctx->fs is non-NULL before
  	checking ctx->fs->dblist.
  pass1.c (e2fsck_pass1): Use the device check subroutine on FIFO's and
  	Socket's, so that we catch bogus immutable inodes.
  pass2.c (process_bad_inode): Process bad socket and fifo's.
  problem.h, problem.c: Define new problem codes PR_2_BAD_FIFO and
  	PR_2_BAD_SOCKET.
1998-11-14 04:18:28 +00:00
Theodore Ts'o 874b4d262e ChangeLog, pass1.c:
pass1.c (e2fsck_pass1): Use ext2fs_sb structure for compatibility with
  	older kernels.
1998-07-06 14:33:12 +00:00
Theodore Ts'o 9d1bd3de8d ChangeLog, pass1.c, problem.h:
pass1.c, problem.h: Change blkcnt_t to be e2_blkcnt_t to avoid
  collision with LFS API.
  pass1.c (e2fsck_pass1): Fix bug so that ext2_max_sizes is properly
  	initialized.
  (e2fsck_pass1): Don't allow the the boot loader inode to be a
  	directory (clear the inode mode field if so).
1998-06-10 20:45:22 +00:00
Theodore Ts'o 4c77fe50d9 ChangeLog, e2fsck.h, pass1.c, super.c:
pass1.c (process_inode_cmp): Use EXT2_QSORT_TYPE to define the
  	appropriate return type for comparison functions for qsort.
  e2fsck.h: Add #ifdef protection for unistd.h
  super.c: Remove header files already included by e2fsck.h
ChangeLog, dblist.c, ext2fs.h:
  ext2fs.h: Define EXT2_QSORT_TYPE appropriately for the return type for
  	comparison functions for qsort.
  dblist.c (dir_block_cmp): Use EXT2_QSORT_TYPE in function declaration.
ChangeLog, extent.c:
  extent.c (ext2fs_create_extent_table): Use ext2fs_free_mem instead of
  	free().
  (extent_cmp): Use EXT2_QSORT_TYPE to define the appropriate return
  	type for comparison functions for qsort.
1998-04-30 17:35:59 +00:00
Theodore Ts'o 4c27e6dd1b pass1.c:
Change "long long" to be __s64
1998-03-28 06:44:38 +00:00
Theodore Ts'o 246501c612 Many files:
unix.c: Fix bug in check of feature set, to make sure we can really
  	fix this filesystem.
  problem.h: Make blkcount type to be of type blkcnt_t.  Make the num
  	field be a 64 bit type.  Add the problem code PR_1_FEATURE_LARGE_FILES
  problem.c: Add table entry for the problem code PR_1_FEATURE_LARGE_FILES.
  pass1.c (e2fsck_pass1): A non-zero i_dir_acl field is only a problem
  	for directory inodes.  (Since it is also i_size_high now.)  If there
  	are no large_files, then clear the LARGE_FLAG feature flag.  If there
  	are large_files, but the LARGE_FLAG feature flag is not set, complain
  	and offer to fix it.
  	(check_blocks): Add support to deal with non-directory inodes that
  	have i_size_high set (i.e., large_files).  Don't give an error if a
  	directory has preallocated blocks, to support the DIR_PREALLOC
  	feature.
  	(process_block, process_bad_block): The blockcnt variable is a type of
  	blkcnt_t, for conversion to the new block_iterate2.
  pass2.c (process_bad_inode): A non-zero i_dir_acl field is only a
  	problem for directory inodes.  (Since it is also i_size_high now.)
  message.c (expand_inode_expression): Print a 64-bits of the inode size
  	for non-directory inodes.  (Directory inodes can only use a 32-bit
  	directory acl size, since i_size_high is shared with i_dir_acl.)  Add
  	sanity check so that trying to print out the directory acl on a
  	non-directory inode will print zero.  (expand_percent_expression): %B
  	and %N, which print pctx->blkcount and pctx->num, can now be 64 bit
  	variables.  Print them using the "%lld" format if EXT2_NO_64_TYPE is
  	not defined.
  e2fsck.h: Add the large_flagsfield to the e2fsck context.
  e2fsck.c (e2fsck_reset_context): Clear the large_flags field.
ChangeLog, expect.1:
  f_messy_inode: Modify test to deal with changes to support 64-bit size
  	files.  (/MAKEDEV had i_dir_acl, now i_size_high, set.)
1998-03-24 16:22:38 +00:00
Theodore Ts'o 2df1f6aa07 ChangeLog, e2fsck.c, e2fsck.h, pass1.c:
e2fsck.c (e2fsck_run): Since E2F_FLAG_SIGNAL_MASK doesn't
  	include EXT2_FLAG_RESTART anymore, we need to adjust this
  	routine so that it *does* return in the case of it seeing
  	EXT2_FLAG_RESTART.
  pass1.c (e2fsck_pass1): ext2_get_next_inode() may call the group done
  	callback function, which may set context abort flags.  So we need to
  	test the context abort flags after we call ext2_get_next_inode().
  	(process_inodes): If we abort due out of process_inodes, do a clean
  	exit by breaking out of the for loop instead of just returning.
  e2fsck.h (E2F_FLAG_SIGNAL_MASK): EXT2_FLAG_RESTART shouldn't be
  	considered a SIGNAL mask (i.e., requiring an immediate abort of
  	processing to restart).  FLAG_RESTART just means that we want to
  	restart once pass 1 is complete.
1998-02-27 05:03:48 +00:00
Theodore Ts'o a02ce9df5f Many files:
Change the progress function to return an integer; if returns 1, then
  the progress function is expected to have set the e2fsck context flag
  signalling a user abort, and the caller should also initiate a user
  abort.
1998-02-24 20:22:23 +00:00
Theodore Ts'o 54dc7ca286 Many files:
e2fsck.h: If EXT2_FLAT_INCLUDES is defined, then assume all of
  	the ext2-specific header files are in a flat directory.
  dirinfo.c, ehandler.c, pass1.c, pass1b.c, pass2.c, pass5.c,
  	super.c, swapfs.c, unix.c: Explicitly cast all assignments
  	from void * to be compatible with C++.
  unix.c (sync_disk): Remove sync_disk and calls to that function,
  	since ext2fs_close() now takes care of this.
  pass1.c, pass1b.c, pass2.c, pass3.c, swapfs, badblocks.c,
  	ehandler.c, unix.c: Change use of private to be priv_data, to
  	avoid C++ reserved name clash.
1998-01-19 14:50:49 +00:00
Theodore Ts'o 7fdfabd321 ChangeLog, pass1.c, util.c:
pass1.c (e2fsck_pass1_check_device_inode): For now, only check to make
  	sure the extra i_blocks in a device are cleared if the immutable flag
  	is set.
  util.c (print_resource_track): Fix typo which caused the time/resource
  	tracking to print "Pass 1 :" instead of "Pass 1: ".
version.h:
  Change version to 1.12-WIP, in preparation for an e2fsprogs 1.12 release.
1997-11-24 11:51:17 +00:00
Theodore Ts'o 8039c4802f ChangeLog, pass1.c:
Fix bug where first_block wasn't getting incremented, which caused
  user to get a "Programming error?" warning if there was a bad block in
  a non-primary superblock/group_descriptor.  Also fixed another bug so
  that ext2fs_bg_has_super() is consulted, to avoid problems when using
  a filesystem with the sparse_groups option set and there are bad
  blocks at the beginning of a group which doesn't have a superblock.
1997-11-19 21:39:13 +00:00
Theodore Ts'o f8188fff23 Many files:
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c: Add calls to the progress
  	indicator function.
  pass1.c (scan_callback): Add call to the progress feedback function
  	(if it exists).
  super.c (check_super_block): Skip the device size check if the
  	get_device_size returns EXT2_EXT_UNIMPLEMENTED.
  iscan.c (main): Don't use fatal_error() anymore.
  pass1b.c, swapfs.c, badblocks.c: Set E2F_FLAG_ABORT instead of calling
  	fatal_error(0).
  problem.c, pass3.c (PR_3_ROOT_NOT_DIR_ABORT,
  	PR_3_NO_ROOT_INODE_ABORT): New problem codes.
  problem.c, pass2.c (PR_2_SPLIT_DOT): New problem code.
  problem.c, pass1.c (PR_1_SUPPRESS_MESSAGES): New problem code.
  problemP.h: New file which separates out the private fix_problem data
  	structures.
  util.c, dirinfo.c, pass1.c, pass1b.c, pass2.c, pass5.c, super.c,
  	swapfs.c util.c: allocate_memory() now takes a e2fsck context as its
  	first argument, and rename it to be e2fsck_allocate_memory().
problemP.h:
  New file which contains the private problem abstraction definitions.
Makefile.pq:
  Remove include of MAKEFILE.STD, which doesn't exist at this point.
1997-11-14 05:23:04 +00:00
Theodore Ts'o 08b213017f Many files:
Change ext2fs_read_inode, ext2fs_write_inode to take the e2fsck
  context as their first argument.
  Change dir_info.c routines to take an e2fsck_context, renamed them to
  start with e2fsck_ to avoid namespace issues, and changed them to
  store the directory information inside the e2fsck context.
  Added e2fsck_run() which calls all of the e2fsck passes in the correct
  order, and which handles the return of abort codes.
  Added abort processing, both via setjmp/longjmp and via flags in the
  e2fsck context.
  Use a flag in the e2fsck context instead of the restart_e2fsck global
  variable.
  Change uses of free and malloc to ext2fs_free_mem and ext2fs_get_mem.
1997-11-03 19:42:40 +00:00
Theodore Ts'o 291c9049ba ext2fs.h, ext2_err.et.in, ChangeLog, pass1.c, pass3.c:
Rename new error codes to _ET_ in them for consistency.
ChangeLog, et_c.awk, et_h.awk:
  Remove support for non STDC compilers, since the workarounds caused
  problems with the header file.
Makefile.pq:
  Checkpoint of powerquest work.
1997-10-31 06:17:08 +00:00
Theodore Ts'o c555aebde4 Many files:
alloc.c (ext2fs_alloc_block): New function which allocates a
  	block and updates the filesystem accounting records
  	appropriately.
  ext2_err.et.in: Added new error codes: EXT2_NO_MEMORY,
  	EXT2_INVALID_ARGUMENT, EXT2_BLOCK_ALLOC_FAIL, EXT2_INODE_ALLOC_FAIL,
  	EXT2_NOT_DIRECTORY
  Change various library files to use these functions instead of EINVAL,
  ENOENT, etc.
ChangeLog, pass1.c, pass3.c:
  pass3.c (get_lost_and_found): Check error return of
  	EXT2_FILE_NOT_FOUND instead of ENOTDIR
  pass1.c (pass1_check_directory): Return EXT2_NO_DIRECTORY instead of
  	ENOTDIR
expect.icount:
  Change expected error string to be "Invalid argument passed to ext2 library"
  instead of just "Invalid argument"
1997-10-25 04:16:53 +00:00
Theodore Ts'o 8bf191e866 Many files:
Place #ifdef RESOURCE_TRACK around code which uses init_resource_track
  and print_resource_track.  (Not all systems have timeval)
1997-10-20 01:38:32 +00:00
Theodore Ts'o 1b6bf1759a Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
  	routines.  All diagnostic messages are now routed through the
  	fix_problem interface.
  pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
  problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
  	PR_2_DUP_DOT_DOT.
  problem.c: Added new problem codes for some of the superblock
  	corruption checks, and for the pass header messages.  ("Pass
  	1: xxxxx")
  util.c (print_resource_track): Now takes a description argument.
  super.c, unix.c, e2fsck.c: New files to separate out the
  	operating-specific operations out from e2fsck.c.  e2fsck.c now
  	contains the global e2fsck context management routines, and
  	super.c contains the "pass 0" initial validation of the
  	superblock and global block group descriptors.
  pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
  	(nearly) all global variables and moved them to the e2fsck
  	context structure.
  problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
  	PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
  	PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
  Updated tests to align with e2fsck problem.c changes.
1997-10-03 17:48:10 +00:00
Theodore Ts'o 7cf73dcd3d ChangeLog, e2fsck.h, message.c, pass1.c, pass2.c, problem.c, problem.h:
message.c: Add compression for the word "Illegal"
  problem.c: Added entries for PR_2_BAD_CHAR_DEV and PR_2_BAD_BLOCK_DEV
  pass1.c (pass1, check_device_inode), pass2.c (process_bad_inode): Use
  	a more stringent test for a valid device.
ChangeLog, Makefile.in:
  Makefile.in (install): Fix rm command to use $(DESTDIR) appropriately.
1997-08-14 17:17:16 +00:00
Theodore Ts'o da2e97f7cf ChangeLog, pass1.c, problem.c:
pass1.c (mark_table_blocks): Mark the superblock and group descriptor
  	blocks first, so that any conflicts between these and the bitmap or
  	inode table blocks is noticed.
  problem.c: Fix message printed out when a block or inode bitmap
  	conflicts with other fs data, has the correct group number in it.
1997-06-12 04:28:07 +00:00
Theodore Ts'o 521e368572 Many files:
Checked in e2fsprogs 1.08.
1997-04-29 17:48:10 +00:00
Theodore Ts'o 21c84b71e2 Many files:
Checked in e2fsprogs-1.07
1997-04-29 16:15:03 +00:00
Theodore Ts'o 5c576477cc Many files:
Checked in e2fsprogs 1.06
1997-04-29 15:29:49 +00:00
Theodore Ts'o 1e3472c5f3 Many files:
Checked in e2fsprogs 1.05
1997-04-29 14:53:37 +00:00
Theodore Ts'o 7f88b04341 Many files:
Checkin of e2fsprogs 1.03.
1997-04-26 14:48:50 +00:00
Theodore Ts'o 74becf3c0a Many files:
Checkin of e2fsprogs 1.02.
1997-04-26 14:37:06 +00:00
Theodore Ts'o 50e1e10fa0 Many files:
Checked in e2fsprogs 0.5c
1997-04-26 13:58:21 +00:00
Theodore Ts'o f3db3566b5 Many files:
Checkin of e2fsprogs 0.5b
1997-04-26 13:34:30 +00:00
Theodore Ts'o 3839e65723 Many files:
Checkin of e2fsprogs 0.5b
1997-04-26 13:21:57 +00:00