summaryrefslogtreecommitdiff
path: root/e2fsck/unix.c
AgeCommit message (Collapse)AuthorFilesLines
2008-07-13Define _XOPEN_SOURCE to 600 consistently for Solaris C99 supportTheodore Ts'o1-0/+2
Solaris's header files are very picky about which C compiler can be used for SUSv3 conformance. Use of C99 is not compatible with SUSv2 (_XOPEN_SOURCE=500), and C89 is not compatible with SUSv3 (_XOPEN_SOURCE=600). Since we need some SUSv3 functions, consistently use SUSv3 so that e2fsprogs will build on Solaris using c99. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-06-07e2fsck: Add better explanatory message when s_lastcheck is in the futureTheodore Ts'o1-0/+4
Addresses-Debian-Bug: #446005 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-06-07Fix gcc -Wall warnings in e2fsckTheodore Ts'o1-2/+3
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-04-17Rename the feature uninit_groups to uninit_bgTheodore Ts'o1-3/+1
Allow the old name of uninit_groups when converting feature names for backwards compatibility for scripts running mke2fs and tune2fs. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-04-07Merge branch 'maint'Theodore Ts'o1-1/+0
2008-04-07e2fsck: avoid double free of ctx->filesystem_nameMatthias Koenig1-1/+0
In current git there is a double free on ctx->filesystem_name in the end of main() and in e2fsck_free_context, causing e2fsck to abort at the end of pass5. Signed-off-by: Matthias Koenig <mkoenig@suse.de> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-04-06Fix a couple of implicit function declarationsEric Sandeen1-0/+1
Fedora seems to be gearing up to add -Werror-implicit-function-declaration to the standard build flags, so I thought I'd get out ahead of this one... Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-31ext2fs_set_gdt_csum(): Return an error code on errors instead of voidAndreas Dilger1-2/+8
Change the function signature so that ext2fs_set_gdt_csum() returns an error code. If the inode bitmap hasn't been loaded return EXT2_ET_NO_INODE_BITMAP. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-30Merge branch 'maint'Theodore Ts'o1-5/+14
2008-03-29e2fsck: Avoid core dump when using the -N optionTheodore Ts'o1-1/+1
This bug was accidentally introduced by commit 1dc506cb. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-26e2fsck: Include the device name in the progress informationTheodore Ts'o1-3/+9
Also make sure the device name has no spaces in it, to avoid confusing displays, and make ctx->filesystem_name and ctx->device_name allocated memory to avoid potential problems in the future. Addresses-Launchpad-Bug: #203323 Addresses-Sourceforge-Bug: #1926023 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-26e2fsck: Support a negative argument to -C to suppress progress informationTheodore Ts'o1-1/+4
If a negative progress argument is given to -C, initially suppress the progress information. It can be enabled later by sending the e2fsck process a SIGUSR1 signal. Addresses-Launchpad-Bug: #203323 Addresses-Sourceforge-Bug: #1926023 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-20Make e2fsck uninit block group awareJose R. Santos1-2/+9
This patch has all the necesary pieces to open and fix filesystems created with the uninit block group feature. Signed-off-by: Jose R. Santos <jrs@us.ibm.com> Signed-off-by: Andreas Dilger <adilger@clusterfs.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-27Merge branch 'maint'Theodore Ts'o1-10/+39
Conflicts: lib/blkid/devname.c lib/blkid/probe.c misc/mke2fs.c misc/tune2fs.c
2008-02-26Enhance e2fsck's reporting for reporting unsupported filesystem featuresTheodore Ts'o1-10/+39
Addresses-Sourceforge-Feature-Request: #1175808 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-10Merge branch 'maint' into nextTheodore Ts'o1-1/+2
2008-01-31Fix bug in e2fsck which caused it to core dump if --enable-jbd-debug is usedTheodore Ts'o1-1/+2
Missing curly braces from a python programmer; my bad for noticing it! Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-10-06Merge branch 'maint'Theodore Ts'o1-5/+20
2007-10-06e2fsck: backup superblocks if key constants have changedTheodore Ts'o1-0/+6
If the primary superblock differs from the backup superblock in certain key respects, force a full check (if e2fsck was invoked in preen mode). If the filesystem check passes cleanly, and the filesystem was opened in read/write mode, then write the primary superblock to all of the backups. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-10-06e2fsck: update the backup superblocks if the feature bitmasks are changedTheodore Ts'o1-0/+1
If e2fsck adds or deletes any of the feature bitmasks, clear EXT2_FLAG_MASTER_SB_ONLY so the backup superblocks are updated when e2fsck finishes. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-22Work around lame Ubuntu init scripts / installer bugsTheodore Ts'o1-2/+5
The Ubuntu init scripts don't properly set the system time correctly from hardware clock if the hardware clock is configured to tick local time instead of GMT time. Work around this as best as we can by providing an option in /etc/e2fsck.conf which can be set on Ubuntu systems: [options] buggy_init_scripts = 1 Addresses-Debian-Bug: #441093 Addresses-Ubuntu-Bug: #131201 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-07e2fsck: If the superblock is corrupt, automatically retry with the backup sbTheodore Ts'o1-3/+8
E2fsck currently only retries with the backup superblock if the primary superblock is missing (e.g., overwritten with garbage). If the superblock is just corrupted enough that it looks like ext2/3/4 superblock, but it is corrupt enough that ext2fs_open2() returns an error, e2fsck stops without retrying. Let's fix this oversight. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-08-20Merge branch 'maint'Theodore Ts'o1-6/+31
2007-08-20Use sscanf instead of atoi when parsing e2fsck optionsTheodore Ts'o1-6/+31
atoi() does not check for errors so it shouldn't be used for human input. For example, if the user enters the command "e2fsck -C -n" and forgets that -C requires an argument, the -n will be used as the argument to -C, and not parsed as an option. When using sscanf(), this error case can be detected. Addresses-Debian-Bug: #435381 Signed-off-by: Bernd Schubert <bs@q-leap.de> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-08-11Remove e2fsck's -s and -S options to byte-swap ancient PPC filesystemsTheodore Ts'o1-44/+3
The need for fixing byte-swapped filesystems is long-gone, and this is getting in the way of cleaning up e2fsprogs's bitmaps code. So let's get rid of it; modern kernels haven't been able to deal with a byte-swapped filesystem in in about 9 years. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-08-03Merge branch 'maint'Theodore Ts'o1-0/+15
2007-08-03e2fsck: Allow i_size to be rounded up to the size of a VM pageTheodore Ts'o1-0/+15
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-6/+6
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-21Fix gcc -Wall bug in e2fsckTheodore Ts'o1-1/+0
Remove extraneous return after fatal_error(). Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-06-21Recreate journal that had been removed previously due to corruptionKalpak Shah1-0/+40
If the journal had been removed because it was corrupt, the E2F_FLAG_JOURNAL_INODE flag will be set. If this flag is set, then recreate the filesystem after checking the filesystem. Signed-off-by: Kalpak Shah <kalpak@clusterfs.com> Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
2007-06-18Don't write changes to the backup superblocks by defaultTheodore Ts'o1-9/+12
This patch changes ext2fs_open() to set EXT2_FLAG_MASTER_SB_ONLY by default. This avoids some problems in e2fsck (reported by Jim Garlick) where a corrupt journal can end up writing the bad superblock to the backups. In general, only e2fsck (after the filesystem is clean), tune2fs, and resize2fs should change the backup superblocks by default. Most callers of ext2fs_open() should not be touching anything where the backups should be touched. So let's change the defaults to avoid potential problems. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-06-04Fix e2fsck's get_size logic so it will work with the Linux floppy driverTheodore Ts'o1-0/+36
The Linux floppy driver is a bit different from the other block device drivers, in that if the device has been opened with O_EXCL, it disallows another open(), even if the second open() does not have the O_EXCL flag. So this patch moves the call to ext2fs_get_device_size() so that if it returns EBUSY, e2fsck can close the filesystem, retry the device size, and then reopen it. This rather complicated approach is required since we need to know the blocksize of the filesystem before we can call ext2fs_get_device_size(). Addresses Debian Bug: #410569 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-03-28[COVERITY] Fix memory leak when parsing extended options in e2fsckBrian Behlendorf1-2/+4
Coverity ID: 35: Resource Leak Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2006-12-26Use the newer add/remove_error_table com_err interfacesTheodore Ts'o1-2/+4
Change all of the e2fsprogs programs to use the newer add_error_table() and remove_error_table() interfaces instead of the much older initialize_*_error_table() function. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-11-14Fix misc. gcc -Wall complaints in the misc and e2fsck directoriesTheodore Ts'o1-12/+15
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-09-12Add checks to make sure inode counts don't overflow a 32-bit valueEric Sandeen1-1/+1
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
2006-09-12Fix signed vs unsigned printf format strings for block and inode numbersEric Sandeen1-24/+23
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-06-10Read mke2fs.conf and e2fsck.conf from root_sysconfdir rather than harcoded /etc.Matthias Andree1-1/+1
2006-03-18Fix format statements to make e2fsprogs programs 32-bit cleanTakashi Sato1-4/+5
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-18Change e2fsck to open non-mounted filesystems in exclusive modeTheodore Ts'o1-0/+5
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-01-29Add a config option which controls whether fs checks are skipped when on batteryTheodore Ts'o1-1/+8
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-29Print an explanation when skipping a check due being on batteryTheodore Ts'o1-3/+7
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-04Add syntax error reporting to the profile libraryTheodore Ts'o1-0/+9
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>
2005-12-31Add E2FSCK_CONFIG environment variableTheodore Ts'o1-0/+3
Also, use this environtment variable to make sure that a local /etc/e2fsck.conf file will not interfere with the regression test suite. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-31Add allow_cancellation config optionTheodore Ts'o1-3/+14
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-31Read in /etc/e2fsck.conf configuration file at startupTheodore Ts'o1-1/+5
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-09Make e2fsck -cc warn on a read-only root filesystemTheodore Ts'o1-4/+7
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-09Fix typo in e2fsck error message.Theodore Ts'o1-1/+1
Thanks to Solar Designer for pointing out the missing preposition. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-24E2fsck: fix future times in the superblock's last mount or last write fieldsTheodore Ts'o1-0/+1
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-07-25Fix use-after-free bug of e2fsck context structure.Theodore Ts'o1-3/+2
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>