Commit Graph

636 Commits (f5fa20078bfc05b554294fe9c5505375d7913e8c)

Author SHA1 Message Date
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 1f2da2c011 Speed up mke2fs and e2fsck by writing bitmaps more efficiently
Reduce disk seeks by writing the inode and block bitmaps in an interleaved fashion.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-04-23 12:43:40 -04:00
Theodore Ts'o b116e781f6 Fix bug which could cause dumpe2fs to rarely fail to print a UUID
uuid.c (e2p_is_null_uuid): Fix really stupid bug which could cause dumpe2fs
to fail to display a the journal or hash seed UUID.  (Thanks to Guillaume
Chambraud for pointing this out.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-04-22 04:32:36 -04:00
Theodore Ts'o 4ea7ea007b Fix asm_types.h type conflicts
This caused FTBFS bugs on AMD64 platforms, since it uses a different
64-bit type when compared with IA64, so we need to make our
autoconfiguration system more intelligent.

Addresses Debian Bugs: #360661, #360317

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-04-09 08:41:55 -04:00
Theodore Ts'o cef2ac104d Fix ext2fs_add_journal_inode() when filesystem is opened in exclusive mode
If the filesystem is opened in exclusive mode, then device will be
busy by definition, so don't return -EBUSY.  This caused mke2fs -j to
fail on the 1.39-WIP (29-Mar-2006) release.  (Addresses Debian Bug:
#360652)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-04-04 19:23:41 -04:00
Theodore Ts'o 8ad26b08fa Fix the x86 asm constraints for ext2fs_set/clear_bit.
The assembly function reads/writes the data files, so make sure we
tell gcc that.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-29 14:23:00 -05:00
Theodore Ts'o f9bcce3be0 Fix the i386 bitmap operations so they are 32-bit clean
The x86 assembly instructures for bit test-and-set, test-and-clear,
etc., interpret the bit number as a 32-bit signed number, which is
problematic in order to support filesystems > 8TB.  

Added new inline functions (in C) to implement a
ext2fs_fast_set/clear_bit() that does not return the old value of the
bit, and use it for the fast block/bitmap functions.

Added a regression test suite to test the low-level bit operations
functions to make sure they work correctly.

Note that a bitmap can address 2**32 blocks requires 2**29 bytes, or
512 megabytes.  E2fsck requires 3 (and possibly 4 block bitmaps),
which means that the block bitmaps can require 2GB all by themselves,
and this doesn't include the 4 or 5 inode bitmaps (which assuming an
8k inode ratio, will take 256 megabytes each).  This means that it's
more likely that a filesystem check of a filesystem greater than 2**31
blocks will fail if the e2fsck is dynamically linked (since the shared
libraries can consume a substantial portion of the 3GB address space
available to x86 userspace applications).  Even if e2fsck is
statically linked, for a badly damaged filesystem, which may require
additional block and/or inode bitmaps, I am not sure e2fsck will
succeed in all cases.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-25 13:42:45 -05:00
Theodore Ts'o 292811f2aa Fix typo bug in previous commit (6ae1ed49c8c6)
"fd" should have been "probe.fd" so blkid/probe.c can compile without
errors.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-25 01:42:02 -05:00
Theodore Ts'o 2858c94e35 Fix file descriptor leak in blkid library in error paths
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-23 22:14:54 -05:00
Theodore Ts'o 9dc6ad1ecb Change mke2fs to use /etc/mke2fs.conf as a configuration file
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-23 22:00:01 -05:00
Theodore Ts'o f4f425b20b Prevent error messages to stderr caused by libblkid calling libdevmapper
Make the libdevmapper fail quietly if blkid is called without root
privileges or the kernel does not include device mapper support.
(What is the device mapper _library_ doing writing to stderr, anyway?)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-19 15:26:26 -05:00
Theodore Ts'o 39c47ce641 Add EXT2_FLAG_EXCLUSIVE to the ext2fs library.
This flag when specified to ext2fs_open or ext2fs_initialize indicates 
that the application wants the io_channel to be opened in exclusive mode.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-18 19:16:10 -05:00
Theodore Ts'o fa6c653ec3 Add IO_FLAG_EXCLUSIVE flag to io_channel abstraction
Add a new io_channel open flag, IO_FLAG_EXCLUSIVE,which requests that 
the device be opened in exclusive (O_EXCL) mode.  Add support to the unix_io
implementation for this flag.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-18 18:57:44 -05:00
Theodore Ts'o 7447921dff Fix documentation: BLOCK_FLAG_TRAVERSE should be BLOCK_FLAG_DEPTH_TRAVERSE
Addresses Debian Bug #351268

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-18 08:26:36 -05:00
Theodore Ts'o cbb7f9c4f1 Fix build when not building any shared libraries.
Add missing real-subdirs:: line to lib/Makefile.library, so there is a 
default definition of the real-subdirs target.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-17 21:59:13 -05:00
Theodore Ts'o a612f3432e Fix a signed vs unsigned bug in calc_reserved_gdt_blocks()
This fixes mke2fs -O resize_inode for very large filesystems (i.e., 20GB).
Addresses Debian Bug #346580

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-17 20:39:52 -05:00
Theodore Ts'o bf69235ad0 Add support for on-line resizing to resize2fs
If the filesystem is mounted, attempt to use the on-line resizing
ioctls to resize the filesystem.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-17 19:45:45 -05:00
Theodore Ts'o e324b25059 Fix blkid's last verification logic to work when the system clock is insane
Users have reported problems on newly installed systems when the
Macintosh's system clock battery is dead and the hardware clock is
returning a date of 1904.  Turns out there were some bugs in handling
dates before the Unix epoch.

Addresses Red Hat Bug: #182188

probe.c (blkid_verify): Fix the bid_time sanity checking logic,
	so that if last verification time is more recent than the
	current time, or the comparison between the last
	verification time and the current time causes an overflow,
	a device verification will take place.

devname.c (blkid_get_dev): Set the initial bid_time to be
	INT_MIN, to guarantee that blkid_verify will always be run
	even when the system clock is insane.

dev.c (blkid_debug_dump_dev), read.c (debug_dump_dev), 
	save.c (save_dev): Fix the printf format for dev->bid_time
	to match the fact that it is an signed type.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-12 23:25:15 -05:00
Theodore Ts'o 3f546fcc27 Fix the subdirs logic so it works with GNU make 3.80
The previous fix which fixed the problem with GNU make 3.81 building
all of the library object files caused GNU make 3.80 fail because the
subdirectories (such as elfshared) were not getting created.  This fix
should allow the Makefiles to work with both GNU make 3.80 and GNU
make 3.81.
2006-03-10 21:39:40 -05:00
Theodore Ts'o ba5e38494e Add EXT_JOURNAL to the blkid tag of ext3 filesystems.
If the filesystem has an external journal, store the UUID of the
external journal in the tag EXT_JOURNAL.

If the filesystem type has changed, clear all the tags on the device,
not just a preset list of LABEL, UUID, TYPE, and SEC_TYPE.

Fix a bug so that blkid_set_tag will work correctly when freeing a tag
when the input name parameter comes from the tag that we are freeing.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-10 18:11:35 -05:00
Karel Zak 4db2f59a71 Add device-mapper support to the blkid library
On systems where is multi-path storage device is problem with duplicated
filesystems. The solution is select "the best" device. This is possible
by device-mapper library.

Short quotation from RH bugzilla:

With my patch, all dm devices remains in libblkid cache.

Only the top level dm devices are given high priority
and more appropriate node names (i.e. /dev/mapper/*) are used.

For example, if we have linear mapped dm device "ov1" over
dm device "disk1p3" which is multipath mapped to /dev/sdd3 and /dev/sdh3:
  # dmsetup.static ls --tree
  ov1 (253:5) <-- /dev/mapper/ov1 or /dev/dm-5
   `-disk1p3 (253:4) <-- /dev/mapper/disk1p3 or /dev/dm-4
      `-disk1 (253:0)
         |- (8:112) <-- /dev/sdh
         `- (8:48) <-- /dev/sdd

Original version of blkid will show:
  # ./orig/blkid -t LABEL=mpdisk1p3 -l
  /dev/sdd3: LABEL="mpdisk1p3" ... TYPE="ext3"

With my patch, blkid will show:
  # ./deptree/blkid -t LABEL=mpdisk1p3 -l
  /dev/mapper/ov1: LABEL="mpdisk1p3" ... TYPE="ext3"

In blkid cache, all devices are listed:

  # ./orig/blkid -t LABEL=mpdisk1p3
  /dev/sdd3: LABEL="mpdisk1p3" ... TYPE="ext3"
  /dev/sdh3: LABEL="mpdisk1p3" ... TYPE="ext3"
  /dev/dm-4: LABEL="mpdisk1p3" ... TYPE="ext3"
  /dev/dm-5: LABEL="mpdisk1p3" ... TYPE="ext3"

  # ./deptree/blkid -t LABEL=mpdisk1p3
  /dev/mapper/ov1: LABEL="mpdisk1p3" ... TYPE="ext3"
  /dev/sdd3: LABEL="mpdisk1p3" ... TYPE="ext3"
  /dev/sdh3: LABEL="mpdisk1p3" ... TYPE="ext3"
  /dev/dm-4: LABEL="mpdisk1p3" ... TYPE="ext3"

For more details see discussion on:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=156324

Addresses Red Hat Bug: #156324

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-03-08 14:17:28 -05:00
Theodore Ts'o 2adc320f01 Set FD_CLOEXEC on the /dev/random file descriptor used by libuuid
This avoids a fd leak across an execve() which was causing problems
for the LVM tools.

(Addresses Debian Bug: #345832)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2006-01-06 18:10:02 -05:00
Theodore Ts'o 02ef196210 Avoid needlessly recompilation of library objection files
Fixing the problem of parallel builds sometimes not creating the library
subdirectories caused library object files to get constantly recompiled.
Fix this by remaping how the Makefile subdirectories decide to create
the subdirectories.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-29 22:45:29 -05:00
Theodore Ts'o 438961210d Add missing parameter to error printf in blkid test program.
The blkid tag.c's test driver program had  a missing parameter to an 
error message printf.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-29 14:07:45 -05:00
Theodore Ts'o 3985754378 Use $(LDFLAGS) when generating shared libraries
Makefile.elf-lib, Makefile.solaris-lib: Add $(LDFLAGS) to the command line 
	argument when generating the shared library, to allow cross-compile 
	and other builds that might need to specify -L paths to needed 
	libraries.

Addresses Sourceforge Bug #1261549

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-10 22:33:25 -05:00
Theodore Ts'o 3ded50b37c Address parallel build problem in the library Makefiles
Add a dependency to make sure that the subdirectories are created before 
creating all of the object files.

Addresses Sourceforge Bug: #1261553

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-10 22:23:01 -05:00
Theodore Ts'o 9b9a780f5a Fix various gcc -Wall complaints.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-10 21:50:30 -05:00
Theodore Ts'o bc47952f10 Add ext2fs_read_bb_FILE test to confirm proper detection of invalid block #'s
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-12-10 14:37:10 -05:00
Theodore Ts'o 125e084cef Fix gcc compilation on sparc architectures in bitops.h
We no longer have the sparc assembly code in the header file any more, so we 
shouldn't set _EXT2_HAVE_AS_BITOPS_.  This would break compiles on the sparc
architectures when using gcc.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-11-21 00:04:31 -05:00
Theodore Ts'o a82a57025c Add missing #include for string.h to ext2fs.h to fix GCC 4.01 complaints
#include <string.h> is needed since the inline functions use memcpy().  
(Addresses Sourceforge Bug #1251062)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-11-14 14:49:15 -05:00
Theodore Ts'o 0d961040fe Fix writing external journals on big-endian machines
Fix a bug when writing an external journal device on an big
endian machine (such as a S/390), where when the number of
block groups is zero, we never end up writing out the
primary superblock at all.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-11-12 23:30:39 -05:00
Theodore Ts'o 32138187f0 Add fs->now to override time(0) in libext2fs
If fs->now is non-zero, use that as the time instead of the system
time when setting various filesystem fields (last modified time, last
write time, etc.)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-24 20:14:51 -04:00
Theodore Ts'o 2f79e5193f Search the root directory of FAT filesystems for the label information
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-10 21:51:20 -04:00
Theodore Ts'o ca7498596f Generic blkid library cleanup
Change superblock and generic i/o functions to be more generic.  Clean
up interface to the probe function.  Fix memory leak.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-10 21:07:23 -04:00
Theodore Ts'o 1e5630abab Add a regression test suite for the blkid library
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-10 15:55:14 -04:00
Theodore Ts'o 45a3fa8738 Add support to extract basic iso9660 label information to the blkid library
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-10 15:46:57 -04:00
Theodore Ts'o bb626bcd54 Add support for detecting the reiser4 filesystem in the blkid library.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-10 11:48:38 -04:00
Theodore Ts'o 038d2bedaa Improve blkid's VFAT/FAT filesystem probe code
Collapse vfat and fat code and make it more paranoid when probing for
vat/fat filesystems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-07 12:14:53 -04:00
Theodore Ts'o 45d1d889b9 Remove unneeded probe.h header file in lib/blkid/resolve.c
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-07 12:12:21 -04:00
Karel Zak c4c740ff48 Improve VFAT detection to support filesystems w/o a magic string in the superblock
The current libblkid code expects that there's magic string in FAT super
block (like "FAT12", "FAT16", ...). It's very often right, but valid FAT
super block may be without magic string too :-(

The patch from attachment fix this problem. It's inspired by HAL and
Linux kernel.

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-06 08:13:35 -04:00
Karel Zak abaa11240a Add support for detecting software suspend partitions to blkid
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-06 06:42:49 -04:00
Karel Zak 05a6edf4fd Fix blkid library so that the cache validation notices ext2 to ext3 conversion
There's mistake in blkid ext2 detection code. The libblkid doesn't
check for journal when revalidate the cache information about an ext2
device.

        # rm -f /etc/blkid.tab

        # mkfs.ext2 /dev/loop0 &> /dev/null
        # blkid -s TYPE /dev/loop0
        /dev/loop0: TYPE="ext2"

        # mkfs.ext3 /dev/loop0 &> /dev/null
        # blkid -s TYPE /dev/loop0
        /dev/loop0: TYPE="ext2"

That bug doesn't appear when libblkid creates new cache and checks for
all possible filesystems, because it tries ext3 before ext2. BUT when
the library only revalidate the cache it first probes for old cached
filesystem (e.g. ext2).

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-06 06:26:45 -04:00
Matthias Andree 68a7f959c0 Fix compiler warnings about missing memcpy prototypes.
Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-09-06 05:59:52 -04:00
Theodore Ts'o 583d1f8328 Fix false positives from valgrind: prctl(PR_GET_DUMPABLE)
Pass in zero to the unusued arguments of prctl(PR_GET_DUMPABLE) 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 29af314d3f Check for a busy device when creating a journal.
In ext2fs_add_journal_inode() check for the case where the filesystem
appears to be unmounted, but the device is still apparently busy.
This can happen when the luser doesn't bother to mount /proc and has a
bogus /etc/mtab, but still wants to mount the filesystem before using
tune2fs(?!?).  Add a safety check to save him from his own stupidity,
at least on 2.6 kernels.  (Addresses Debian Bug #319002)

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-07-19 15:04:22 -05:00
Theodore Ts'o 5bf9b4cd51 Fix com_err bug in compile_et: # of error messages can be wrong
Fixed bug where error messages using continuations wouldn't increment
the message count.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2005-07-19 08:24:59 -05:00
Andreas Dilger 9b7d811dda This patch adds a check to use fstat or fstat64 in getsize.c if the
target is a regular file, instead of doing binary searching.  It also
fixes a couple of cases where a file descriptor is leaked in the
ext2fs_getsize() routine on error.

Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
2005-07-09 22:06:59 -05:00
Theodore Ts'o 1f965c8d96 Update for e2fsprogs 1.38 release. 2005-06-30 20:06:45 -04:00
Theodore Ts'o 80af12e180 Change the function prototypes of ext2fs_set_bit, ext2fs_clear_bit, and
ext2fs_test_bit to take an unsigned int for the bit number.  Negative
bit numbers were never allowed (and didn't make any sense), so this should
be a safe change.  This is needed to allow safe use of block numbers
greater than or equal to 2**31.
2005-06-30 19:40:18 -04:00
Theodore Ts'o 55080a7637 Fix blkid's debugging/TEST_PROGRAM code so that it is sufficiently
standalone that "make check" will compile without errors even  
when configure "--enable-blkid-debug" is not specified.
2005-06-27 13:54:08 -04:00