summaryrefslogtreecommitdiff
path: root/e2fsck/pass1.c
AgeCommit message (Collapse)AuthorFilesLines
2009-04-23e2fsck: On a 32-bit filesystem, make sure i_file_acl_high is zeroTheodore Ts'o1-0/+4
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-12-25e2fsck: Fix an unhandled corruption case in scan_extent_node()Theodore Ts'o1-14/+22
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-22e2fsck: Fix double-counting of non-contiguous extent-based inodesTheodore Ts'o1-7/+0
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-12-08e2fsck: Enhance fragcheck report with file/directory informationTheodore Ts'o1-6/+24
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-08e2fsck: In verbose mode, distinguish between fragmented directories/filesTheodore Ts'o1-4/+12
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-11-16Fix various signed/unsigned gcc warningsTheodore Ts'o1-2/+2
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-09-12Fix compiling under diet libcTheodore Ts'o1-0/+2
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-08-27Remove trailing whitespace for the entire source treeTheodore Ts'o1-91/+91
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-25Add support for with empty directory blocks in 64k blocksize filesystemsTheodore Ts'o1-7/+11
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-17e2fsck: fix spurious complaints about i_size caused by preallocated blocksTheodore Ts'o1-1/+3
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-17e2fsck: Fix max size calculation for extent filesTheodore Ts'o1-1/+3
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-14e2fsck: Fix ind/dind/tind statistics and add extent depth statisticsTheodore Ts'o1-6/+17
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-12e2fsck: Fix signed/unsigned error in fragcheck report for indirect blocksTheodore Ts'o1-2/+2
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-10e2fsck: Fix check to see if an extent-based file is fragmentedTheodore Ts'o1-2/+25
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-07-07e2fsck: Fix i_size checking for large extent-based filesEric Sandeen1-4/+12
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-06-07Fix gcc -Wall warnings in e2fsckTheodore Ts'o1-6/+5
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-06-02e2fsck: Detect unordered extents in an extent nodeTheodore Ts'o1-4/+7
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-02e2fsck: Wire up callback functions for _alloc_block() and _block_alloc_stats()Theodore Ts'o1-0/+47
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-05-30e2fsck: Don't double count an extent after deleting the last extentTheodore Ts'o1-1/+5
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-28e2fsck: Don't skip an extent after deleting an invalid extentTheodore Ts'o1-0/+8
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-04-17e2fsck: Only check PR_1_EXTENT_ENDS_BEYOND for leaf nodesEric Sandeen1-1/+2
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-17Add support for the HUGE_FILE featureTheodore Ts'o1-2/+10
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-04-01e2fsck: Fix extent flag validity tests in pass1 on big endian boxes.Eric Sandeen1-5/+46
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-03-24e2fsck: Don't object to extents flags on deleted fast symlinksTheodore Ts'o1-8/+8
Thanks to Aneesh Kumar for pointing this out. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-20Fix ext2fs_extent_get for uninit leaf extentsEric Sandeen1-2/+4
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-13e2fsck: Check for fast symlinks that have EXTENTS_FL setTheodore Ts'o1-0/+8
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-13e2fsck: Support long symlinks which use extentsTheodore Ts'o1-3/+29
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-13Merge branch 'maint'Theodore Ts'o1-1/+24
Conflicts: lib/ext2fs/ext2_err.et.in
2008-03-13e2fsck: Fix directory i_size handlingTheodore Ts'o1-1/+24
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-02-22e2fsck: Account for index nodes in the extent tree for i_blocksTheodore Ts'o1-0/+1
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-18Improve support for in-inode EA'sAndreas Dilger1-8/+27
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-18e2fsck: Add support for extentsTheodore Ts'o1-22/+178
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-18e2fsck: factor out code to clear an inode into e2fsck_clear_inode()Theodore Ts'o1-29/+32
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>
2007-11-01Merge branch 'cl/remove-masix' into nextTheodore Ts'o1-4/+0
2007-11-01e2fsck: remove masix supportColy Li1-4/+0
This patch remove masix support from e2fsck. Signed-off-by: Coly Li <coyli@suse.de>
2007-11-01check_ea_in_inode: Cleanup e2fsck_write_inode_full() callDmitry V. Levin1-1/+1
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-08-03Merge branch 'maint'Theodore Ts'o1-1/+6
2007-08-03e2fsck: Allow i_size to be rounded up to the size of a VM pageTheodore Ts'o1-1/+6
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-03Add I/O statistics to e2fsckTheodore Ts'o1-2/+2
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-06-22e2fsck: added sanity check for xattr validationAndreas Dilger1-0/+5
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-05-22Fix gcc -Wall issues in e2fsck sourcesTheodore Ts'o1-5/+7
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
2007-05-08Remove check in e2fsck which requires EA's in inodes to be sortedKalpak Shah1-12/+1
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-04-14Fix e2fsck's check_is_really_dir logicTheodore Ts'o1-5/+2
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-14Improve I/O error messages in e2fsckTheodore Ts'o1-5/+13
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-06Enable e2fsck to use the tdb library for the inode count abstractionTheodore Ts'o1-2/+34
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-04Fix potential reference (and free) to an uninitialized pointer in e2fsckTheodore Ts'o1-1/+1
This was introduced recently when fixing a problem noted by Coverty. Oops! Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-04-02e2fsck: Recover a special file which looks an awful lot like a directoryTheodore Ts'o1-0/+69
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-03-31Fix edge case when i_size doesn't get fixed until second e2fsck runTheodore Ts'o1-4/+3
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-28[COVERITY] Fix (error case only) memory leak in e2fsck pass #1Brian Behlendorf1-0/+3
Coverity ID: 37: Resource Leak Coverity ID: 38: Resource Leak Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2007-03-28[COVERITY] Fix memory leak when parsing extended options in e2fsckBrian Behlendorf1-4/+5
Coverity ID: 36: Resource Leak Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>