Whamcloud - gitweb
tools/e2fsprogs.git
17 years agoImprove I/O error messages in e2fsck
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>
17 years agoAdd new debugfs command "set_block_group"
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>
17 years agoe2fsck: pass1c terminates early if hard links
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>
17 years agoFix debugfs's date parser so that it accepts integer values
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>
17 years agoHandle large setb/testb/freeb commands in debugfs
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>
17 years agoblkid: Report correct UUID from MD superblocks
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>
17 years agoblkid: Fix MD 0.90 superblock detection on little endian systems
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>
17 years agoMake the test_script ignore and skip empty test directories
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>
17 years agoAllow the journal size to up to 10,240,000 blocks
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>
17 years agoUpdate release notes for 1.40-WIP release.
Theodore Ts'o [Sat, 7 Apr 2007 15:05:10 +0000 (11:05 -0400)]
Update release notes for 1.40-WIP release.

17 years agoFix up usage and decrement error messages in the test_icount program
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>
17 years agoUpdate the e2fsck.conf(5) man page to document the [scratch_files] section
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>
17 years agoFix memory leaks from using the tdb library
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>
17 years agoEnable e2fsck to use the tdb library to store the dirinfo abstraction
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>
17 years agoEnable e2fsck to use the tdb library for the inode count abstraction
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>
17 years agoAdd support for using TDB to libext2fs's icount abstraction
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>
17 years agoAdd new TDB error codes
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>
17 years agoAdd a regression test suite for libext2fs's icount abstraction
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>
17 years agoFix memory leak in ext2fs_write_new_inode()
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>
17 years agoRework e2fsck's dirinfo abstraction to be more friendly for databases
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>
17 years agoFix potential reference (and free) to an uninitialized pointer in e2fsck
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>
17 years agoAdd tdb from Samba into libext2fs library.
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>
17 years agoAdd #include's to avoid compiler warnings in lib/ext2fs/tst_types
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>
17 years agoFix potential infinite loop in e2fsck on really big filesystems
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>
17 years agoresize2fs (libe2p): Fix resize2fs parsing of size parameter (in sector units)
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>
17 years agoDocument the -X flag in the badblocks man page
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>
17 years agodebugfs: support > 2GB files for the dump and rdump commands
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>
17 years agoe2fsck: Recover a special file which looks an awful lot like a directory
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>
17 years agoe2fsck: Add support for %It in problem description messages
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>
17 years agoFix e2fsck to set the filetype of '..' when connecting a dir, to lost+found
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>
17 years agoFix edge case when i_size doesn't get fixed until second e2fsck run
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>
17 years ago[COVERITY] Handle potential case in debugfs if ext2fs_get_pathname returns NULL
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>
17 years ago[COVERITY] Fix coverity warning in debugfs
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

