Whamcloud - gitweb
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>
Theodore Ts'o [Mon, 14 May 2012 20:08:47 +0000 (16:08 -0400)]
Update Release Notes, Changelogs, version.h, etc. for 1.42.3 release
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 14 May 2012 16:45:54 +0000 (12:45 -0400)]
Change pkg-config files so that both <et/com_err.h> and <com_err.h> work
Change the include path in the Cflags field so that #include
<lib/foo.h> and <foo.h> will work. We had originally used a C flags
which allowed <foo.h> to work, but many applications (especially those
not using pkg-config) had been using the <lob/foo.h> formulation which
didn't require an explicit -I{$includedir} option to the C compiler.
If those applications then converted over to pkg-config, and the
e2fsprogs libraries were installed with a prefix other than /usr, so
that the header files were in some directory such as
/usr/local/include, a program that used #include <lib/foo.h> would
fail to compile.
So change the pkg-config files to include both -I{$includedir} and
-I{$includir}/lib.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 14 May 2012 14:55:09 +0000 (10:55 -0400)]
libext2fs: fix bug in unix_io corrupted > 16TB file systems on 32-bit systems
The code was assuming that "unsigned long" was 64-bit, which of course
it isn't on 32-bit systems. This caused blocks to get written to the
wrong place.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 14 May 2012 05:59:32 +0000 (01:59 -0400)]
dumpe2fs: fix 64-bit block numbers on 32-bit systems
Fix bug which caused 64-bit block numbers to be incorrectly printed on
systems with 32-bit longs.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sun, 13 May 2012 03:13:24 +0000 (23:13 -0400)]
Teach build system to install relative symlinks if requested
Add a configure option, --enable-relative-symlinks, which will use
relative symlinks for the ELF shared library files.
Addresses-Sourceforge-Bug: #3520767
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Sat, 12 May 2012 02:21:08 +0000 (22:21 -0400)]
Include LDFLAGS when building BSD libraries
Addresses-Sourceforge-Bug: #3517272
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Matthias Andree [Fri, 11 May 2012 23:14:30 +0000 (19:14 -0400)]
Fix parallel (make -j) build
Add a few dependencies where needed, so that "make -j17 check" now
works.
Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Matthias Andree [Fri, 11 May 2012 23:14:30 +0000 (19:14 -0400)]
Fix bashisms
These break the self-test suite on *BSD, and on some Linux distros
where /bin/sh is not implemented by bash.
Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Fri, 11 May 2012 22:39:27 +0000 (18:39 -0400)]
Reserve the codepoints for the INCOMPAT features LARGEDATA and INLINEDATA
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Wed, 2 May 2012 18:21:28 +0000 (14:21 -0400)]
Support systems without posix_memalign() and memalign()
MacOS 10.5 doesn't have posix_memalign() nor memalign(), but it does
have valloc(). The Android SDK would like to be built on MacOS 10.5,
so I've added support for a good-enough emulation of memalign()'s
functionality using valloc(), with an explicit test to make sure
valloc() is returning a pointer which is sufficiently aligned given
the requested alignment. This won't work if you try to operate on a
file system with a 16k blocksize using an e2fsprogs built on MacOS
10.5 system, but it is good enough for the common case of 4k
blocksize file systems, and we will let the memory allocation fail in
the alignment is not good enough.
I've also added a unit test for ext2fs_get_memalign() so we can be
sure it's working as expected. I've tested the code paths with
HAVE_POSIX_MEMALIGN defined, HAVE_POSIX_MEMALIGN undefined, and
HAVE_POSIX_MEMALIGN and HAVE_MEMALIGN undefined on an x86 Linux
system, and so I know the valloc() code path works OK. The simplistic
(and less safe) patch at:
https://trac.macports.org/attachment/ticket/33692/patch-lib-ext2fs-inline.c.diff
Shows that using valloc() apparently works OK for MacOS 10.5 (but if
it doesn't the unit test will catch a problem).
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 7 May 2012 18:41:49 +0000 (14:41 -0400)]
libext2fs: factor out I/O buffer allocation
Create a new function, io_channel_alloc_buf() which allocates I/O
buffers with appropriate alignment if we are using direct I/O. The
original code was sometimes using a larger alignment factor than
necessary, and would always request an aligned memory buffer even when
it was not necessary since the block device was not opened with
O_DIRECT.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 7 May 2012 18:30:31 +0000 (14:30 -0400)]
libext2fs: make read_bitmaps() more efficient when using direct I/O
Read in a full block for each allocation bitmap, to avoid using a
kernel bounce buffer when using direct I/O.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 7 May 2012 17:25:44 +0000 (13:25 -0400)]
libext2fs: refactor Direct I/O alignment requirement calculations
Create a new function, ext2fs_get_dio_alignment(), which returns the
alignment requirements for direct I/O. This way we can factor out the
code from MMP and the Unix I/O manager. The two modules weren't
consistently calculating the alignment factors, and in particular MMP
would sometimes use a larger alignment factor than was strictly
necessary.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Mon, 7 May 2012 16:56:07 +0000 (12:56 -0400)]
libext2fs: move the alignment field from unix_io to the io_manager
The align field which indicated the required data alignment of data
buffers was stored in a field specific to the unix_io manager. Move
it to the top-level io_channel structure so it can be better
generalized.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Theodore Ts'o [Wed, 2 May 2012 20:28:48 +0000 (16:28 -0400)]
tests: add new tests f_jnl_32bit and f_jnl_64bit
Add regression tests which make sure e2fsprogs understands the current
32-bit and 64-bit journal format. If a patch breaks the on-disk
format, these tests should warn us about that.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Andreas Dilger [Tue, 24 Apr 2012 20:22:48 +0000 (16:22 -0400)]
e2fsck: quiet harmless inode/blocks errors
Don't consider only an error in the superblock summary as incorrect.
The kernel does not update this field except at unmount time, so
don't print errors during a "-n" run if there is nothing else wrong.
Any other unfixed errors will themselves mark the filesystem invalid.
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Aditya Kali [Tue, 24 Apr 2012 18:46:08 +0000 (14:46 -0400)]
e2fsck,libquota: Update quota only if its inconsistent
Currently fsck recomputes quotas and overwrites quota files
whenever its run. This causes unnecessary modification of
filesystem even when quotas were never inconsistent. We also
lose the limits information because of this. With this patch,
e2fsck compares the computed quotas to the on-disk quotas
(while updating the in-memory limits) and writes out the
quota inode only if it is inconsistent.
Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Aditya Kali [Tue, 24 Apr 2012 18:36:42 +0000 (14:36 -0400)]
e2fsck: Fix check for hidden quota files
Currently e2fsck always incorrectly detects that quota inodes
need to be hidden (even if they are already hidden) and
modifies the superblock unnecessarily. This patch fixes the
check for hidden quota files and avoids modifying the
filesystem if quota inodes are already hidden.
Also, zero-out the old quota inode so that next fsck scan
doesn't complain.
Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Zheng Liu [Tue, 24 Apr 2012 18:32:30 +0000 (14:32 -0400)]
debugfs: cleanup in do_show_debugfs_params
Remove 'out' variable and replace fprintf with printf.
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Aditya Kali [Tue, 24 Apr 2012 18:26:13 +0000 (14:26 -0400)]
tune2fs: fix man page indentation
The indentation in tune2fs man page was wrong towards the
end. Also, there was extra '[' in the SYNOPSIS section.
Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Trần Ngọc Quân [Sun, 22 Apr 2012 19:38:43 +0000 (15:38 -0400)]
po: update vi.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>