Commit Graph

427 Commits (5d17119d14fe1276936c85d7986695a4543b1aa1)

Author SHA1 Message Date
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
Theodore Ts'o 8ade479230 Fix e2fsck and mke2fs -c to be pass the last _block change to badblocks
Badblocks now interprets last_block argument as the last block to check,
instead of the number of blocks to check, to be consistent with the
badblocks man page.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-11-08 00:41:50 -05:00
Theodore Ts'o 977ac8731b Fix potential e2fsck -n crash
Don't core dump if there is a corrupt htree interior node.  If the block
number is larger than the number of blocks in the directory, don't write
past the end of malloc'ed memory.

Addresses SourceForge Bug: #1512778

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-10-21 23:27:03 -04:00
Theodore Ts'o 2d1fa59d90 Minor correction to e2fsck.conf man page
Addresses Debian Bug: #369761

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-10-02 08:38:44 -04:00
Theodore Ts'o cce2f497e0 Fix Debian FTBFS problem caused by devmapper library using pthreads
Addresses Debian bug: #388718

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-10-01 22:18:08 -04: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 f335864338 Add checks to make sure inode counts don't overflow a 32-bit value
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
2006-09-12 14:56:17 -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 d0ff90d520 Fix signed vs unsigned printf format strings for block and inode numbers
There were still some %d's lurking when we print blocks & inodes; also
many of the counters in the e2fsck_struct were signed, and probably
need to be unsigned to avoid overflows.

Signed-off-by: Eric Sandeen <esandeen@redhat.com>
2006-09-12 14:56:15 -04:00
Eric Sandeen 62c6d1403e Remove unused variables
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
2006-09-12 14:56:12 -04:00
Eric Sandeen bb1a46a430 Fix loops over group descriptors to prevent 2**32-1 block number overflows
For loops iterating over all group descriptors, consistently define
first_block and last_block in a way that they are inclusive of the
range, and do not overflow.

Previously on the last block group we did a test of <= first +
dec_blocks; this would actually wrap back to 0 for a total block count
of 2^32-1

Also add handling of last block group which may be smaller.

Signed-off-by: Eric Sandeen <esandeen@redhat.com>
2006-09-12 14:55:22 -04:00
Eric Sandeen 5830d6be9c Detect overflows in loop counters
For loops such as:

for (i=1; i <= fs->super->s_blocks_count; i++) {
        <do_stuff>
}

if i is an int and s_blocks_count is (2^32-1), the condition is never false.
Change these loops to:

for (i=1; i <= fs->super->s_blocks_count && i > 0; i++) {
        <do_stuff>
}

to stop the loop when we overflow i

