summaryrefslogtreecommitdiff
path: root/e2fsck
AgeCommit message (Collapse)AuthorFilesLines
2010-02-10Merge branch 'maint' into nextTheodore Ts'o1-11/+55
Conflicts: e2fsck/pass1.c
2010-02-05e2fsck: Fix the check if a file is really a directory to understand extentsNick Dokos1-11/+55
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-01-31Merge branch 'maint' into nextTheodore Ts'o5-83/+81
Conflicts: configure lib/ext2fs/alloc_tables.c misc/mke2fs.c
2010-01-30e2fsck: Remove some erroneously leftover blk_t castsTheodore Ts'o1-7/+5
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2010-01-04e2fsck: Add new e2fsck.conf option: broken_system_clockTheodore Ts'o2-1/+23
The broken_system_clock allows the time to be in the future when in preen mode. It's useful for people who have, as the name implies, broken system clocks. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-11-29e2fsck: Try to update on-disk bitmap in e2fsck_get_alloc_block() callbackTheodore Ts'o1-0/+4
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-29e2fsck: Don't rehash directories which can fit in a single directory blockTheodore Ts'o1-0/+12
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-11-29e2fsck: Fix block allocation for holes in extent-mapped directoriesTheodore Ts'o1-28/+2
In pass 2, when allocating new blocks for holes in directories, use ext2fs_set_bmap() instead of ext2fs_block_iterate2() with a helper function so that the newly allocated directory blocks are correctly assigned in extent-mapped directories. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-11-29e2fsck: detect holes in extent-mapped directoriesTheodore Ts'o1-0/+13
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-29e2fsck: Move check to add an index to a directory after fixing i_sizeTheodore Ts'o1-4/+6
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-29e2fsck: Fix directory with holes even when i_size is wrongTheodore Ts'o1-44/+15
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-16e2fsck: Fix duplicate directory entries for non-indexed directoriesTheodore Ts'o1-6/+6
Duplicate directory entries were not necessarily getting found and fixed for non-indexed directories, since we were sorting these directories by inode number, and the duplicate entry code assumed the entries were getting sorted by name or directory name hash. Addresses-Sourceforge-Bug: #2862551 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-11-16Add $(LIBINTL) to tst_problem linked libs.Matthias Andree1-1/+2
Fixes build problem on systems where gettext() isn't in libc, such as FreeBSD. Signed-off-by: Matthias Andree <matthias.andree@gmx.de> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-10-25Convert ext2fs_group_{first,last}_block() to *block2()Theodore Ts'o2-7/+7
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25Convert ext2fs_block_alloc_stats() calls to block_alloc_stats2()Valerie Aurora Henson5-9/+11
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25Convert to use block group accessor functionsValerie Aurora Henson6-74/+71
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-25libext2fs: Convert ext2fs_bg_flag_test() to ext2fs_bg_flags_test()Theodore Ts'o3-10/+10
After cleaning up ext2fs_bg_flag_set() and ext2fs_bg_flag_clear(), we're left with ext2fs_bg_flag_test(). Convert it to ext2fs_bg_flags_test(). Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-25libext2fs: clean up ext2fs_bg_flags_ interfacesEric Sandeen3-13/+10
The ext2fs_bg_flag* functions were confusing. Currently we have this: void ext2fs_bg_flags_set(ext2_filsys fs, dgrp_t group, __u16 bg_flags); void ext2fs_bg_flags_clear(ext2_filsys fs, dgrp_t group,__u16 bg_flags); (_set (unused) sets exactly bg_flags; _clear clears all and ignores bg_flags) and these, which can twiddle individual bits in bg_flags: void ext2fs_bg_flag_set(ext2_filsys fs, dgrp_t group, __u16 bg_flag); void ext2fs_bg_flag_clear(ext2_filsys fs, dgrp_t group, __u16 bg_flag); A better interface, after the patch below, is just: ext2fs_bg_flags_zap(fs, group) /* zeros bg_flags */ ext2fs_bg_flags_set(fs, group, flags) /* adds flags to bg_flags */ ext2fs_bg_flags_clear(fs, group, flags) /* clears flags in bg_flags */ and remove the original ext2fs_bg_flags_set / ext2fs_bg_flags_clear. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-24Merge branch 'maint' into nextTheodore Ts'o6-40/+53
Conflicts: configure configure.in
2009-10-16e2fsck: Accept superblock times to be fudged by up to 24 hours by defaultTheodore Ts'o4-36/+48
Unfortunately, due to Windows' unfortunate design decision to configure the hardware clock to tick localtime, instead of the more proper and less error-prone UTC time, many users end up in the situation where the system clock is incorrectly set at the time when e2fsck is run. Historically this was usually due to some distributions having buggy init scripts and/or installers that didn't correctly detect this case and take appropriate countermeasures. However, it's still possible, despite the best efforts of init script and installer authors to not be able to detect this misconfiguration, usually due to a buggy or misconfigured virtualization manager or the installer not having access to a network time server during the installation process. So by default, we allow the superblock times to be fudged by up to 24 hours. This can be disabled by setting options.accept_time_fudge to the boolean value of false in e2fsck.conf. The old options.buggy_init_scripts is left for backwards compatibility. Since we are now accepting the 24 hour time fudge by default, there is no longer a need to install an Ubuntu-specific e2fsck.conf file, so we can remove it. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-12e2fsck: Fix handling of non-zero i_blocks_high fieldTheodore Ts'o2-4/+14
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-04Merge branch 'maint' into nextTheodore Ts'o4-122/+122
Conflicts: configure configure.in misc/mke2fs.c
2009-10-04e2fsck: Interpret negative blkcount in file system problem reportsTheodore Ts'o2-25/+50
Non-expert users get confused when they see messages like this: Illegal block #-1 (2291965952) in inode 176. CLEARED. So change it to be something a little bit more understandable: Illegal indirect block (2291965952) in inode 176. CLEARED. Addresses-SourceForge-Bug: #2871782 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-04Don't use in-tree header files if using system uuid or blkid librariesTheodore Ts'o1-96/+71
This commit forces the use of the system-provided blkid or uuid header files if we are using the system-provided blkid or uuid libraries. This avoids using the in-tree header files with the system libraries. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-10-03e2fsck: Use the correct problem code in the case of LAST_WRITE_FUDGEDTheodore Ts'o1-1/+1
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07Convert uses of super->s_*_blocks_count to ext2fs_*_blocks_count()Valerie Aurora Henson7-49/+50
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-07Use ext2fs_file_acl_block() instead of using .i_file_acl directlyValerie Aurora Henson5-49/+63
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-07Fix overflow in calculation of total file system blocksValerie Aurora Henson1-1/+1
Blocks per group and group desc count are both 32-bit; multiplied they produce a 32-bit quantity which overflowed. Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-01e2fsck: Avoid scary failure messages on low-memory systemsTheodore Ts'o1-2/+7
On a very low-memory system, where ext2fs_check_desc() fails because it can't allocate a block bitmap, catch this error and report it immediate. This avoids something like this, which could scare and mislead the user: e2fsck: Group descriptors look bad... trying backup blocks... Media was not cleanly unmounted, check forced. Pass 1: Checking inodes, blocks, and sizes Error allocating block bitmap (1): Memory allocation failed e2fsck: aborted Addresses-Debian-Bug: #509529 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07Use accessor functions fields for bg_flags in the block group descriptorsTheodore Ts'o3-23/+24
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07Convert to use io_channel_read_blk64() and io_channel_write_blk64()Valerie Aurora Henson7-17/+17
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-09-07Merge branch 'maint' into nextTheodore Ts'o1-2/+7
2009-08-22e2fsck: Convert e2fsck to new bitmap interfaceValerie Aurora Henson11-139/+151
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-08-19e2fsck: Add a global latch question for bad group descriptor checksumsTheodore Ts'o2-1/+11
Very often all the block group descriptors will have bad checksums, so don't force the user answer 'yes' many, many times. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-08-18e2fsck: Only ask to relocate a block group's inode table onceTheodore Ts'o1-1/+2
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-18e2fsck: Teach new_table_block() to allocate new itables/bitmaps with FLEX_BGTheodore Ts'o1-3/+29
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-08e2fsck: Fix and enhance superblock dates in future problem reportsTheodore Ts'o3-17/+30
Fixed a bug where e2fsck would report that last mount time was in the future when it was really the last write time that was in the future. Also, since people can't seem to believe that (a) their distribution has buggy init scripts, or (b) their CMOS/RTC clock or backup battery is dead, print the incorrect time and the current system time. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-08-04e2fsck: Allow cancellation during group descriptor checks.Valerie Aurora Henson1-0/+3
Signed-off-by: Valerie Aurora Henson <vaurora@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-08-22Merge branch 'maint' into nextTheodore Ts'o5-22/+72
2009-07-16e2fsck: Fix superblock times in the future even if buggy_init_scripts=1Theodore Ts'o3-6/+32
Unfortunately, distributions like Ubuntu seem to have buggy init scripts that run e2fsck and mount the root filesystem before making sure the system time and time zone is correctly set. As a result, a filesystem's last write and last mounted time can be set in future. The buggy_init_scripts configuration option will stop e2fsck from aborting the boot process, but it also inhibits the superblock times from getting fixed. This causes resize2fs to refuse to resize the filesystem, even after running e2fsck on the file system. To deal with this, we need to fix the superblock write times unconditionally. Addresses-Launchpad-bug: #373409 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-07-06e2fsck: remove unused variable in check_block_bitmap()Kazuya Mio1-3/+1
check_block_bitmap() calculates the block number of superblock in the current block group but it's not used. Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-07-06e2fsck: optimize loop counter when fixing bitmap paddingKazuya Mio1-2/+2
If unused range of the bitmap has an unmarked bit, check_[inode/block]_end() marks all bits in the range. However, we know that the checked bits are marked. So this patch fixes loop counter to mark from the unmarked bit. Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-07-06e2fsck: remove unnecessary continue statementKazuya Mio1-2/+0
Remove the continue statement because it calls at the end of the loop. Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-07-02Add support for configure --enable-verbose-makecmdsTheodore Ts'o1-57/+57
Some people don't want to see the concise "kernel-style" make output. This configure option allows build engines that want to see the full set of commands executed by the makefile to get what they want. Most people will find this more distracting than useful, unless they need to debug the Makefiles. (It is not necessary to rerun configure to enable this verbose make output temprarily; if a developer wants to do a quick debug of a directory's makefile, he or she can simply edit the definition of the $(E) and $(Q) variables in the Makefile; instructions can be found in the MCONFIG file which is included in at the beginning of every Makefile.) Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-07-01Fix Makefile dependencies for libcom_errTheodore Ts'o1-9/+11
The e2fsprogs makefiles were using the same Makefile variable LIBCOM_ERR for the link-line arguments as well as the dependencies. Since LIBCOM_ERR can now include non-file arguments such as "-lpthread", we need to use a separate DEPLIBCOM_ERR variable that only has build file dependencies. Do the same thing for STATIC_LIBCOM_ERR and PROFILED_LIBCOM_ERR. Addresses-Sourceforge-Patches: #2813809 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-06-21Fix encoding for rec_len in directories for >= 64k blocksize file systemsTheodore Ts'o4-42/+60
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-15e2fsck: fix miscellaneous memory leaksTheodore Ts'o5-2/+8
Fix various miscellaneous memory leaks which were discovered using valgrind. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-07-21Merge branch 'maint' into nextTheodore Ts'o3-6/+32
2009-07-11Use new ext2fs_super_and_bgd_loc2 call in libext2fsJose R. Santos1-3/+3
The new ext2fs_super_and_bgd_loc2() function has some changes aside from just blk64_t support. Lets make sure that the interfaces are sane by adding libext2fs support early to get the new API tested here. Signed-off-by: Jose R. Santos <jrs@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-07-09e2fsck: Speed up pass 5 processing for ext4 filesystemsKazuya Mio1-30/+98
e2fsck_pass5() checks whether the inode and block allocation bitmaps are consistent. However, if EXT2_BG_[INODE/BLOCK]_BITMAP is set to a ext4's block group, most of its bitmap is uninitialized (0). In that case, we can optimize e2fsck's pass 5 by checking the entire range of an uninitalized block group instead of checking bit by bit. This can speed up e2fsck pass 5 by up to 80%: +-----+--------------------+--------------------+ | | old e2fsck | new e2fsck | |Pass | time(s) | time(s) | | | real | user |system| real | user |system| +-----+------+------+------+------+------+------+ | 1 | 5.70| 3.29| 0.50| 5.66| 3.21| 0.54| | 2 | 3.33| 0.80| 0.19| 3.40| 0.82| 0.23| | 3 | 0.01| 0.00| 0.00| 0.01| 0.00| 0.00| | 4 | 1.04| 1.04| 0.00| 1.05| 1.04| 0.00| | 5 | 19.60| 17.27| 0.06| 3.53| 1.21| 0.05| +-----+------+------+------+------+------+------+ |Total| 29.94| 22.57| 0.80| 13.90| 6.47| 0.86| +-----+------+------+------+------+------+------+ Comparison of e2fsck time on an ext4 500GB partition (20% blocks used) Machine environment: CPU: Intel(R) Xeon(TM) CPU 3.00GHz Memory: 1GB Kernel: linux-2.6.29-git2 Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>