OSDN Git Service
Kalpak Shah [Thu, 21 Jun 2007 17:30:06 +0000 (13:30 -0400)]
New regression test which contains a corrupt ind. block in the journal inode
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Theodore Ts'o [Thu, 21 Jun 2007 15:59:06 +0000 (11:59 -0400)]
e2fsck: Check the all of journal blocks for validity
The original code only checked the direct blocks to make sure the
journal inode was sane. Unfortunately, if some or all of the indirect
or doubly indirect blocks were corrupted, this would not be caught.
Thanks to Andreas Dilger and Kalpak Shah for noticing this problem.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Kalpak Shah [Thu, 21 Jun 2007 15:59:06 +0000 (11:59 -0400)]
Write the updated journal inode if s_jnl_blocks was successfully used
If the journal inode was corrected from s_jnl_blocks, write the fixed
journal inode back to disk.
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Kalpak Shah [Thu, 21 Jun 2007 15:59:06 +0000 (11:59 -0400)]
Recreate journal that had been removed previously due to corruption
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>
Theodore Ts'o [Thu, 21 Jun 2007 15:59:06 +0000 (11:59 -0400)]
Add default journal size function
Factor out the code which sets the default journal size and move it
into libext2fs.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 19 Jun 2007 07:29:47 +0000 (03:29 -0400)]
Add more paranoid NTFS probing and fetch UUID and LABEL information
Hopefully this addresses false positives by the blkid library when
detecting NTFS partitions.
Addresses Launchpad Bug: #110138
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 18 Jun 2007 22:26:50 +0000 (18:26 -0400)]
Don't write changes to the backup superblocks by default
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>
Theodore Ts'o [Mon, 4 Jun 2007 05:49:51 +0000 (01:49 -0400)]
Fix error checking of badblock's last-block and start-block arguments
Addresses Debian Bug: #416477
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 4 Jun 2007 05:14:52 +0000 (01:14 -0400)]
Fix e2fsck's get_size logic so it will work with the Linux floppy driver
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>
Theodore Ts'o [Thu, 31 May 2007 16:39:02 +0000 (12:39 -0400)]
Add test to make sure the ext2 superblock structure is 1024 bytes
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Thu, 31 May 2007 16:30:09 +0000 (12:30 -0400)]
Reserve superblock field for the raid stripe width.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Andreas Dilger [Thu, 31 May 2007 16:25:46 +0000 (12:25 -0400)]
Reserve superblock fields for multiple mount protection feature
There have been reported instances of a filesystem having been mounted
at 2 places at the same time causing a lot of damage to the
filesystem. This patch reserves superblock fields and an INCOMPAT flag
for adding multiple mount protection(MMP) support within the ext4
filesystem itself. The superblock will have a block number
(s_mmp_block) which will hold a MMP structure which has a sequence
number which will be periodically updated every 5 seconds by a mounted
filesystem. Whenever a filesystem will be mounted it will wait for
s_mmp_interval seconds to make sure that the MMP sequence does not
change. To further make sure, we write a random sequence number into
the MMP block and wait for another s_mmp_interval secs. If the
sequence no. doesn't change then the mount will succeed. In case of
failure, the nodename, bdevname and the time at which the MMP block
was last updated will be displayed. tune2fs can be used to set
s_mmp_interval as desired.
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Daniel Drake [Thu, 31 May 2007 15:56:17 +0000 (11:56 -0400)]
e2fsck: Add blocksize sanity check when finding a backup superblock
I've been investigating why e2fsck refuses to restore the backup superblock
of a partition with a broken primary superblock.
The partition in question has a block size of 4096, and mke2fs reports that
backup superblocks were created on blocks 32768, 98304, 163840, ...
When running e2fsck, get_backup_sb starts by guessing a block size of 1024
and backup superblock at block 8193. I'm not sure why, but it actually finds
a superblock at this location, so returns a context with superblock 8193,
blocksize 1024.
Later on, ext2fs_open2() tries to process this superblock. It then realises
that the block size value stored in the superblock (4096) does not match what
it was told (1024), so it bails out with EXT2_ET_UNEXPECTED_BLOCK_SIZE. fsck
aborts without fixing the partition.
The following patch solves the problem by discounting superblocks which do
not meet the currently-sought block size.
As a result, block 32768 (blocksize=4096) is now used to restore the backup,
which agrees with the first location that mke2fs listed.
Signed-off-by: Daniel Drake <d.drake@mmm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Brian Behlendorf [Thu, 31 May 2007 15:42:48 +0000 (11:42 -0400)]
[COVERITY] Free potential null dereference bug in e2fsck
At the second conditional iter->file could still be NULL. We need to
check for it again. Should never happen in practice, but better to be
sure.
Coverity ID: 6: Forward Null
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Brian Behlendorf [Thu, 31 May 2007 15:30:47 +0000 (11:30 -0400)]
[COVERITY] Free memory leak in mke2fs when parsing extended options
Coverity ID: 34: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Andreas Dilger [Fri, 25 May 2007 15:18:11 +0000 (11:18 -0400)]
Fix gcc -Wall warnings, especially on 64-bit systems
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Wed, 23 May 2007 00:53:01 +0000 (20:53 -0400)]
Fix gcc -Wall issues in e2fsck sources
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Theodore Ts'o [Wed, 23 May 2007 00:51:47 +0000 (20:51 -0400)]
Add new function profile_get_uint() in the e2fsck sources
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Andreas Dilger [Tue, 22 May 2007 20:20:14 +0000 (16:20 -0400)]
Add Makefile production rule for e2fsprogs.spec in case it gets deleted
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Andreas Dilger [Tue, 22 May 2007 20:04:51 +0000 (16:04 -0400)]
mke2fs: Add check to make sure inode_size * num_inodes isn't too big
A quick patch to sanity check the inode ratio vs the inode size. In
some cases Lustre users have tried specifying an inode size of 4096
bytes, while keeping an inode ratio of one inode per 4096 bytes. I'm
sure more people will do this now that large inodes are available in
ext4 and documented in e2fsprogs.
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 19 May 2007 02:06:53 +0000 (22:06 -0400)]
Store the RAID stride value in the superblock and take advantage of it
Store the RAID stride value when a filesystem is created with a requested
RAID stride, and then use it automatically in resize2fs.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 19 May 2007 01:44:29 +0000 (21:44 -0400)]
libblkid: Fix bug which could cuase bid_type to be corrupted
Fortunately bid_type isn't used much, and bid_label and bid_uuid is
only used by debugging code, so the impact of this bug was very
minor.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 18 May 2007 04:16:02 +0000 (00:16 -0400)]
Add -g option to the blkid program to garbage collect the blkid.tab file
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 18 May 2007 04:02:35 +0000 (00:02 -0400)]
Add new function blkid_gc_cache()
New function which performs a garbage collection pass on the
/etc/blkid.tab file.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Kalpak Shah [Tue, 8 May 2007 05:07:30 +0000 (01:07 -0400)]
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>
Theodore Ts'o [Tue, 8 May 2007 04:37:55 +0000 (00:37 -0400)]
Remove -WIP language from the debian copyright file
Since I am the upstream maintainer the -WIP langauge is superflous, so
remove it.
Addresses Debian Bug: #415560
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 8 May 2007 04:26:31 +0000 (00:26 -0400)]
Fix spelling typo in debian package description for libblkid1
Addresses Debian Bug: #399155
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Eric Sandeen [Tue, 8 May 2007 04:10:54 +0000 (00:10 -0400)]
Fix mke2fs and debugfs to support large (> 16 bit) uid's and gid's
Mke2fs is supposed to set the uid/gid ownership of the root directory when
a non-rooot user creates the filesystem. This wasn't working correctly
if the uid/gid was > 16 bits. In additional, debugfs wasn't displaying
large uid/gid's correctly. This patch fixes these two programs.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Eric Sandeen [Tue, 8 May 2007 03:38:14 +0000 (23:38 -0400)]
Fix mke2fs defaults when /etc/mke2fs.conf doesn't exist
One of our testers filed a bug that said "mkfs.ext3 is much slower
when mke2fs.conf is missing..."
This is because the shipped defaults in mke2fs.conf do not match the
shipped defaults in the mkfs code itself; he wound up making a 1k
block filesystem on a very large block device, for example.
So - How about this patch, to bring them back into line? Which makes
me wonder; having "defaults" in 2 different places is bound to get out
of sync; should we instead generate both code & config file defaults
(and maybe man page defaults) from a common source?
Anyway, here's a patch to bring mke2fs.conf and mke2fs.c into line for
current defaults...
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Theodore Ts'o [Mon, 7 May 2007 20:34:51 +0000 (16:34 -0400)]
debian: Add comerr-dev dependency to the ss-dev debian package
Addresses Debian Bug: #408352
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 7 May 2007 00:09:42 +0000 (20:09 -0400)]
Debian udeb dependency cleanup
From: Frans Pop <elendil@planet.nl>
Please apply the patch below with your next upload of e2fsprogs.
It removes Provides/Replaces: in the udebs which are no longer needed now
that udeb library dependencies are generated correctly. This has been the
case for a while now, but we've postponed this cleanup until after the
Etch release.
Addresses Debian Bug: #419605
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Jim Garlick [Fri, 20 Apr 2007 12:14:27 +0000 (08:14 -0400)]
e2fsck: Count the root directory as found if it has shared blocks in pass1c
Another small bug I think: if the root directory contains shared
blocks, e2fsck pass1c search_dirent_proc() will be looking for
one more containing directory than it will ever find, and thus
loses an opportunity to terminate early.
Signed-off-by: Jim Garlick <garlick@llnl.gov>
Theodore Ts'o [Thu, 19 Apr 2007 05:53:53 +0000 (01:53 -0400)]
Define the l_i_iversion field in ext2_inode
The l_i_version field is now defined from the old l_i_reserved1 field in
the ext2 inode. This field will be used to store high 32 bits of the
64-bit inode version number.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Thu, 19 Apr 2007 02:12:50 +0000 (22:12 -0400)]
Fix minor typo in e2fsck.conf.5.in man page
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Thu, 19 Apr 2007 02:11:31 +0000 (22:11 -0400)]
Remove unused variable in e2fsck/pass2.c:check_dir_block()
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Thu, 19 Apr 2007 01:37:42 +0000 (21:37 -0400)]
ext2fs_get_device_size(): Fix potential fd descriptor leak in an error case
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 14 Apr 2007 18:01:57 +0000 (14:01 -0400)]
Fix typo in name of f_dup4 regression test
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Bryn M. Reeves [Sat, 14 Apr 2007 18:00:31 +0000 (14:00 -0400)]
Correct byteswapping for fast symlinks with xattrs
Fix a problem byte-swapping fast symlinks inodes that contain extended
attributes.
Addresses Red Hat Bugzilla: #232663
Addresses LTC Bugzilla: #27634
Signed-off-by: "Bryn M. Reeves" <breeves@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 14 Apr 2007 16:01:39 +0000 (12:01 -0400)]
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>
Theodore Ts'o [Sat, 14 Apr 2007 13:29:02 +0000 (09:29 -0400)]
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>
Theodore Ts'o [Fri, 13 Apr 2007 19:56:00 +0000 (15:56 -0400)]
Add new debugfs command "set_block_group"
This command allows the user to set a value in the block group descriptors
for a particular block group.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Jim Garlick [Wed, 11 Apr 2007 02:55:09 +0000 (22:55 -0400)]
e2fsck: pass1c terminates early if hard links
I think this is a small buglet in e2fsck: if a file has multiple hard
links, e2fsck pass1c search_dirent_proc() doesn't maintain its count
properly and may return DIRENT_ABORT before it has found containing
directories for all inodes sharing blocks.
Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Wed, 11 Apr 2007 01:10:55 +0000 (21:10 -0400)]
Fix debugfs's date parser so that it accepts integer values
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Eric Sandeen [Tue, 10 Apr 2007 19:40:04 +0000 (15:40 -0400)]
Handle large setb/testb/freeb commands in debugfs
Fix a signed vs. unsigned problem by using blk_t instead of int
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Sergey Vlasov [Tue, 10 Apr 2007 16:00:38 +0000 (12:00 -0400)]
blkid: Report correct UUID from MD superblocks
The second part of UUID was copied to a wrong place in the buffer.
Now the UUID shown by blkid is the same as shown by /lib/udev/vol_id
(at least with udev-108), but is not in the same form as used by mdadm
(which prints UUID as 4 32-bit words and uses different endiannes).
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Sergey Vlasov [Tue, 10 Apr 2007 15:59:46 +0000 (11:59 -0400)]
blkid: Fix MD 0.90 superblock detection on little endian systems
MD 0.90 superblock format is host endian - need to check for bith big
endian and little endian magic. Without this change MD components
created on little endian systems were not detected as such, which
could then lead to false positives when detecting filesystems.
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Theodore Ts'o [Sun, 8 Apr 2007 03:16:11 +0000 (23:16 -0400)]
Make the test_script ignore and skip empty test directories
When patching and unpatching quilt files, empty directories get left
behind in the tests/ directory. Ignore them to avoid false test
failures.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Andreas Dilger [Sat, 7 Apr 2007 19:39:50 +0000 (15:39 -0400)]
Allow the journal size to up to 10,240,000 blocks
Increase the maximum size of the journal to 100 times the previous
maximum, but add a restriction that it can be no more than half the size
of the filesystem.
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 7 Apr 2007 15:05:10 +0000 (11:05 -0400)]
Update release notes for 1.40-WIP release.
Theodore Ts'o [Sat, 7 Apr 2007 13:06:46 +0000 (09:06 -0400)]
Fix up usage and decrement error messages in the test_icount program
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 7 Apr 2007 03:32:06 +0000 (23:32 -0400)]
Update the e2fsck.conf(5) man page to document the [scratch_files] section
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 7 Apr 2007 03:28:30 +0000 (23:28 -0400)]
Fix memory leaks from using the tdb library
We weren't freeing allocated memory from calls to tdb_fetch, tdb_firstkey,
and tdb_nextkey. Oops.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 6 Apr 2007 22:44:37 +0000 (18:44 -0400)]
Enable e2fsck to use the tdb library to store the dirinfo 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 directory information
abstraction. This allows us to check very large filesystems without
needing as much physical memory.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 6 Apr 2007 22:43:11 +0000 (18:43 -0400)]
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>
Theodore Ts'o [Fri, 6 Apr 2007 18:30:39 +0000 (14:30 -0400)]
Add support for using TDB to libext2fs's icount abstraction
Add support for using TDB to store the icount data, so we don't run out
of memory when checking really large filesystems.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 6 Apr 2007 17:50:48 +0000 (13:50 -0400)]
Add new TDB error codes
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 6 Apr 2007 12:52:49 +0000 (08:52 -0400)]
Add a regression test suite for libext2fs's icount abstraction
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Jim Garlick [Fri, 6 Apr 2007 12:50:15 +0000 (08:50 -0400)]
Fix memory leak in ext2fs_write_new_inode()
The following patch addresses a memory leak in libext2fs
that occurs when using ext2fs_write_new_inode() on a file system
configured with large inodes.
Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Thu, 5 Apr 2007 02:33:31 +0000 (22:33 -0400)]
Rework e2fsck's dirinfo abstraction to be more friendly for databases
Change the iterator abstraction and replace e2fsck_get_dir_info() with
e2fsck_dir_info_{set,get}_{parent,dotdot} so that we can support an
on-disk dirinfo implementation. This allows e2fsck to check very large
filesystems on systems with smaller amounts of memory and/or address
space.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Thu, 5 Apr 2007 01:42:42 +0000 (21:42 -0400)]
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>
Theodore Ts'o [Thu, 5 Apr 2007 01:26:37 +0000 (21:26 -0400)]
Add tdb from Samba into libext2fs library.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Thu, 5 Apr 2007 01:09:49 +0000 (21:09 -0400)]
Add #include's to avoid compiler warnings in lib/ext2fs/tst_types
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 2 Apr 2007 23:27:44 +0000 (19:27 -0400)]
Fix potential infinite loop in e2fsck on really big filesystems
Prevent floating point precision errors on really big filesystems from
causing the search interpolation algorithm in the icount abstraction
from looping forever.
Addresses Debian Bug: #411838
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 2 Apr 2007 23:12:17 +0000 (19:12 -0400)]
resize2fs (libe2p): Fix resize2fs parsing of size parameter (in sector units)
This was actually a bug in libe2p's parse_num_blocks() function. When
handling the 's' suffix, it was ignoring the blocksize information
passed in from the caller and always interpreting the number in terms of
a 1k blocksize.
Addresses Debian Bug: #408298
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 2 Apr 2007 22:42:59 +0000 (18:42 -0400)]
Document the -X flag in the badblocks man page
Addresses Debian Bug: #379695
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 2 Apr 2007 22:30:46 +0000 (18:30 -0400)]
debugfs: support > 2GB files for the dump and rdump commands
Add _GNU_SOURCE define to make sure O_LARGEFILE is defined for
do_dump(), and use O_LARGEFILE when writing files using do_rdump().
Addresses Debian Bug: #412614
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 2 Apr 2007 14:08:59 +0000 (10:08 -0400)]
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>
Theodore Ts'o [Sat, 31 Mar 2007 23:53:53 +0000 (19:53 -0400)]
e2fsck: Add support for %It in problem description messages
Add support for the %It expansion, which will print the type of the inode
in the problem context.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 31 Mar 2007 23:18:24 +0000 (19:18 -0400)]
Fix e2fsck to set the filetype of '..' when connecting a dir, to lost+found
If there is an orphaned inode whose '..' entry is pointing at a special
file, the filetype of the '..' entry will set to the type of the special
file. When the orphaned directory is reconnected to /lost+found, the
filetype of the '..' field is not reset to EXT2_FT_DIR, so a second
e2fsck is required to repair the filesystem.
We address this situation by setting the filetype of '..' when we
reconnect the inode to /lost+found.
Addresses Lustre Bug: #11645
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 31 Mar 2007 22:56:09 +0000 (18:56 -0400)]
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>
Brian Behlendorf [Thu, 29 Mar 2007 04:32:23 +0000 (00:32 -0400)]
[COVERITY] Handle potential case in debugfs if ext2fs_get_pathname returns NULL
Coverity ID: 51: Use After Free
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Theodore Ts'o [Thu, 29 Mar 2007 04:26:10 +0000 (00:26 -0400)]
[COVERITY] Fix coverity warning in debugfs
This is a no-op since long_opt isn't currently being used; the -l option
to htree_dump is currently unwired to anything at the moment.
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Coverity ID: 47: Used before assigned
Brian Behlendorf [Thu, 29 Mar 2007 04:19:17 +0000 (00:19 -0400)]
[COVERITY] Fix (error case only) memory leak in e2fsck_get_journal
Coverity ID: 43: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Brian Behlendorf [Wed, 28 Mar 2007 16:43:05 +0000 (12:43 -0400)]
[COVERITY] Fix (error case only) memory leak in e2fsck pass #4
Coverity ID: 42: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Brian Behlendorf [Wed, 28 Mar 2007 16:36:41 +0000 (12:36 -0400)]
[COVERITY] Fix (error case only) memory leak in e2fsck -S
Coverity ID: 41: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Brian Behlendorf [Wed, 28 Mar 2007 16:07:41 +0000 (12:07 -0400)]
[COVERITY] Fix (error case only) memory leak in e2fsck pass #5
Coverity ID: 39: Resource Leak
Coverity ID: 40: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Brian Behlendorf [Wed, 28 Mar 2007 15:57:20 +0000 (11:57 -0400)]
[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>
Brian Behlendorf [Wed, 28 Mar 2007 15:41:40 +0000 (11:41 -0400)]
[COVERITY] Fix memory leak when parsing extended options in e2fsck
Coverity ID: 36: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Brian Behlendorf [Wed, 28 Mar 2007 15:28:24 +0000 (11:28 -0400)]
[COVERITY] Fix memory leak when parsing extended options in e2fsck
Coverity ID: 35: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Brian Behlendorf [Wed, 28 Mar 2007 13:50:33 +0000 (09:50 -0400)]
[COVERITY] Fix memory leak in tune2fs and mke2fs when parsing journal options
Coverity ID: 33: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Brian Behlendorf [Wed, 28 Mar 2007 13:48:07 +0000 (09:48 -0400)]
[COVERITY] Fix memory leak in fsck on error paths
The memory allocated by inst is not reclaimed. There also was a
call to exit that coverity did not catch the resource leak. This
might not really be a big issue since the memory will be freed when
fsck exits, but it should be done anyway imho.
Coverity ID: 32: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Brian Behlendorf [Sat, 24 Mar 2007 03:01:09 +0000 (23:01 -0400)]
[COVERITY] Fix file handle leak in debugfs's logdump (in error case)
Also fixed a bug in checking if the fopen failed.
Coverity ID: 30: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Brian Behlendorf [Sat, 24 Mar 2007 02:55:59 +0000 (22:55 -0400)]
[COVERITY] Fix (error case) memory leak in blkid library (parse_dev)
Coverity ID: 29: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Brian Behlendorf [Wed, 21 Mar 2007 23:16:52 +0000 (19:16 -0400)]
[COVERITY] Fix memory leak in e2image (write_raw_image_file)
Coverity ID: 28: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Brian Behlendorf [Wed, 21 Mar 2007 23:16:33 +0000 (19:16 -0400)]
[COVERITY] Fix memory leak in e2image
zero_buf and buf must be freed on return from the
output_meta_data_blocks() function.
Coverity ID: 26+27: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Brian Behlendorf [Wed, 21 Mar 2007 23:16:11 +0000 (19:16 -0400)]
[COVERITY] Fix memory leak on error handling in the debugfs's icheck command
Coverity ID: 25: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Brian Behlendorf [Wed, 21 Mar 2007 21:53:33 +0000 (17:53 -0400)]
[COVERITY] Fix (error case) memory leak in debugfs
Handle leaked cbuf due to early returns with a generic failure path.
Coverity ID: 24: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Brian Behlendorf [Wed, 21 Mar 2007 21:43:37 +0000 (17:43 -0400)]
[COVERITY] Fix (error case) memory leak in libext2fs (ext2fs_image_inode_write)
Use pre-existing early exit label in function to handle proper
error code return and local memory allocation cleanup.
Coverity ID: 23: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Brian Behlendorf [Wed, 21 Mar 2007 21:38:47 +0000 (17:38 -0400)]
[COVERITY] Fix (error case) memory leak in libext2fs (ext2fs_write_inode_full)
Need to free w_inode on early exit if w_inode != &temp_inode.
Coverity ID: 22: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Brian Behlendorf [Wed, 21 Mar 2007 21:34:47 +0000 (17:34 -0400)]
[COVERITY] Fix memory leak in libss (ss_execute_line)
Fix a memory leak by freeing the argv[] array if ss_parse_line returns 0
for argc 0 (which will happen if the user his return and sends an empty
line to the application).
Potentially need to free argv before early return since it was allocated
memory. Need to be careful since it may be possible for ss_parse() to have
freed the memory allocated to it if it detects an unbalanced set of quotes
passed to it.
Coverity ID: 21: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Brian Behlendorf [Wed, 21 Mar 2007 21:19:55 +0000 (17:19 -0400)]
[COVERITY] Fix (error case) file handle leak in util/subst program
Need to close old_f before returning since it had been successfully opened
before.
Coverity ID: 19: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Theodore Ts'o [Wed, 21 Mar 2007 21:15:36 +0000 (17:15 -0400)]
[VALGRIND] Fix memory leak in libblkid (blkid_get_devname)
Nyah, nyah, Coverity didn't find this one. :-)
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Brian Behlendorf [Wed, 21 Mar 2007 21:14:10 +0000 (17:14 -0400)]
[COVERITY] Fix memory leak in libe2p (e2p_edit_mntopts)
Need to free memory allocated to buf.
Coverity ID: 17: Resource Leak
Coverity ID: 18: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Brian Behlendorf [Wed, 21 Mar 2007 20:48:47 +0000 (16:48 -0400)]
[COVERITY] Fix memory leak in libe2p (e2p_edit_feature)
Coverity ID: 15: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Brian Behlendorf [Wed, 21 Mar 2007 20:14:37 +0000 (16:14 -0400)]
[COVERITY] Fix memory leak in profile library
The profile must be freed early if the subsequent memory allocation
fails for 'expanded_filename'.
Coverity ID: 14: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Brian Behlendorf [Wed, 21 Mar 2007 19:09:15 +0000 (15:09 -0400)]
[COVERITY] Avoid static buffer overruns in debugfs
Add an extra byte to EXT2_NAME_LEN in the static allocation for the
required trailing null. This allows filenames up to the maximum
length of EXT2_NAME_LEN withover an overrun.
Coverity ID: 11: Overrun Static
Coverity ID: 12: Overrun Static
Coverity ID: 13: Overrun Static
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Brian Behlendorf [Mon, 19 Mar 2007 12:58:47 +0000 (08:58 -0400)]
[COVERITY] Add missing NULL check to e2fsck_get_dir_info()
It is possible that e2fsck_get_dir_info() returns a NULL pointer.
We do not want to blow up when dereferencing p. It seems to be
more sane/safe to call fix_problem(ctx, PR_3_NO_DIRINFO, pctx)
if p is NULL at this point since we do not have any DIRINFO
for pctx->ino.
Also fix another (already existing) error check for
e2fsck_get_dir_info() later in the function so that it reports the
correct inode number if the dirinfo information is not found for
p->parent.
(Both of these are "should-never-happen" internal e2fsck errors that
would indicate a programming bug of some kind.)
Coverity ID: 10: Null Returns
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Brian Behlendorf [Mon, 19 Mar 2007 12:52:10 +0000 (08:52 -0400)]
[COVERITY] Check for NULL return from dict_lookup() in e2fsck
The dict_lookup() function can potentially return a NULL dnode_t. It is
not checked in two places in the clone_file() function. Looks to be
safe to continue if n is NULL, so just print a warning message and
continue.
Coverity ID: 9: Null Returns
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Brian Behlendorf [Mon, 19 Mar 2007 12:39:32 +0000 (08:39 -0400)]
[COVERITY] Fix bad error checking for NULL parameter in ss library
Looks like flawed reasoning. Here if info_dir is NULL then you are
guaranteed to blow up since you will dereference it. It seems like the
correct thing to do here (what the code author meant to do) was to set
*code_ptr = SS_ET_NO_INFO_DIR if info_dir was NULL or if *info_dir was
an empty string (aka *info_dir == '\0').
Coverity ID: 8: Forward Null
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Brian Behlendorf [Mon, 19 Mar 2007 12:36:45 +0000 (08:36 -0400)]
[COVERITY] Fix segfault bug if the profile directory is empty
Coverity ID: 5: Forward NULL
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>