Whamcloud - gitweb
Kit Westneat [Tue, 11 Sep 2012 13:28:36 +0000 (15:28 +0200)]
LU-266 e2fsprogs: regenerate LAST_ID file
e2fsck should be able to regenerate the LAST_ID file if it gets corrupted.
This patch will create a new LAST_ID file if it was deleted, and removes the
unnecessary lfsck_get_last_id function. The last_id is then set as before in
e2fsck_pass6_ost to be either the max objid on disk, or the MDS' max ost id,
whichever is larger.
Reported-by: Bernd Schubert <aakef@fastmail.fm>
Signed-off-by: Kit Westneat <kwestneat@ddn.com>
Change-Id: Ic5396da000909b826b76da2fd5a0b5ce88b06944
Andreas Dilger [Sat, 14 Jul 2012 02:33:01 +0000 (20:33 -0600)]
LU-1540 e2fsck: add missing symlink NUL terminator
If a long symbolic link target is written into an external block
without a NUL terminator, its length is decided by the inode's size.
Make symlink check add a NUL termination in such cases if needed.
Such faulty symlinks were generated by osd-ldiskfs on the MDS until
Lustre 2.1.3 and Lustre 2.3. The in-kernel code would handle such
unterminated symlinks correctly, since it used the inode size to
determine the symlink length, but e2fsck would assume the symlink
is broken if there wasn't a trailing NUL.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I4419b30f1adb4a7d273796a936427aa351510213
Niu Yawei [Tue, 12 Jun 2012 08:37:13 +0000 (01:37 -0700)]
LU-1502 quota: Add basic tests for quota
Fixed two minor defects in the quota code, added basic tests for
the quota feature.
Note that the m_quota test is *FAILING* on some systems, but the same
test is passing on other systems (in particular the build/test nodes):
@@ -24,7 +24,7 @@ Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
-test_filesys: 11/32768 files (18.2% non-contiguous), 5703/131072 blocks
+test_filesys: 11/32768 files (18.2% non-contiguous), 5709/131072 blocks
Exit status is 0
Filesystem volume name: <none>
@@ -39,7 +39,7 @@ Filesystem OS type: Linux
Inode count: 32768
Block count: 131072
Reserved block count: 6553
-Free blocks: 125369
+Free blocks: 125363
Free inodes: 32757
First block: 1
Block size: 1024
@@ -65,8 +65,8 @@ Group 0: (Blocks 1-8192)
Reserved GDT blocks at 3-258
Block bitmap at 259 (+258), Inode bitmap at 260 (+259)
Inode table at 261-516 (+260)
- 7650 free blocks, 2037 free inodes, 2 directories
- Free blocks: 543-8192
+ 7644 free blocks, 2037 free inodes, 2 directories
+ Free blocks: 549-8192
Free inodes: 12-2048
Group 1: (Blocks 8193-16384)
Backup superblock at 8193, Group descriptors at 8194-8194
I'm leaving this in the "passing-on-build nodes" state, even though it
is failing on my local system, so that at least we can build and test
packages.
Signed-off-by: Niu Yawei <niu@whamcloud.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: If3d68075aa89d6abf0cf77be93ee3b7d927ed545
Niu Yawei [Mon, 11 Jun 2012 13:33:55 +0000 (06:33 -0700)]
LU-1502 build: enable quota when building
The quota feature is disabled by default, we should enable it
explicitly when build e2fsprogs.
Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: Ic09f7c100b254559a5223460242b3bf465ff0802
Andreas Dilger [Fri, 13 Apr 2012 19:24:30 +0000 (13:24 -0600)]
tests: add basic test case for e2scan
Add a simple test to verify that e2scan is detecting the correct
files in the filesystem based on the modification time.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 13 Apr 2012 19:17:37 +0000 (13:17 -0600)]
e2scan: a tool for fast namespace/inode scanning
e2scan is a tool for efficiently scanning inodes for changes,
or all inodes, and then generating pathnames for the inodes
of interest.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Bobi Jam [Tue, 29 May 2012 07:19:57 +0000 (01:19 -0600)]
tests: verify directory optimize with dir_data
Verify that the extended dir_data in the dirent is correctly
processed when running "e2fsck -fD" to optimize the htree
directory layout.
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Bobi Jam [Sat, 25 Aug 2012 07:08:59 +0000 (15:08 +0800)]
LU-1774 tests: e2fsck -D does not change dirdata
Add test case for directory optimization to preserve dirdata
content for dot and dotdot entries.
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: Iae190794da75a2080a8e5cc5b95a49e0c894f72f
Andreas Dilger [Fri, 13 Apr 2012 19:42:42 +0000 (13:42 -0600)]
tests: add basic tests for dir_data feature
Signed-off-by: Pravin Shelar <pravin@clusterfs.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 13 Apr 2012 19:39:26 +0000 (13:39 -0600)]
e2fsck: add support for dir_data feature
Add support for the INCOMPAT_DIRDATA feature, which allows
storing extra data in the directory entry beyond the name.
This allows the Lustre File IDentifier to be accessed in
an efficient manner, and would be useful for expanding a
filesystem to allow more than 2^32 inodes in the future.
LU-1774 e2fsck: e2fsck -D does not change dirdata content
Fix dir optimization to preserver dirdata content for dot
and dotdot entries.
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: Iae190794da75a2080a8e5cc5b95a49e0c894f72f
Signed-off-by: Pravin Shelar <pravin@clusterfs.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 13 Apr 2012 18:58:53 +0000 (12:58 -0600)]
ext2fs: add readahead method to improve scanning
Add a readahead method for prefetching ranges of disk blocks.
This is useful for inode table scanning, and other large
contiguous ranges of blocks, and may also prove useful for
random block prefetch, since it will allow reordering of the
IO without waiting synchronously for the reads to complete.
It is currently using the posix_fadvise(POSIX_FADV_WILLNEED)
interface, as this proved most efficient during our testing
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 13 Apr 2012 18:55:45 +0000 (12:55 -0600)]
debugfs: dump "fid" and "lma" xattrs on inode stat
Print out the Lustre "fid" and "lma" contents for stat, if
present, to simplify debugging.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 13 Apr 2012 08:32:19 +0000 (02:32 -0600)]
e2fsck: add Lustre lfsck tool
The lfsck tool, in conjunction with e2fsck, build a DB4 database
of all the inodes and objects on the MDT and OST filesystems.
The lfsck tool combines the databases on the Lustre client,
and can verify that all of the objects referenced by inodes
exist, are not referenced by two inodes, and have a parent
inode.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 13 Apr 2012 08:16:24 +0000 (02:16 -0600)]
ext2fs: check if Lustre filesystem is mounted
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 13 Apr 2012 08:14:16 +0000 (02:14 -0600)]
tests: verify large xattr inode support
Verify that inodes with large EAs in a secondary inode are working:
* EA inode needs to have EA_INODE_FL set
* EA inode should reference parent inode number+generation
Signed-off-by: Kalpak Shah <kalpak@sun.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 13 Apr 2012 08:04:53 +0000 (02:04 -0600)]
e2fsck: add support for xattrs in external inodes
Add support for the INCOMPAT_EA_INODE feature, which stores large
extended attributes into an external inode instead of data blocks.
The inode is referenced by the e_value_inum field (formerly the
unused e_value_block field) from the extent header, and stores the
xattr data starting at byte offset 0 in the inode data block.
The xattr inode stores the referring inode number in its i_mtime,
and the parent i_generation in its own i_generation, so that there
is a solid linkage between the two that e2fsck can verify. The
xattr inode is itself marked with EXT4_EA_INODE_FL as well.
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 13 Apr 2012 08:01:12 +0000 (02:01 -0600)]
e2fsck: clean up xattr checking code, add test
Clean up xattr header/list processing for in-inode xattrs instead
of doing lots of explicit pointer math. Add a regression test for
in-inode xattrs.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 13 Apr 2012 07:50:29 +0000 (01:50 -0600)]
tests: add checks for journal checksum feature
f_jchksum_bblk: journal checksum feature where there is a corrupt
block in an uncommitted transaction
f_jchksum_blast_trans: incomplete last trans not considered bad
f_jchksum_remount: check journal mounted by a kernel without
CHECKSUM support after CHECKSUM is in journal superblock
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 13 Apr 2012 07:53:39 +0000 (01:53 -0600)]
tests: create random filesystem, corrupt, e2fsck
The f_random_corruption test enables a random subset of filesystem
features, picks one of the valid filesystem block and inode sizes,
and a random device size and creates a new filesystem with those
parameters.
It is possible to disable the running of the test by setting the
environment variable F_RANDOM_CORRUPTION=skip. By default the test
script is run only one time, but setting the LOOP_COUNT variable
allows the test to run multiple times.
If the script is running as root the filesystem is mounted and
populated with file data to allow a more useful test filesystem
to be generated. In some cases the kernel may not support the
requested filesystem features and the filesystem cannot be mounted.
This is not considered a test failure.
The resulting filesystem is corrupted with both random data and
by shifting data from one part of the device to another and then
repaired by e2fsck. In some rare cases the random corruption is
severe enough that the filesystem is not recoverable (e.g. small
filesystem with no backup superblock has bad superblock corruption)
but in most cases "e2fsck -fy" should be able to fix all errors
in some way.
After e2fsck has repaired the filesystem, it is optionally mounted
(if the environment variable MOUNT_AFTER_CORRUPTION=yes is set) and
the test files created in the filesystem are deleted. This verifies
that the fixes in the filesystem are sufficient for the kernel to
use the filesystem without error. Since there is some possibility
of the kernel oopsing if there is a filesystem bug, this part of
the test is not enabled by default.
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 13 Apr 2012 07:23:17 +0000 (01:23 -0600)]
tests: add test cases for inode badness
Signed-off-by: Girish Shilamkar <girish@clusterfs.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 13 Apr 2012 07:13:58 +0000 (01:13 -0600)]
e2fsck: track errors/badness found for each inode
The present e2fsck code checks the inode, per field basis. It
doesn't take into consideration to total sanity of the inode.
This may cause e2fsck turning a garbage inode into an apparently
sane inode ("It is a vessel of fertilizer, and none may abide
its strength.").
The following patch adds a heuristics to detect the degree of
badness of an inode. icount mechanism is used to keep track of
the badness of every inode. The badness is increased as various
fields in inode are found to be corrupt. Badness above a certain
threshold value results in deletion of the inode. The default
badness threshold value is 7, it can be specified to e2fsck
using "-E inode_badness_threshold=<value>"
This can avoid lengthy pass1b shared block processing, where a
corrupt chunk of the inode table has resulted in a bunch of
garbage inodes suddenly having shared blocks with a lot of good
inodes (or each other).
Signed-off-by: Girish Shilamkar <girish@clusterfs.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 13 Apr 2012 00:05:03 +0000 (18:05 -0600)]
tests: add tests for expanding inode extra size
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 13 Apr 2012 00:03:37 +0000 (18:03 -0600)]
e2fsck: add support for expanding the inode size
This patch adds a "-E expand_extra_isize" feature which makes sure
that _every_ used inode has i_extra_isize >= s_min_extra_isize if
s_min_extra_isize is set. Else it makes sure that i_extra_isize
of every inode is equal to sizeof(ext2_inode_large) - 128.
This is useful for the case where nanosecond timestamps or 64-bit
inode version fields are required for all inodes in the filesystem.
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 13 Apr 2012 18:25:25 +0000 (12:25 -0600)]
e2fsck: ignore xattr feature in backup superblocks
Since the xattr feature is enabled automatically by the kernel,
it can cause spurious e2fsck runs on a clean filesystem due to
differences between the primary and backup superblocks.
Signed-off-by: Eric Sandeen <esandeen@redhat.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Thu, 9 Aug 2012 05:23:22 +0000 (23:23 -0600)]
tests: PAGE_SIZE larger than blocksize with hole
Verify correct operation in the case of writing files with allocated
blocks at the end of the file beyond i_size. This can happen for
PAGE_SIZE > blocksize, or through fallocate().
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 13 Apr 2012 07:59:31 +0000 (01:59 -0600)]
e2fsck: handle preallocation for large PAGE_SIZE
Fix handling of block preallocation support in cases where the kernel
PAGE_SIZE is larger than the filesystem blocksize.
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Thu, 12 Apr 2012 23:52:44 +0000 (17:52 -0600)]
tests: add tests for uninitialized bitmaps
Various tests for handing uninitialized block and inode bitmaps,
and inodes beyond the in-use high watermark.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Thu, 12 Apr 2012 23:38:13 +0000 (17:38 -0600)]
tune2fs: warn if the filesystem journal is dirty
Running tune2fs on a filesystem with an unrecovered journal can
cause the tune2fs settings to be reverted when the journal is
replayed. Print a warning if this is detected so that the user
isn't surprised if it happens.
Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Thu, 12 Apr 2012 23:32:53 +0000 (17:32 -0600)]
e2fsck: allow deleting or zeroing shared blocks
E2fsck fixes files that are found to be sharing blocks by cloning
the shared blocks and giving each file a private copy in pass 1D.
Allowing all files claiming the shared blocks to have copies can
inadvertantly bypass access restrictions. Deleting all the files,
zeroing the cloned blocks, or placing the files in the /lost+found
directory after cloning may be preferable in some secure environments.
The following patches implement config file and command line options
in e2fsck that allow pass 1D behavior to be tuned according to site
policy. It adds two extended options and config file counterparts.
On the command line:
-E clone=dup|zero
Select the block cloning method. "dup" is old behavior,
and is the default. "zero" is a new method that substitutes
zero-filled blocks for the shared blocks in all the files
that claim them.
-E shared=preserve|lost+found|delete
Select the disposition of files containing shared blocks.
"preserve" is the old behavior which remains the default.
"lost+found" causes files to be unlinked after cloning so
they will be reconnected to /lost+found in pass 3.
"delete" skips cloning entirely and simply deletes the files.
In the config file:
[options]
clone=dup|zero
shared=preserve|lost+found|delete
Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Thu, 12 Apr 2012 23:24:55 +0000 (17:24 -0600)]
e2fsck: parse config file before command-line opts
The patch changes the order that the config file and command line
are parsed so that command line has precedence. It also parses
the -E option for every occurrence, otherwise the -E option is
not cumulative.
Signed-off-by: Jim Garlick <garlick@llnl.gov>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Thu, 12 Apr 2012 22:57:40 +0000 (16:57 -0600)]
tests: invalid value of in-inode EA offset
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 25 May 2012 07:01:28 +0000 (01:01 -0600)]
tests: extent pointing to non-existent block
Signed-off-by: Girish Shilamkar <girish@clusterfs.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Thu, 12 Apr 2012 22:15:07 +0000 (16:15 -0600)]
e2fsck: workaround for old extents tests
The e2fsck_ext2fs_extent_get() part of this patch is a workaround
to handle problems with old Lustre extents patches that didn't
clear the ee_start_hi or ei_leaf_hi fields.
That has been fixed for long time and could be removed as soon
as the f_extent_* tests are fixed to clear these _hi fields.
Otherwise the extents are all marked as corrupt and it ruins those
tests value.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Thu, 12 Apr 2012 22:02:12 +0000 (16:02 -0600)]
tests: verify > 65000 subdirectories
Add test case to verify nlink handling of large directories.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 13 Apr 2012 08:23:12 +0000 (02:23 -0600)]
TT-177 build: add .spec file for SLES11 packaging
Include the upstream SLES11 .spec file to ensure the packages we
build match the upstream packages. Any later patches that change
the packaging should patch the .spec file appropriately.
Add in the SLES-specific patches, excluding the replacement de.po
file, since the original SLES11 de.po file is only against 1.41.4,
and is missing a large number of changes to the translated messages
related to 64-bit format specifiers.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I783d58bd78d7c4c66cc85ec5557ae1aaf64016ba
Andreas Dilger [Fri, 13 Apr 2012 08:19:19 +0000 (02:19 -0600)]
build: add RHEL6 .spec file for packaging
Include the upstream RHEL6 .spec file to ensure the packages we
build match the upstream packages. Any later patches that change
the packaging should patch the .spec file appropriately.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Thu, 12 Apr 2012 21:39:04 +0000 (15:39 -0600)]
build: update e2fsprogs.spec for distro builds
Add the distro version to the RPM release number, so that it the
RPM names do not conflict.
Allow the RPM built from upstream to replace the split packages
provided by the distros. At some point in the future it may be
desirable to also split the RPM built by this spec file, but this
is complicated by the fact that SLES and RHEL have different splits.
Signed-off-by: Girish Shilamkar <girish.shilamkar@sun.com>
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Thu, 12 Apr 2012 21:31:35 +0000 (15:31 -0600)]
filefrag: improvements to filefrag FIEMAP handling
* add support for multiple-device filesystems
* add -k option to print extents in kB-sized units (like df -k)
* add -b {blocksize} to print extents in blocksize units
* add -e option to use in extent format, even for non-extent files.
* add -X option to print extents in hexadecimal format
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Thu, 12 Apr 2012 21:26:49 +0000 (15:26 -0600)]
blkid: fix ZFS device detection
Fix the ZFS device detection by looking at multiple uberblocks to
see if any are present, rather than looking for the ZFS boot block
which is not always present.
There may be up to 128 uberblocks, but the first 4 are not written
to disk on a newly-formatted filesystem so check several of them at
different offsets within the uberblock array.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Thu, 12 Apr 2012 21:23:47 +0000 (15:23 -0600)]
e2fsck: improve in-inode xattr checks
Add check for in-inode xattr to make sure that it is not referencing
an offset that is beyond the end of the inode.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Fri, 27 Apr 2012 05:22:45 +0000 (23:22 -0600)]
build: fix build warnings for MacOS
The BLKFLSBUF and FDFLUSH ioctls are Linux specific, and do not
really have anything to do with __GNUC__ (which is also used on
OS/X and Solaris). Only print these warnings on Linux systems.
O_DIRECT is not defined in the OS/X headers. Since this is only a
performance enhancement, and not required for correct operation,
just ignore it if undefined.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Tue, 11 Sep 2012 22:15:20 +0000 (16:15 -0600)]
build: quiet some "gcc -Wall" compiler warnings
Quiet a number of simple compiler warnings:
- pointers not initialized by ext2fs_get_mem()
- return without value in non-void function
- dereferencing type-punned pointers
- unused variables
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Andreas Dilger [Wed, 23 May 2012 21:05:21 +0000 (15:05 -0600)]
tests: make generated test scripts read-only
Make generated test scripts read-only, to avoid errors by developers
editing the generated test scripts and then having them accidentally
clobbered when "make" is run again.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Andreas Dilger [Thu, 12 Apr 2012 20:00:07 +0000 (14:00 -0600)]
build: update version for Lustre build
Add Whamcloud-specific build version to distinguish packages from
upstream packages.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Theodore Ts'o [Mon, 30 Jul 2012 00:38:48 +0000 (20:38 -0400)]
Update Release Notes, Changelogs, version.h, etc. for 1.42.5 release
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sun, 29 Jul 2012 23:02:29 +0000 (19:02 -0400)]
e2fsck: print the number of blocks and inodes in the verbose statistics
In addition to the free blocks and free inodes, also print the number
of blocks and inodes in the verbose statistics.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sun, 29 Jul 2012 22:20:04 +0000 (18:20 -0400)]
e2fsck: allow for bigger disks when printing verbose statistics
Disks have gotten bigger, so 8 digits might not be enough. Allow for
12 digits worth of blocks, which is more than enough for 3 petabytes.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sun, 29 Jul 2012 21:44:11 +0000 (17:44 -0400)]
e2fsck: add e2fsck.conf options for extra reporting
Add report_time, report_verbose, and report_features options to
e2fsck.conf which enable additional, more verbose reporting by e2fsck.
This is useful for large cloud installations where there are a large
number file systems being managed, and where it may not be obvious
from the e2fsck log files exactly how a particular file system is
configured.
The report_time and report_verbose options, which are the same as the
-tt and -v command line options, respectively, are useful because they
are options specific to e2fsck, and the fsck program does not have a
way of passing certain options only to a specific /sbin/fsck.<fstype>
program.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sun, 29 Jul 2012 17:34:01 +0000 (13:34 -0400)]
libext2fs: fix uninit block calculation when inodes_per_block < first_ino
The following commands:
dd if=/dev/zero of=/tmp/foo count=1 ibs=$(( 256 * 1024 * 1024 ))
mke2fs -N 256 -t ext4 /tmp/foo
... will cause mke2fs to write until it fills the device. The cause
for this is that the explicit request for 256 inodes causes the number
of inodes per block group to be 8. The ext2fs_initialize() function
assumed that all of the reserved inodes would be in the first block
group, which is not true in this case. This caused the number of
uninitialized inodes in the first block group to be negative, which
then resulted in mke2fs trying to zero out a very large number of
blocks. Oops.
Addresses-Sourceforge-Bug: #3528892
Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sun, 29 Jul 2012 17:05:46 +0000 (13:05 -0400)]
e2fsck: fix code which uniquifies names in directory entries
When checking to see whether or not a new name is unique, the code was
using the wrong length parameter, which could cause the anti-collision
loop for a long time trying to find what it thinks is a unique name.
Addresses-Sourceforge-Bug: #3540545
Reported-by: Vitaly Oratovsky <vmo@users.sourceforge.net>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Olivier Blin [Sun, 29 Jul 2012 16:44:53 +0000 (12:44 -0400)]
Link shared libraries with local libraries instead of system ones
ELF_OTHER_LIBS usually contains local search dirs (-L ../..), but it
was added in link command after system search dirs from LDFLAGS.
Libraries and executables were linked with the system libraries if
present, and possibly using static archives instead of shared
libraries.
It could also make final executable link to fail when shared libraries
are enabled: if libext2fs.so is linked with a static libcom_err.a from
system, build system would attempt to link without -lpthread.
This fixes the issue by moving ELF_OTHER_LIBS before LDFLAGS in the
link command.
Addresses-Sourceforge-Bug: #3542572
Reported-by: Olivier Blin <blino@users.sourceforge.net>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Riku Voipio [Sun, 29 Jul 2012 04:22:13 +0000 (00:22 -0400)]
debian: set e2fsprogs as Multi-Arch: foreign
If package foo:i386 depends on e2fsprogs, without Multi-Arch: foreign
statetment, the i386 version of e2fsprogs will be installed. By
setting the foreign field, the already installed (in this example
amd64) e2fsprogs package is enough to satisfy the dependency.
The M-A: foreign field is ignored in pre-multiarch systems, so ifdeffing
it using macros should be unnessary.
Addresses-Debian-Bug: #678395
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 29 Jul 2012 04:16:44 +0000 (00:16 -0400)]
e2fsck: check a file system mounted read-only if forced
Previously e2fsck would only allow a mounted file system to be checked
if it was the root file system and it was mounted read-only. Now
allow any file system mounted read-only if the -f option is specified.
This makes it easier to test how e2fsck handles checking file systems
which are mounted without having to test on the root file system.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sun, 29 Jul 2012 04:01:29 +0000 (00:01 -0400)]
Revert "e2fsck: Skip journal checks if the fs is mounted and doesn't need recovery"
This reverts commit
47c1b8e16668daa6e74cee3c7b8bdf237ffefe70.
The original reason for this commit was to speed up boots for hard
drives. However, I've measured the time difference on a 1TB laptop
drive, and it's not significant: 70ms vs 10ms when running e2fsck on a
clean file system.
The problem with this optimization is that we don't notice if the
journal superblock has a non-zero s_errno field. If we don't transfer
the error indicator from the journal superblock to the file system
superblock, then the kernel will transfer it when the file system is
remounted read-write, causing scary messages to appear in the syslog.
(And since there was a bug in the kernel code which didn't clear the
error indicator in the journal superblock, it would never get
cleared.)
Reported-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Eric Sandeen [Sat, 28 Jul 2012 21:48:36 +0000 (17:48 -0400)]
e4defrag: handle device symlinks
Device nodes are commonly accessed via symlinks, i.e.
lrwxrwxrwx. 1 root root 7 Jul 19 13:01 /dev/mapper/testvg-testlv -> ../dm-0
Today, e4defrag on such a device will fail:
File is not regular file
"/dev/mapper/testvg-testlv"
due to it being a link, and e4defrag on the link target does as well:
Filesystem is not mounted
due to the target not being found in /etc/mtab.
Fix this by checking whether the symlink target is a block device
and if so, using that device in main(), and also changing get_mount_point()
to search for a matching device number, not device name.
Addresses-Red-Hat-Bugzilla: #707209
Reported-by: Peter Hjalmarsson <xake@rymdraket.net>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Eric Sandeen [Sat, 28 Jul 2012 21:52:13 +0000 (17:52 -0400)]
filefrag: fix segfault on virtual fs
filefrag on a virtual fs like proc segfaults:
Floating point exception
because stat.f_blocks is 0, so the calculation of cylgroups is 0,
which leads to a divide by 0 when calculating expected extents.
Since it's only used for ext2 filesystems anyway, just move
the calculation of expected under "if (is_ext2)" to fix this.
Reported-by: Max Beikirch <maxnet@onlinehome.de>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Liu Bo [Sat, 28 Jul 2012 21:36:40 +0000 (17:36 -0400)]
chattr: update chattr's man page chattr for No_COW
Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Liu Bo [Sat, 28 Jul 2012 21:29:13 +0000 (17:29 -0400)]
filefrag: fix report of number of extents
filefrag has several bugs:
1.
$ touch f1
$ filefrag f1
f1: 1 extent found ----> bug!
$ filefrag -v f1
Filesystem type is: ef53
File size of f1 is 0 (0 blocks, blocksize 4096)
f1: 0 extents found
2.
$ truncate -s 1m f2
$ filefrag f2
f2: 1 extent found ----> bug!
$ filefrag -v f2
Filesystem type is: ef53
File size of f2 is 1048576 (256 blocks, blocksize 4096)
f2: 0 extents found
3.
$ for i in `seq 11 -2 0`; do dd if=/dev/zero of=f4 bs=4k count=1 seek=$i conv=notrunc oflag=sync &>/dev/null; done
$ ll f4
-rw-r--r-- 1 root root 49152 Jun 9 15:09 f4
$ filefrag f4
f4: 7 extents found
$ filefrag -v f4
Filesystem type is: ef53
File size of f4 is 49152 (12 blocks, blocksize 4096)
ext logical physical expected length flags
0 1 1109993 1
1 3 1109992 1109994 1
2 5 1109991 1109993 1
3 7 1109990 1109992 1
4 9 1109989 1109991 1
5 11 1108207 1109990 1 eof
f4: 7 extents found -----------------------> but we only have 6 extents, bug!
All of these bugs come from the fact that we've made a mistake on
calculating total extents:
o we set 1 as default for 'total extents', and this will report 1
extent found even when we don't get any extent from fiemap.
o if our first extent does not start from 0(logical addr), total
extents will be one more than what it should be.
Addresses-Red-Hat-Bugzilla: #840848
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 23 Jul 2012 22:45:23 +0000 (18:45 -0400)]
logsave: fix fd leak which could cause logsave to hang
The logsave program is leaking a file descriptor when it forks and
execs the program which forks a process which hangs around. In the
case of /etc/init.d/checkroot, this would be fsck. This file
descriptor never gets closed, so it's still present when fsck runs
e2fsck, and then if e2fsck has its own logging enabled using (in
/etc/e2fsck.conf):
[options]
log_dir = /mnt
log_filename = e2fsck-%N.%h.INFO.%D-%T
log_dir_wait = true
then e2fsck will fork off a process waiting for /mnt to get remounted
read/write. This causes logsave to never get an EOF from its pipe, so
it hangs waiting for the read to fail --- which won't happen due to
the file descriptor leak which is still being held open by e2fsck's
forked child process. And so /etc/init.d/checkroot hangs, and the
root file system never gets remounted read/write, and we deadlock.
Fix the problem by closing the pipe fd so the logsave program doesn't
end up leaking it to its descendent processes.
Addresses-Debian-Bug: #682592
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Aditya Kali [Fri, 13 Jul 2012 22:25:09 +0000 (15:25 -0700)]
tune2fs: fix quota feature removal
When the last quota inode is removed, the 'quota' feature
flag was not removed from superblock in some cases.
Ex:
$ mke2fs -t ext4 -O quota <dev> # creates both usr & grp
# quota inodes
$ tune2fs -Q ^usrquota <dev> # removes usr quota inode
$ tune2fs -Q ^grpquota <dev> # removes grp quota inode,
# but the 'quota' feature flag
# was not removed from superblock
This patch removes the 'quota' feature flag from superblock
if none of the quota inodes are set.
Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Aditya Kali [Fri, 13 Jul 2012 22:25:08 +0000 (15:25 -0700)]
e2fsck/quota: mark FS invalid if quotas are not fixed
If user chooses to not fix quota info, then the FS should be
marked as having errors. PR_NO_OK prevented this from happening.
Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Aditya Kali [Fri, 13 Jul 2012 22:25:07 +0000 (15:25 -0700)]
libquota: fix quota_inode_truncate()
We failed to clear EXT2_FLAG_SUPER_ONLY after deleting the
quota inode and so, the updated block bitmap was not written
back. This caused fsck to complain after running
'tune2fs -O ^quota <dev>'. Clear this flag so that updated
block bitmap gets written. Also, avoid truncating the quota
inode if it is not hidden.
Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Aditya Kali [Fri, 13 Jul 2012 22:25:06 +0000 (15:25 -0700)]
tune2fs/quota: always create hidden quota files
Currently 'tune2fs -O quota <dev>' will try to use existing
quota files and write their inode numbers in the superblock.
Next e2fsck run then converts these into hidden quota inodes
(ino #3 & #4). But this approach has problems:
1) Before e2fsck run, the inodes are visible to the user and
might get corrupted or removed or replaced by the user.
2) Since these are user visible, we have to include
their block usage in the quota accounting. But once
these inodes are hidden, e2fsck will have to decrement
their usage from the quota accounting (which e2fsck
currently doesn't do and instead reports error).
(the following used to give e2fsck error previously:
# assume <dev> has aquota.user & aquota.group files
$ tune2fs -O quota <dev> # stores ino# of quota files in
# ext4 superblock
$ e2fsck -f <dev> # hides quota files, but now quota
# usage is incorrect.
<< quota errors >>
Instead of making e2fsck complicated, this patch creates the
hidden quota inodes at 'tune2fs -O quota' time iteself. The
usage is computed freshly and limits are copied from the
aquota.user and aquota.group files as earlier.
Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 14 Jul 2012 23:58:06 +0000 (19:58 -0400)]
Fix spelling typo's in man pages for tune2fs and mke2fs
Addresses-Debian-Bug: #680114
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Andreas Dilger [Fri, 6 Jul 2012 01:44:51 +0000 (19:44 -0600)]
build: add generated files to .gitignore
Add a batch of files/wildcards to the list of ignored files, so
that "git status" does not show so many files that should be ignored.
The "*.dSYM" directories are generated during building on MacOS.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Fri, 6 Jul 2012 01:44:20 +0000 (19:44 -0600)]
e2fsck: rename "bool" variables
Since "bool" is a valid C type, declarations of the form "int bool"
will cause compiler errors if <stdbool.h> is included. Rename these
variables to avoid this name clash.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Wed, 13 Jun 2012 20:05:30 +0000 (16:05 -0400)]
Update debian changelog for 1.42.4-3
Liu Bo [Wed, 13 Jun 2012 19:43:23 +0000 (15:43 -0400)]
chattr: add the -C option to the usage message
Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Wed, 13 Jun 2012 19:36:56 +0000 (15:36 -0400)]
Update version.h using the proper abbreviation for June
The configure script uses the date string in version.h to calculate a
version date code. This only used for tagging prerelease tarball, so
it's not a big deal, but fix this for correctness' sake.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Wed, 13 Jun 2012 19:29:13 +0000 (15:29 -0400)]
Fix blhc (Build Log Hardening Check) warnings
The Build Log Hardening Check is a debian tool which scans the output
of a package build making sure that the security hardening flags are
used when compiling and linking all of binaries in a package.
For the most part we were passing CFLAGS, CPPFLAGS, and LDFLAGS down
to the compiler and link commands, but there there were one or two
exceptions. In addition, there where a few places in "make install"
where the V=1 option was not being honored, which triggered blhc
warnings since it couldn't analyze those commands.
The e2fsck.static was the only binary that was not getting built and
packaged with the hardening flags, but I've fixed all of the blhc
warnings so in the future it will be obvious if we regress.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 12 Jun 2012 22:25:34 +0000 (18:25 -0400)]
libquota: remove unneeded #include of <sys/quota.h>
The attempted inclusion of sys/quota.h is causing failures in when
building on the hurd and freebsd platforms for Debian. It's not
necessary any more, so just remove the #include.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 12 Jun 2012 21:21:38 +0000 (17:21 -0400)]
Update Release Notes, Changelogs, version.h, etc. for 1.42.4 release
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 12 Jun 2012 21:09:39 +0000 (17:09 -0400)]
lsattr, chattr: add support for btrfs's No_COW flag
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Andreas Dilger [Tue, 12 Jun 2012 17:59:56 +0000 (13:59 -0400)]
tests: allow e2fsck tests to run on OS/X
The "mktemp" program requires a template on OS/X. Allow the test
TMPFILE to be created in the local /tmp directory for both OS/X
and Linux.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 12 Jun 2012 05:38:57 +0000 (01:38 -0400)]
tests: add two more tests of orphaned inode handling
Add two tests, f_orphan_indirect_inode, and f_orphan_extents_inode,
which tests the bug fixes in the two previous commits:
e2fsck: update global free blocks/inodes count when truncating orphan inodes
libext2fs: fix block iterator for extents when truncating inodes
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 12 Jun 2012 04:27:39 +0000 (00:27 -0400)]
libext2fs: fix block iterator for extents when truncating inodes
When e2fsck uses the block iterator to release the blocks in an
extent-mapped inode, when the last block in an extent is removed, the
current extent has been removed and the extent cursor is now pointing
at the next inode. But the block iterator code doesn't know that. So
when it tries to go the next extent, it will end up skipping an
extent, and so the inode will be incompletely truncated.
The fix is to go to the next extent before calling the callback
function for the current extent. This way, regardless of whether the
current extent gets removed, the extent cursor is still pointing at
the right place.
Reported-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 12 Jun 2012 02:18:25 +0000 (22:18 -0400)]
e2fsck: update global free blocks/inodes count when truncating orphan inodes
By the time we start processing the orphan inode list, we have already
calculated the total expected number of free blocks and inodes in
ctx->free_{blocks,inodes}. This is used to set the free blocks/inodes
count in the superblock in the case where we don't need to do a full
e2fsck.
We need to update these expected free block counts as we process the
orphan inode list so that superblock values are set correctly.
Otherwise we could have the following happen:
% e2fsck /tmp/test.img
e2fsck 1.42.3 (14-May-2012)
Truncating orphaned inode 12 (uid=0, gid=0, mode=0100644, size=0)
Setting free blocks count to 46 (was 79)
/tmp/test.img: clean, 12/16 files, 54/100 blocks
% e2fsck /tmp/test.img
e2fsck 1.42.3 (14-May-2012)
Setting free blocks count to 79 (was 46)
/tmp/test.img: clean, 12/16 files, 21/100 blocks
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 12 Jun 2012 02:02:17 +0000 (22:02 -0400)]
debugfs: interpret date strings of the form @dddd
Debugfs will now interpret date strings of the form @123 as 123
seconds after the start of the epoch. This is handy when editing an
orphan inode linked list using the inode's deletion time field.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Tao Ma [Mon, 11 Jun 2012 03:56:30 +0000 (23:56 -0400)]
tests: add new test f_zero_extent_length
If all of the extents in the last extent tree block (ETB) in a
non-trivial extent tree contain uninitialized extents which are after
the end of the file as defined by i_size, the hueristics will
incorrectly estimate the last entry (and hence the node's e_len field)
in the last entry of each level of the extent tree.
As Tao Ma has noted, since e2fsck was requiring that the length
(e_len) field of interior nodes be non-zero, this was causing false
failures where e2fsck would declare that the extent tree was
corrupted.
This was fixed in commit
9c40d14841: "e2fsck: only check for
zero-length leaf extents". Add a regression test case to ensure that
this issue remains fixed.
Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 11 Jun 2012 04:25:45 +0000 (00:25 -0400)]
e2fsck: only check for zero-length leaf extents
The on-disk format for interior nodes in the extent tree does not
encode the length of each entry in the interior node; instead, it is
synthesized/simulated by the extent library code in libext2fs.
Unfortunately, this simulation is not perfect; in particular it does
not work for the last extent in the extent tree if there are
uninitialized blocks allocated using fallocate with
FALLOC_FL_KEEP_SIZE, and it leads to e2fsck incorrectly complaining
about an invalid zero-length extent.
We only need to worry about the extent length for the leaves of the
tree, since it is there were we are checking an on-disk value, as
opposed to a software-generated simulation. So restrict the check of
extent length to leaf nodes in the extent tree.
Reported-by: Tao Ma <tm@tao.ma>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Aditya Kali [Mon, 11 Jun 2012 03:52:11 +0000 (23:52 -0400)]
libext2fs: fix i_blocks for extent leaf create/delete with bigalloc
When libext2fs allocates/deletes an extent leaf, the i_blocks
value is incremented/decremented by fs->blocksize / 512. This
is incorrect in case of bigalloc. The correct way here is to
use cluster_size / 512.
The problem is seen if we try to create a large inode using
libext2fs (say using ext2fs_block_iterate3()) on a bigalloc
filesystem. fsck catches this and complains.
Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 11 Jun 2012 03:35:43 +0000 (23:35 -0400)]
e2fsck: correctly propagate error from journal to superblock
If the file system is mounted read-only after a file system error has
been detected, the fact that an error occurred is written to the
journal. This is important because while the journal is getting
replayed, the error indication in the superblock may very well get
overwritten.
Unfortunately, the code to propagate the error indication from the
journal to superblock was broken because this was being done before
the old file system handle is thrown away and the file system is
re-opened to ensure that no stale data is in the file system handle.
As a result, the error indication in the superblock was never written
out.
To fix this, we need to move the check if the journal's error
indicator has been set after the file system has been freed and
re-open.
Reported-by: Ken Sumrall <ksumrall@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Jan Kara [Mon, 4 Jun 2012 16:51:55 +0000 (12:51 -0400)]
libquota: remove unnecessary definitions
Quite some definitions in quota library are not necessary. Remove them.
Also fold quota.h file into quotaio.h since it didn't contain that many
definitions.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 1 Jun 2012 00:13:51 +0000 (20:13 -0400)]
tests: fix the e2fsck test script to handle a missing test name
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Fri, 1 Jun 2012 00:12:35 +0000 (20:12 -0400)]
tests: add new test to validate errno handling in the journal superblock
Add a new regression test f_jnl_errno
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Thu, 31 May 2012 23:19:02 +0000 (19:19 -0400)]
e2fsck: handle an already recovered journal with a non-zero s_error field
If a file system was remounted read-only after a file system
corruption is detected, and then that file system is mounted and
unmounted by the kernel, the journal would have been recovered, but
the kernel currently leaves the s_errno field still set. This is
arguably a bug, since it has already propgated the non-zero s_errno
field to the file system superblock, where it will be retained until
e2fsck has been run.
However, e2fsck should handle this case for existing kernel by
checking the journal superblock's s_errno field even if journal
recovery is not required.
Without this commit, e2fsck would not notice anything wrong with the
file system, but a subsequent mount of the file system by the kernel
would mark the file system's superblock as needing checking (since the
journal's s_errno field would still be set), resulting an full e2fsck
run at the next reboot, which would find nothing wrong --- and then
when the file system was mounted, the whole cycle would repeat again.
I had seen reports of this in the past, but it wasn't until recently
that I realized exactly how this had come about, since normally e2fsck
would be run automatically before the file system is mounted again,
thus avoiding this problem. However, a user using a rescue CD who
didn't run e2fsck before mounting the a file system in this condition
could trigger this situation, and unfortunately, with previous
versions of e2fsprogs and the kernel, there would be no way out no
matter what the user tried to do.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Thu, 31 May 2012 23:18:18 +0000 (19:18 -0400)]
dumpe2fs: print journal's s_errno field if it is non-zero
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Andreas Dilger [Thu, 31 May 2012 20:39:54 +0000 (16:39 -0400)]
e2fsck: allow checking on mounted root fs
Commit
732e26b98e5c79a4298dbe341f43b54b354bb241 added checks to
prevent e2fsck from being run in filesystem-modifying mode against
a mounted or otherwise busy device, due to several bug reports of
users doing this even with the verbose warnings in check_mount().
However, it also prevented e2fsck from checking a mounted root
filesystem, which will prevent the node from booting. Once again
allow e2fsck to run against the mounted root filesystem if it is
also mounted read-only at the time.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Mon, 28 May 2012 22:58:24 +0000 (16:58 -0600)]
tests: use make rules to run tests in parallel
Change the e2fsck/mke2fs/tune2fs/e2image/debugfs regression tests to
be driven by Makefile rules instead of by a script loop. This allows
the tests to be run in parallel like a build and reduces testing time
significantly.
One major change to the tests themselves is to printing the test name,
description, and status together after the test has passed or failed,
to avoid mixing lines from the tests. The other major change is to
use unique temporary filenames for each test, which was mostly handled
already via
b4db1e4c7461a50e18c9fd135b9f1ba6f27e4390, but in some
cases temporary files are changed to use $test_name.tmp to avoid any
collision between running tests.
On my old 2-CPU system it reduced the testing time from 160s to 40s.
Much of the savings is from the MMP test delays running in parallel.
It still takes the time of the slowest test, f_mmp_garbage, though
there will be ongoing benefit in the future as more tests are added
since the wallclock time will not increase linearly for each test.
Tests were run with various combinations of "make -j", and "make -j2"
through "make -j44" repeatedly without any test failures.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Mon, 28 May 2012 14:54:08 +0000 (10:54 -0400)]
libext2fs: don't inline ext2fs_open_file() and ext2fs_stat()
The creation of inline wrappers ext2fs_open_file() and ext2fs_stat()
in commit
c859cb1de0d624caa0779fb17d1a53766143136e in ext2fs.h caused
difficulties with the use of headers, since the headers for open64()
and stat64() may already be included (and skip the declaration of the
64-bit variants) before ext2fs.h is ever read. There is no real way
to solve the missing prototypes and resulting compiler warnings inside
ext2fs.h.
Since ext2fs_open_file() and ext2fs_stat() are not performance
critical operations, they do not need to be inline functions at all,
and the needed function headers can be handled properly in one file.
Similarly, posix_memalloc() was having difficulties with headers, and
was being defined in ext2fs.h, but it is now only being used by a
single file, so move the required header there.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 28 May 2012 14:38:06 +0000 (10:38 -0400)]
libquota: remove quota_is_on() which was the last user of quotactl()
The quotactl() system call was being used without the use of a
function prototype. On closer examination, it turns out the one user
of that system call was the quota_is_on() function, which is not used
by e2fsprogs at all. Since libquota is an e2fsprogs-internal library,
and not one that we plan to export any time soon, the simplest thing
to do is to simply remove quota_is_on(), which in turn allows us to
remove all of the infrastructure around using the Linux-specific
quotactl() system call.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Andreas Dilger [Thu, 24 May 2012 21:34:56 +0000 (15:34 -0600)]
e2fsck: fix checks done for mounted vs. read-only
Currently, if e2fsck is run without the "-n" flag (i.e. it
might modify the filesystem), there is no guarantee that it will
open the filesystem with the EXCLUSIVE flag (i.e. O_EXCL) to
prevent the block device from being checked (in most cases this
means mounted, but it could also be an MD/LVM member device).
Conversely, if e2fsck is run with "-n" (i.e. read-only), and
/etc/mtab or /proc/mounts does not report the block device as
mounted then e2fsck thinks the filesystem is unmounted. In this
case, e2fsck incorrectly sets the EXCLUSIVE flag, which causes
the check to fail, even though e2fsck is running read-only.
To fix this, do not open with EXCLUSIVE if it is a read-only check,
and always open with EXCLUSIVE if the filesystem might be changed.
This also prevents filesystem mounts while e2fsck is running.
Also refuse allow e2fsck to run at all if the filesystem is BUSY.
The e2fsck check_mount() was checking for MOUNTED, but not BUSY,
and it should refuse to run outright if the block device is BUSY.
The previous MOUNTED heuristics pre-date the O_EXCL reservation
by the kernel, so there could be uncertainty due to stale /etc/mtab
data, but with newer kernels a busy device should never be modified.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Mike Frysinger [Mon, 28 May 2012 14:21:19 +0000 (10:21 -0400)]
libquota: add missing time.h include
This code uses time() but doesn't include time.h leading to:
quotaio.c:89:2: warning: implicit declaration of function 'time'
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Eric Sandeen [Mon, 28 May 2012 02:13:39 +0000 (22:13 -0400)]
libext2fs: fix rbtree backend for extent lengths greater than 2^32
For a completely full filesystem with more than 2^32 blocks, the
rbtree bitmap backend can assemble an extent of used blocks which is
longer than 2^32. If it does, it will overflow ->count, and corrupt
the rbtree for the bitmaps.
Discovered by completely filling a 32T filesystem using fallocate, and
then observing debugfs, dumpe2fs, and e2fsck all behaving badly.
(Note that filling with only 31 x 1T files did not show the problem,
because freespace was fragmented enough that there was no sufficiently
long range of used blocks.)
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Eric Sandeen [Mon, 28 May 2012 02:11:58 +0000 (22:11 -0400)]
debugfs: fix strtoblk for 64bit block numbers
Affects icheck, freeb, setb, testb...
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 28 May 2012 02:03:39 +0000 (22:03 -0400)]
Remove unnecessary escape before tab in man pages
Also fixed a number of other minor nits in the resize2fs and e2image
man pages.
Addresses-Debian-Bug: #674453, #674694
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 22 May 2012 01:58:39 +0000 (21:58 -0400)]
e2fsck: fix precedence bug in built-in quota support
The operator precedence bug means that we might pay atteion to
s_grp_quota_inum even if the RO_COMPAT_QUOTA feature flag is clear.
However, fortunately, this is unlikely to happen in practice.
Cc: Aditya Kali <adityakali@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Tue, 22 May 2012 01:30:45 +0000 (21:30 -0400)]
e2fsck: fix 64-bit journal support
64-bit journal support was broken; we weren't using the high bits from
the journal descriptor blocks! We were also using "unsigned long" for
the journal block numbers, which would be a problem on 32-bit systems.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 21 May 2012 15:03:16 +0000 (11:03 -0400)]
tests: fix f_jnl_64bit so that it actually has a 64-bit journal
The previous image did not have a 64-bit journal so it wouldn't
properly test the 64-bit journal format.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 21 May 2012 14:59:01 +0000 (10:59 -0400)]
libe2p: teach e2p_jrnl_feature2string() about the 64-bit journal feature
This will allow dumpe2fs to correctly display the 64-bit journal
feature, if it is enabled.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>