17 years ago[COVERITY] Fix (error case only) memory leak in e2fsck_get_journal
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>
17 years ago[COVERITY] Fix (error case only) memory leak in e2fsck pass #4
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>
17 years ago[COVERITY] Fix (error case only) memory leak in e2fsck -S
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>
17 years ago[COVERITY] Fix (error case only) memory leak in e2fsck pass #5
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>
17 years ago[COVERITY] Fix (error case only) memory leak in e2fsck pass #1
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>
17 years ago[COVERITY] Fix memory leak when parsing extended options in e2fsck
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>
17 years ago[COVERITY] Fix memory leak when parsing extended options in e2fsck
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>
17 years ago[COVERITY] Fix memory leak in tune2fs and mke2fs when parsing journal options
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>
17 years ago[COVERITY] Fix memory leak in fsck on error paths
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>
17 years ago[COVERITY] Fix file handle leak in debugfs's logdump (in error case)
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>
17 years ago[COVERITY] Fix (error case) memory leak in blkid library (parse_dev)
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>
17 years ago[COVERITY] Fix memory leak in e2image (write_raw_image_file)
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>
17 years ago[COVERITY] Fix memory leak in e2image
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>
17 years ago[COVERITY] Fix memory leak on error handling in the debugfs's icheck command
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>
17 years ago[COVERITY] Fix (error case) memory leak in debugfs
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>
17 years ago[COVERITY] Fix (error case) memory leak in libext2fs (ext2fs_image_inode_write)
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>
17 years ago[COVERITY] Fix (error case) memory leak in libext2fs (ext2fs_write_inode_full)
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>
17 years ago[COVERITY] Fix memory leak in libss (ss_execute_line)
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>
17 years ago[COVERITY] Fix (error case) file handle leak in util/subst program
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>
17 years ago[VALGRIND] Fix memory leak in libblkid (blkid_get_devname)
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>
17 years ago[COVERITY] Fix memory leak in libe2p (e2p_edit_mntopts)
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>
17 years ago[COVERITY] Fix memory leak in libe2p (e2p_edit_feature)
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>
17 years ago[COVERITY] Fix memory leak in profile library
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>
17 years ago[COVERITY] Avoid static buffer overruns in debugfs
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>
17 years ago[COVERITY] Add missing NULL check to e2fsck_get_dir_info()
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>
17 years ago[COVERITY] Check for NULL return from dict_lookup() in e2fsck
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>
17 years ago[COVERITY] Fix bad error checking for NULL parameter in ss library
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>
17 years ago[COVERITY] Fix segfault bug if the profile directory is empty
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>
17 years ago[COVERITY] Fix dead code bug in mke2fs
Brian Behlendorf [Mon, 19 Mar 2007 12:25:38 +0000 (08:25 -0400)]
[COVERITY] Fix dead code bug in mke2fs

If the fs_type is not specified and we are creating a journal device, to
use a fs_type of "journal"; this used to be the behavior before we added
support for the /etc/mke2fs.conf file, so let's fix it to restore the
old behavior.

Coverity ID: 4: Deadcode

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years ago[COVERITY] Allow blkid_dev_has_tag to check if a tag exists when value==NULL
Theodore Ts'o [Sun, 18 Mar 2007 15:21:44 +0000 (11:21 -0400)]
[COVERITY] Allow blkid_dev_has_tag to check if a tag exists when value==NULL