Signed-off-by: Eric Sandeen <esandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-08-30 02:16:55 -04:00
Theodore Ts'o a3e025c749 Fix silly spelling error in e2fsck
Addresses SourceForge bug: #1531372

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-08-29 17:12:18 -04:00
Theodore Ts'o 9c07dc00b8 Add missing backwards compatibility for ancient Linux systems
This fixes some (but not all) of the compatibility bugs which prevented
e2fsprogs from being compiled on a Linux 2.0.35 system.  There are still
some unprotected use of long long's, and apparently some type problems
with the uuid library, but these can be fixed up later.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-05-29 11:06:16 -04:00
Theodore Ts'o 9447f38a17 Fix spelling mistakes in e2fsck, mke2fs.conf, and resize2fs man pages
Addresses Debian Bugs: #368392, #368393, #368394

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-05-22 17:59:37 -04:00
Theodore Ts'o 2aa362f54a Fix memory leak in e2fsck's error paths
Add missing brelse() calls to avoid memory leaks in error paths.  (Thanks
to Michael C. Thompson for pointing these out; they were originally 
found using Coverity.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-05-14 17:16:29 -04:00
Theodore Ts'o f63978aff7 Fix read/write badblocks testing in mke2fs and e2fsck
The exlcusive device safety check that was added inadvertently broke
e2fsck -cc and mke2fs -cc since e2fsck and mke2fs hold the device 
in exclusive access when badblocks is run.  So we add a private option
to badblocks, -X, which is passed by e2fsck and mke2fs to badblocks
to indicate that it is OK to skip the EXT2_MF_BUSY checks.

Addresses Debian Bug: #366017

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-05-13 09:25:47 -04:00
Theodore Ts'o f5fa20078b Add support for EXT2_FEATURE_COMPAT_LAZY_BG
This feature is initially intended for testing purposes; it allows an
ext2/ext3 developer to create very large filesystems using sparse files
where most of the block groups are not initialized and so do not require
much disk space.  Eventually it could be used as a way of speeding up
mke2fs and e2fsck for large filesystem, but that would be best done by 
adding an RO_COMPAT extension to the filesystem to allow the inode table
to be lazily initialized on a per-block basis, instead of being entirely initialized
or entirely unused on a per-blockgroup basis.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-05-08 20:17:26 -04:00
Theodore Ts'o cd84823aed Add badblocks(8) to SEE ALSO section of e2fsck's man page.
Addresses Debian Bug: #347295

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-27 12:10:07 -05:00
Theodore Ts'o 1abdba4b64 Add man page documenting the /etc/e2fsck.conf configuration file.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-27 01:03:11 -05:00
Theodore Ts'o 204ae371ad Tighten up profile parsing code by combining functions
Integrate profile_std_line() into parse_line(), and profile_parse_file()
into profile_update_file() to make the code use less memory.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-22 10:01:24 -05:00
Takashi Sato 8deb80a5d1 Fix format statements to make e2fsprogs programs 32-bit clean
Change the format string(%d, %ld) for a block number and inode number
to %u or %lu.

Signed-off-by: Takashi Sato <sho@tnes.nec.co.jp>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-18 21:43:46 -05:00
Theodore Ts'o 2e14e0c8cc Change e2fsck to open non-mounted filesystems in exclusive mode
Thanks to Andreas Dilger for this idea.  If the filesystem is not mounted,
e2fsck will open it in exclusive mode to prevent the a confused/careless 
system administrator from mounting the filesystem while the filesystem 
check is taking place, which could cause all sorts of problems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-18 20:01:09 -05:00
Theodore Ts'o b1c52b26a4 Enhance e2fsck so it can fix external journal hint in the superblock
Check to see if the superblock hint for the external journal needs to
be updated, and if so, offer to update it.  (Addresses Debian Bug:
#355644)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-10 15:25:59 -05:00
Theodore Ts'o a5f37a9b25 Add a config option which controls whether fs checks are skipped when on battery
Whether fs checks are skipped when the system is running on battery can be
controlled by the new e2fsck.conf option defer_check_on_battery (this option 
defaults to TRUE).

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-01-29 05:15:36 -05:00
Theodore Ts'o bc3392c389 Print an explanation when skipping a check due being on battery
On Sat, Jan 28, 2006 at 12:53:33PM -0600, Fredrick Knieper wrote:
> Package: e2fsprogs
> Version: 1.38+1.39-WIP-2005.12.31-1
>
> When running fsck at boot or when running e2fsck manually on a device,
> fsck will not check a filesystem based on the maximum mount count,
> unless a flag such as -f or -c is used to force the filesystem check.

What's happening is that when you run on battery, e2fsck will delay
running the filesystem check, on the assumption that it is better to
defer the check until some time in the future when your laptop is
running on AC mains again.  This deferral is not infinite, however; if
the number of mounts exceeds twice the max mount counts, or if the
interval between checks exceeds twice the check interval, e2fsck will
force the check even though you are on battery.

I've changed the sources to print a message to make this more clear.

Addresses Debian Bug: #350306

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-01-29 05:05:31 -05:00
Theodore Ts'o 22fe674da4 Add support for quoted strings in tag and section names
Also changed top-level section name parsing to ignore leading and
trailing whitespace.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-01-06 15:04:39 -05:00
Theodore Ts'o 7d922f8bcb Add support to the profile library for /etc/foo/conf.d style directories
If a directory is passed to profile_init, then read all files which
match [0-9a-zA-Z]* in sort order.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-01-05 03:56:19 -05:00
Theodore Ts'o d45544ca54 More profile cleanups: remove prf_data_t data structure
Eliminate the prf_data_t data structure and fold it back into
prof_file_t.  Eschew needless complexity!

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-01-05 01:23:48 -05:00
Theodore Ts'o 95a8d1de51 Enhance profile library's parser to accept comments
This also changes syntax accepted by the profile parser.  The value of
profile relations must not contain spaces unless it is quoted;
otherwise the parser will throw an error.  Previously something like
this was allowed:

	[liboptions]
		test = foo bar

Now, the relation must be in double quotes in order to be valid, i.e.,
"foo bar".

Comments are allowed anywhere and can be started with either a ';' or
a '#' character.  The only place where comments will not be intepreted
as beginning a comment is in a quoted string.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-01-05 00:47:34 -05:00
Theodore Ts'o f5f14fcfe9 Add syntax error reporting to the profile library
E2fsck will now report syntax errors in /etc/e2fsck.conf intead of simply
ignoring the config file when there are errors.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-01-04 10:32:16 -05:00
Theodore Ts'o 9a4c209cd2 Simplify profile core functionality
Boil down and simplify profile.c, and move extra functionality that's
not needed into profile_helpers.c

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-01-02 22:04:41 -05:00
Theodore Ts'o cec7103d92 Fix profile.c so that com_err.h doesn't have to be installed
Fix #include of com_err.h so that it isn't required that the com_err
development environment be installed.  (Addresses Debian Bug: #345519)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-01-01 21:31:45 -05:00
Theodore Ts'o 8fd98bba21 Add e2fsck problem handling to be configurable
Add the ability for the e2fsck configuration file to override the
behaviour of e2fsck when a particular filesystem problem is
encountered.  This allows reconnecting an inode to lost+found to not
stop the boot sequence, if a system administrator really badly wants
this behaviour for some specialized reason, for example.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-31 16:33:33 -05:00
Theodore Ts'o eb065ccf18 Add allow_cancellation config option
If the e2fsck configuration file sets the allow_cancellation option to be 
true, then if the filesystem does not have any known problems, and was 
known to be cleanly unmounted, then let e2fsck exit with a status code of 0 
instead of 32 (FSCK_CANCELED) so that the bootup scripts will continue 
without stopping the boot.  (Addresses Debian Bug: #150295)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-31 00:52:23 -05:00
Theodore Ts'o 1017f65179 Read in /etc/e2fsck.conf configuration file at startup
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-31 00:00:10 -05:00
Theodore Ts'o 2fa9ba9833 Add the profile library code to e2fsck
The profile library was originally written by Theodore Ts'o in 1995
for use in the MIT Kerberos v5 library.  It has been
modified/enhanced/bug-fixed over time by other members of the MIT
Kerberos team.  This version was originally taken from the Kerberos
v5 distribution, version 1.4.2, and radically simplified for use in
e2fsprogs.  (Support for locking for multi-threaded operations,
being able to modify and update the configuration file
programmatically, and Mac/Windows portability have been removed.
It has been folded into a single C source file to make it easier to
fold into an application program.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-30 23:57:32 -05:00
Theodore Ts'o 311df05c5e Automatically fix superblock times in the future
If the superblock last mount time or last write time is in the future, fix
this automatically if e2fsck is in preeen mode, since Debian's boot sequence
bogusly doesn't set the time correctly until potentially very late in the bootup 
process, and this can cause false positives that will cause users' systems 
to fail to booting.  (Addresses Debian Bugs #343662 and #343645)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-19 00:02:47 -05:00
Theodore Ts'o bba44f956e Clarify the e2fsck man page regarding the -c option
A user was confused about whether or not e2fsck -c performed a destructive 
test on the filesystem, since it stated that -cc resulted in a non-destructive
read/write test.   Clarify that -c does a read/only test.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-09 18:18:06 -05:00
Theodore Ts'o ae1182cb84 Make e2fsck -cc warn on a read-only root filesystem
Don't let the user run e2fsck -ccn on the root partition, without warning 
that he or she might be doing something Really Stupid.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-09 18:11:16 -05:00
Theodore Ts'o f4b6d2a039 Fix typo in e2fsck error message.
Thanks to Solar Designer for pointing out the missing preposition.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-09 17:31:08 -05:00
Theodore Ts'o 84d3518bb9 Clarify description of the -p, -n, and -y options in the e2fsck man page.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-09 17:28:56 -05:00
Theodore Ts'o 8dceb92407 E2fsck: fix future times in the superblock's last mount or last write fields
Detect if the superblock's last mount field or last write field is in
the future, and offer to fix if so.  (Addresses Debian Bug #327580)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-24 21:59:45 -04:00
Theodore Ts'o b28a6e96af Fix use-after-free bug of e2fsck context structure.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-07-25 11:36:43 -05: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 49809dd863 Make e2fsck Pass 1C header consistent with the other headers
Removed the period from the Pass 1C header to make it consistent with
the other e2fsck pass headers.
2005-07-04 13:08:37 -05:00
Theodore Ts'o f76344fb6f [BUGFIX]: E2fsck will segfault on disconnected inode with extended attribute(s)
This was actually caused by two bugs.  The first bug is that if the
inode has been fully fixed up, the code will attempt to remove the
inode from the inode_bad_map without checking to see if this bitmap is
present.  Since it is cleared at the end of pass 2, if
e2fsck_process_bad_inode is called in pass 4 (as it is for
disconnected inodes), this would result in a core dump.

The first bug was mostly hidden by a second bug, which caused
e2fsck_process_bad_inode() to consider all inodes without an extended
attribute to be not fixed.

Note: This bug was introduced in e2fsprogs 1.36.

(Addresses Debian Bug: #316736)
2005-07-04 12:53:36 -05:00
Theodore Ts'o 1f965c8d96 Update for e2fsprogs 1.38 release. 2005-06-30 20:06:45 -04:00
Theodore Ts'o 5327bb499a Update typos in changelog 2005-06-26 22:12:40 -04:00
Theodore Ts'o bb145b01cf Fix e2fsprogs messages for grammar and consistency, based on suggestions
from Benno Schulenberg.

Add missing _() so all strings can be internationalized.
2005-06-20 08:35:27 -04:00