blkid_dev_has_tag() will immediately return -1 (an error if value is
NULL.  Thus at the test later on value cannot be NULL. There are two
possible ways to go about fixing this. The first would be to remove the
first NULL check for value.  The second one would be to remove the
second check (and the deadcode).

I chose the second path because the functionality added is something
which a programmer could reasonably expect given the function name, and
it is highly unlikely any existing code is depending on the fact that
blkid_dev_has_tag() will return an error if value is NULL.

Coverity ID: 3: Deadcode

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years ago[COVERITY] Fix missing return code check for ext2fs_write_inode
Brian Behlendorf [Sun, 18 Mar 2007 15:16:33 +0000 (11:16 -0400)]
[COVERITY] Fix missing return code check for ext2fs_write_inode

Found 2 of the three places where a return code for ext2fs_write_inode() was
not being checked.

The second fix in e2fsck/emptydir.c is basically just to shut coverity up even
though it really is unnecessary.

Coverity ID: 1: Checked Return

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoAllow the debugfs lcd command to work w/o a filesystem being open
Theodore Ts'o [Wed, 7 Mar 2007 13:09:10 +0000 (08:09 -0500)]
Allow the debugfs lcd command to work w/o a filesystem being open

Addresses LTC Bugzilla #27513

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoFix memory leak in blkid library
Theodore Ts'o [Wed, 7 Mar 2007 00:56:18 +0000 (19:56 -0500)]
Fix memory leak in blkid library

Addresses Debian Bug: #413661

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoAdd versioned dependency in Debian's shlibs for libblkid
Theodore Ts'o [Sun, 4 Mar 2007 13:17:18 +0000 (08:17 -0500)]
Add versioned dependency in Debian's shlibs for libblkid

Add dependency to account for the new blkid function blkid_probe_all_new()
was added to e2fsprogs 1.39.   The lack of this versioned dependency
caused a failure in rpc.mountd as detailed in Debian Bug #413057.

Addresses Debian Bug: #413208

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoFix dump_usued segault in debugfs if used without open filesystem
Matthias Koenig [Sun, 28 Jan 2007 17:40:28 +0000 (12:40 -0500)]
Fix dump_usued segault in debugfs if used without open filesystem

The dump_unused command in debugfs segfaults if used without an open
filesystem:

sor:~ # debugfs
debugfs 1.39 (29-May-2006)
debugfs:  dump_unused
Segmentation fault

Patch (from IBM) below.

Signed-off-by: Matthias Koenig <mkoenig@suse.de>
17 years agoUse the newer add/remove_error_table com_err interfaces
Theodore Ts'o [Tue, 26 Dec 2006 08:38:07 +0000 (03:38 -0500)]
Use the newer add/remove_error_table com_err interfaces

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>
17 years agoAdd debugging code to the com_err library
Theodore Ts'o [Fri, 22 Dec 2006 18:38:38 +0000 (13:38 -0500)]
Add debugging code to the com_err library

If the environment variable COMERR_DEBUG is set to 1, print out debugging
messages as error tables are added and removed from the com_err library.
If the COMERR_DEBUG_FILE environment variable is set (and the process is
not setuid) the debugging messages may be redirected to a file.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoFix (as yet unused) struct ext4_group_desc to add a missing bg_pad field
Theodore Ts'o [Thu, 30 Nov 2006 19:48:48 +0000 (14:48 -0500)]
Fix (as yet unused) struct ext4_group_desc to add a missing bg_pad field

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoAdjust badblocks -n/-w exclusive usage message
Theodore Ts'o [Sat, 18 Nov 2006 04:00:19 +0000 (23:00 -0500)]
Adjust badblocks -n/-w exclusive usage message

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoAdd libreadline.so.5 to the list of readline libraries used by libss
Theodore Ts'o [Sat, 18 Nov 2006 03:56:23 +0000 (22:56 -0500)]
Add libreadline.so.5 to the list of readline libraries used by libss

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoAdded tag E2FSPROGS-1_40-WIP-1114 for changeset 20144d6af15c E2FSPROGS-1_40-WIP-1114
Theodore Ts'o [Wed, 15 Nov 2006 04:49:56 +0000 (23:49 -0500)]
Added tag E2FSPROGS-1_40-WIP-1114 for changeset 20144d6af15c

17 years agoUpdate version.h, RELEASE-NOTES, debian/changelog for 1.40-WIP release
Theodore Ts'o [Wed, 15 Nov 2006 04:49:07 +0000 (23:49 -0500)]
Update version.h, RELEASE-NOTES, debian/changelog for 1.40-WIP release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoUpdate WFLAGS to suppress spurious warning messages
Theodore Ts'o [Wed, 15 Nov 2006 04:40:19 +0000 (23:40 -0500)]
Update WFLAGS to suppress spurious warning messages

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoFix misc. gcc -Wall complaints in the misc and e2fsck directories
Theodore Ts'o [Wed, 15 Nov 2006 04:38:17 +0000 (23:38 -0500)]
Fix misc. gcc -Wall complaints in the misc and e2fsck directories

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoFix gcc -Wall complaints in libext2fs
Theodore Ts'o [Wed, 15 Nov 2006 04:14:12 +0000 (23:14 -0500)]
Fix gcc -Wall complaints in libext2fs

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoFix type punning bugs in ext2fs_get_mem() and ext2fs_free_mem()
Theodore Ts'o [Tue, 14 Nov 2006 05:34:34 +0000 (00:34 -0500)]
Fix type punning bugs in ext2fs_get_mem() and ext2fs_free_mem()

This was causing dumpe2fs to crash on the ARM platform when examining
the badblocks list.

Also reverts an incorrect fix made by changeset 38078f692c20

Addresses Debian Bug: #397044

17 years agoAllow debugfs and dumpe2fs to support fs features under development
Theodore Ts'o [Mon, 13 Nov 2006 04:26:46 +0000 (23:26 -0500)]
Allow debugfs and dumpe2fs to support fs features under development

Add support for the new flag EXT2_FLAG_SOFTSUPP_FEATURES flag to
ext2fs_open() , which allows application to open filesystes with features
which are currently only partially supported by e2fsprogs.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoAdd explanatory message to badblocks that -n and -w are mutually exclusive
Theodore Ts'o [Mon, 13 Nov 2006 04:09:03 +0000 (23:09 -0500)]
Add explanatory message to badblocks that -n and -w are mutually exclusive

Addresses Debian Bug: #371869

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoCheck in binary extent test image file into the source tree.
Theodore Ts'o [Mon, 13 Nov 2006 03:57:39 +0000 (22:57 -0500)]
Check in binary extent test image file into the source tree.

This is not yet ready to be used yet, but add it into the tree so that
future patches don't have to deal with manually adding this binary
image file into the tree.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoCheck in ext4 extent headers into the source tree
Theodore Ts'o [Mon, 13 Nov 2006 03:54:35 +0000 (22:54 -0500)]
Check in ext4 extent headers into the source tree

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoAdd support for printing new filesystem features
Theodore Ts'o [Mon, 13 Nov 2006 03:50:18 +0000 (22:50 -0500)]
Add support for printing new filesystem features

Add support for printing the huge_file, gdt_checksum, dir_nlink,
extra_isize, extent, and 64bit features.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoWork around GCC bug on the Arm platform
Theodore Ts'o [Mon, 13 Nov 2006 03:22:00 +0000 (22:22 -0500)]
Work around GCC bug on the Arm platform

Addresses Debian Bug: #397044

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoUpdate draft-leach-uuids-guids-01.txt with rfc4122.txt
Theodore Ts'o [Mon, 13 Nov 2006 01:22:06 +0000 (20:22 -0500)]
Update draft-leach-uuids-guids-01.txt with rfc4122.txt

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoFixes for building RPM's via "make rpm"
Andreas Dilger [Mon, 13 Nov 2006 00:41:25 +0000 (19:41 -0500)]
Fixes for building RPM's via "make rpm"

Fixed version number generation so that the same common
algorithm is used for Debian and RPM version numbering schemes.
This allows the RPM spec file to do the right thing for WIP releases.

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoAvoid infinite substitution loop in subst caused by autoconf pre-v2.60
Theodore Ts'o [Sun, 12 Nov 2006 22:43:50 +0000 (17:43 -0500)]
Avoid infinite substitution loop in subst caused by autoconf pre-v2.60

Autoconf versions before 2.60 don't have datarootdir defined, and so this
resulted in a @datarootdir@ --> @datarootdir@ infinite expansion.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoSet local environment variables to C so mk_cmds and compile_et always work
Theodore Ts'o [Sun, 12 Nov 2006 15:43:31 +0000 (10:43 -0500)]
Set local environment variables to C so mk_cmds and compile_et always work

Addresses SourceForge Bug: #1532177

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoAllow unix_io offsets greater than 2G
Theodore Ts'o [Sun, 12 Nov 2006 15:40:40 +0000 (10:40 -0500)]
Allow unix_io offsets greater than 2G

Addresses SourceForge Bug: #1547922

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoAdd directory hashed signed/unsigned hint to superblock
Theodore Ts'o [Sun, 12 Nov 2006 03:32:35 +0000 (22:32 -0500)]
Add directory hashed signed/unsigned hint to superblock

The e2fsprogs and kernel implementation of directory hash tree has a
bug which causes the implementation to be dependent on whether
characters are signed or unsigned.  Platforms such as the PowerPC,
Arm, and S/390 have signed characters by default, which means that
hash directories on those systems are incompatible with hash
directories on other systems, such as the x86.

To fix this we add a new flags field to the superblock, and define two
new bits in that field to indicate whether or not the directory should
be signed or unsigned.  If the bits are not set, e2fsck and fixed
kernels will set them to the signed/unsigned value of the currently
running platform, and then respect those bits when calculating the
directory hash.  This allows compatibility with current filesystems,
as well as allowing cross-architectural compatibility.

Addresses Debian Bug: #389772

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoAdd new a new tests make target "checked-failed" which reruns any failed tests
Theodore Ts'o [Sat, 11 Nov 2006 14:45:50 +0000 (09:45 -0500)]
Add new a new tests make target "checked-failed" which reruns any failed tests

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoOn-disk format for controlling the inode size
Theodore Ts'o [Sat, 11 Nov 2006 14:45:22 +0000 (09:45 -0500)]
On-disk format for controlling the inode size

- EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE (0x0040?) - add s_min_extra_isize and
  s_want_extra_isize fields to superblock, which allow specifying
  the minimum and desired i_extra_isize fields in large inodes
  (for nsec+epoch timestamps, potential other uses).  Needs RO_COMPAT
  flag handling, needs e2fsck support, patch complete, little testing.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoOn-disk format definition for 64-bit support
Theodore Ts'o [Sat, 11 Nov 2006 14:44:47 +0000 (09:44 -0500)]
On-disk format definition for 64-bit support

- EXT4_FEATURE_INCOMPAT_64BIT (0x0080) - support for 64-bit block count
  fields in the superblock (s_blocks_count_hi, s_free_blocks_count_hi),
  large group descriptors (s_desc_size), extents with high 16 bits
  (ee_start_hi, ei_leaf_hi), inode ACL (i_file_acl_hi).  May also grow
  to encompass the previously proposed BIG_BG.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoOn-disk format for large number of subdirectories
Theodore Ts'o [Sat, 11 Nov 2006 14:43:42 +0000 (09:43 -0500)]
On-disk format for large number of subdirectories

- EXT4_FEATURE_RO_COMPAT_DIR_NLINK (0x0020?) - allow directories to have
  > 65000 subdirectories (i_nlinks) by setting i_nlinks = 1 for such
  directories.  RO_COMPAT protects old filesystems from unlinking such
  directories incorrectly and losing all files therein.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoOn-disk format definition for group descriptor checksums
Theodore Ts'o [Sat, 11 Nov 2006 14:41:52 +0000 (09:41 -0500)]
On-disk format definition for group descriptor checksums

- EXT4_FEATURE_RO_COMPAT_GDT_CSUM (0x0010?) - store a crc16 checksum in
  the group descriptor (s_uuid[16] | __u32 group | ext3_group_desc
  (excluding gd_checksum itself)).  This allows the kernel to more safely
  manage UNINIT groups.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoOn-disk format definition for huge files
Theodore Ts'o [Sat, 11 Nov 2006 11:32:03 +0000 (06:32 -0500)]
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>
17 years agoFix e2fsck and mke2fs -c to be pass the last _block change to badblocks
Theodore Ts'o [Wed, 8 Nov 2006 05:41:50 +0000 (00:41 -0500)]
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>
17 years agoUpdate debian/changelog for 1.39+1.40-WIP-2006.10.02+dfsg-2 release
Theodore Ts'o [Sun, 22 Oct 2006 04:44:15 +0000 (00:44 -0400)]
Update debian/changelog for 1.39+1.40-WIP-2006.10.02+dfsg-2 release

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
17 years agoAdd failsafe against duplicate UUID's generated by threaded programs
Theodore Ts'o [Sun, 22 Oct 2006 04:18:49 +0000 (00:18 -0400)]
Add failsafe against duplicate UUID's generated by threaded programs

Add in randomness based on Linux's thread id (gettid) to avoid race
conditions when two threads try to generate uuid's at the same time.
This shouldn't be an issue if /dev/urandom has proper locking and is
present, so this is just a failsafe.

Addresses SourceForge Bug: #1529672

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>