Whamcloud - gitweb
Andreas Dilger [Tue, 9 Sep 2014 21:06:06 +0000 (15:06 -0600)]
LU-5501 revert: blkid,ext2fs: avoid name clash with __u{8,16,32,64}
This reverts commit
5023510dd7f0ab40a216d3600ab665e2053cc070.
Temporarily revert this change for the Lustre e2fsprogs, since it
causes Lustre 2.5.3 (only) builds to fail in llverfs.c and llverdev.c.
They include <ext2fs/ext2fs.h>, which includes ext2-types.h, which
only conditionally declares __u32 et.al. with the patch applied.
The Lustre 2.5.3 config.h file defines HAVE___U32 et.al and config.h
is implicitly included into llverfs.c and llverdev.c by libtool in
the Makefile, but these __u* types are not actually declared in any
of the headers included by llverfs.c or llverdev.c, hence failure.
This patch can be dropped once http://review.whamcloud.com/11840
is landed and Lustre 2.5.4 is released. It is not needed for b2_4-
(doesn't use libtool) or b2_6+ (removes HAVE___U* defines).
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: If16ac468d6b861d79bd84e7963729f5b46500c1e
Reviewed-on: http://review.whamcloud.com/11901
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Andreas Dilger [Wed, 23 Jul 2014 07:00:45 +0000 (01:00 -0600)]
LU-5307 build: fix unused/uninitialized variable warnings
Fix a few warnings about unused and uninitialized variables.
Also fix util/subst.c to include <sys/time.h> to avoid using
undeclared functions gettimeofday() and futimes().
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: Id7deabf6eb1f59ce98ab2cb51b9bf5198c500c1e
Andreas Dilger [Fri, 18 Jul 2014 20:47:02 +0000 (14:47 -0600)]
LU-5307 build: add support for RHEL-7 .spec file
Add the RHEL 7 .spec file. Do not include the e2fsprogs lfsck
feature for this distro, since the Lustre LFSCK is a functional
replacement and is much faster than using the external db4
databases used by lfsck. That also avoids the ongoing dependency
problem with db4 RPM being named differently on every distro.
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I00278b50c3669f56c5297a75b89775fec9476f43
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.
LU-2627 e2fsck: check_symlink() SIGSEGV
Since e2fsck_pass1_check_symlink() calls into check_symlink()
with pctx == NULL, we should use 'ino' instead of 'pctx->ino'
in check_symlink().
Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Change-Id: If9c16f96d0655d5a886ef607f1f47ced6176f8d8
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I4419b30f1adb4a7d273796a936427aa351510213
Niu Yawei [Mon, 11 Jun 2012 13:33:55 +0000 (06:33 -0700)]
LU-1502 build: enable quota when building
The quota support is disabled by default, but we need to enable it
explicitly when build e2fsprogs for Lustre 2.4.
Signed-off-by: Niu Yawei <yawei.niu@intel.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 <andreas.dilger@intel.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.
LU-3612 e2scan: fix missing header for e2scan to enable SQLite
SQLite function is always disabled due to missing config.h
Signed-off-by: Shuichi Ihara <sihara@ddn.com>
Change-Id: Ie4b49bd6d04a6f1e25610df51d17b97d3dc4fe5f
LU-4328 e2scan: Missing copyright attribution
Copyright headers are added to the files for e2scan.
A minor correction was made to the header of tst_read_ea.c
Signed-off-by: James Nunez <james.a.nunez@intel.com>
Change-Id: Icc359e717a0177b83a08f2471d84e68487dafee3
Signed-off-by: Andreas Dilger <andreas.dilger@intel.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 <andreas.dilger@intel.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.
LU-266 e2fsck: 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 either
the max objid on disk, or 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
LU-2682 lfsck: fix access to ost_id structures
Changes in upstream lov_mds_md use lmm_oi and l_ost_oi instead
of direct _id and _seq access, in preparation for FID-on-OST
changes. Update lfsck code to handle new structures.
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: If18f5ed34744b8372687472843ccc09108500c1e
Change-Id: I05b5da92efbedb7b92c6de736c05beef30500c1e
LU-2677 lfsck: handle smaller lustre_mdt_attrs
In 2.4 the lustre_mdt_attrs (LMA) structure was shrunk to move out
the unused SOM fields into a separate structure. The filter_fid
structure was shrunk to allow both FF and LMA on 256-byte OST
inodes. Allow reading both old and new LMA and FF structures,
since we only care about the initial fields in both of them.
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: If6c75d5ee3192ef3761aa9f645175698ebe5ee36
LU-3132 lfsck: fix the wrong data pointer
The patch is to pass a correct data pointer of struct lu_fid or
struct ll_recreate_obj to ioctl in lfsck_recreate_obj().
Signed-off-by: Liu Ying <emoly.liu@intel.com>
Change-Id: I8301f311cc5aaf57ae51ceaeb74db25fe61b5cd6
LU-3838 lfsck: various defects in lfsck
- In lfsck_get_fid(), sizeof(buf) should be passed as buffer
length, but not sizeof(*buf);
- In lfsck_mds_dirs(), we should follow into directory if the
directory doesn't contain self fid;
- In ext2fs_attr_ibody_get(), returns EXT2_ET_EA_TOO_BIG only
when the buffer isn't large enough;
- In ext2fs_attr_ibody_get(), do type cast before operating on
pointer!
Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: I8ba4139fcc51b23bfa33c82c71f9b69b2b033a37
LU-3837 lfsck: Abort lfsck in DNE mode
lfsck doesn't support DNE mode now, we'd abort lfsck once the
objects in remote dir is detected, otherwise, those objects could
probably be cleared by lfsck mistakenly.
Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: If66f04e261522e6216f524a703d427fce2a5938a
LU-4288 e2fsprogs: process EA information in e2fsck_lfsck_find_ea
The function e2fsck_lfsck_find_ea is designed to save information
about an EA in the correct tables. This patch addresses a bug that
prevents any EA from looked at it.
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: If8ca571e74c041d63b545987d716a94ad859e89c
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Andreas Dilger [Fri, 13 Apr 2012 08:16:24 +0000 (02:16 -0600)]
ext2fs: check if Lustre filesystem is mounted
Add a check to ext2fs_check_mount_point() to loo in /proc/fs/lustre/*
to see if Lustre is mounted, since st_rdev of the mountpoint does not
match st_rdev of the block device itself, which confuses libext2fs.
Signed-off-by: Andreas Dilger <andreas.dilger@intel.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" object xattr contents,
if present, with debugfs stat to simplify debugging.
Signed-off-by: Andreas Dilger <andreas.dilger@intel.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.xu@intel.com>
Change-Id: Iae190794da75a2080a8e5cc5b95a49e0c894f72f
Andreas Dilger [Fri, 13 Apr 2012 19:42:42 +0000 (13:42 -0600)]
tests: add basic tests for dirdata feature
Signed-off-by: Pravin Shelar <pravin@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Andreas Dilger [Fri, 13 Apr 2012 19:39:26 +0000 (13:39 -0600)]
e2fsck: add support for dirdata 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.xu@intel.com>
Change-Id: Iae190794da75a2080a8e5cc5b95a49e0c894f72f
LU-2462 e2fsprogs Consider DIRENT_LUFID flag in link_proc().
While adding the new file entry in directory block, link_proc()
calculates minimum record length of the existing directory entry
without considering the dirent data size and which leads to
corruption. Changed the code to use EXT2_DIR_REC_LEN() which will
return correct record length including dirent data size.
Signed-off-by: Manisha Salve <msalve@ddn.com>
Change-Id: Ic593c558c47a78183143ec8e99d8385ac94d06f7
LU-4677 libext2fs, e2fsck: don't use ext2_dir_entry_2
Due to endian issues, do not use ext2_dir_entry_2 because it will
have the wrong byte order on directory entries that are swabbed.
Instead, use the standard practice of mask-and-shift to access the
file_type and dirdata flags.
Signed-off-by: Pravin Shelar <pravin@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.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 <andreas.dilger@intel.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 <andreas.dilger@intel.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 <andreas.dilger@intel.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 <andreas.dilger@intel.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.
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.
A second e2fsck run is done to verify that all of the errors are
fixed in the first pass, and that the filesystem is free of errors.
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.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 <andreas.dilger@intel.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 <andreas.dilger@intel.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 <andreas.dilger@intel.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 <andreas.dilger@intel.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 <andreas.dilger@intel.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 <andreas.dilger@intel.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 <andreas.dilger@intel.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 <andreas.dilger@intel.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 <andreas.dilger@intel.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 <andreas.dilger@intel.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 <andreas.dilger@intel.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 <andreas.dilger@intel.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 <andreas.dilger@intel.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 <andreas.dilger@intel.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 <andreas.dilger@intel.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.
LU-4284 build: add missing Provides line in SLES spec file
Need to add a line in the SUSE spec file for Provides: ldiskfsprogs.
This is present in the RHEL spec file and is needed to resolve
dependencies in lustre server rpms at rpm install time.
Signed-off-by: Bob Glossman <bob.glossman@intel.com>
Change-Id: Ib4821004d27c9a7271ffdbd7403990e586d6c9ca
Signed-off-by: Andreas Dilger <andreas.dilger@intel.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 <andreas.dilger@intel.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
bs 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 <andreas.dilger@intel.com>
Andreas Dilger [Thu, 12 Apr 2012 21:31:35 +0000 (15:31 -0600)]
filefrag: Lustre changes to filefrag FIEMAP handling
Add support for multiple-device filesystems by defining a new
fe_device field in the fiemap_extent structure. This allows
printing the filesystem-relative or linux block device number
associated with each extent of a file. If a single filesystem
extent is mirrored to multiple block devices, the fe_device
field can be used to disambiguate the multiple copies.
If the "-l" (device-logical) option is given to filefrag, then
all extents for a particular device of a file are returned
before returning extents for the next device. This makes it
easier to see if extent allocation within a single device is
contiguous, instead of returning all of the blocks of a file
interleaved in file-logical-offset order.
Signed-off-by: Andreas Dilger <andreas.dilger@intel.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 <andreas.dilger@intel.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 <andreas.dilger@intel.com>
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 <andreas.dilger@intel.com>
Andreas Dilger [Thu, 12 Apr 2012 20:00:07 +0000 (14:00 -0600)]
build: update version for Lustre build
Add Lustre-specific build version to distinguish packages from
upstream packages.
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Andreas Dilger [Thu, 24 Jul 2014 22:01:42 +0000 (16:01 -0600)]
Revert "aclocal.m4: update to newer versions of autoconf macros"
This patch breaks RPM building on RHEL5 because it requires
autoconf-2.60, but RHEL5 only has autoconf-2.59 available.
Revert the patch, since it doesn't appear to have any benefits
for the distros that Lustre is are building on.
This reverts commit
936139510672e394aa8dd1aa315c8d633fc636e3.
Theodore Ts'o [Fri, 29 Aug 2014 12:58:27 +0000 (08:58 -0400)]
Update release notes, etc. for final 1.42.12 release
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Trần Ngọc Quân [Fri, 29 Aug 2014 12:46:03 +0000 (08:46 -0400)]
po: update vi.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Yuri Chornoivan [Fri, 29 Aug 2014 12:46:03 +0000 (08:46 -0400)]
po: update uk.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Göran Uddeborg [Fri, 29 Aug 2014 12:46:03 +0000 (08:46 -0400)]
po: update sv.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Jakub Bogusz [Fri, 29 Aug 2014 12:46:03 +0000 (08:46 -0400)]
po: update pl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Benno Schulenberg [Fri, 29 Aug 2014 12:46:03 +0000 (08:46 -0400)]
po: update nl.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Samuel Thibault [Fri, 29 Aug 2014 12:46:02 +0000 (08:46 -0400)]
po: update fr.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Petr Pisar [Fri, 29 Aug 2014 12:46:02 +0000 (08:46 -0400)]
po: update cs.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Wed, 27 Aug 2014 13:27:54 +0000 (09:27 -0400)]
mke2fs: complain if bigalloc and hugefiles_align_disk is incompatible
If the starting partition offset is incompatible with the bigalloc
cluster size, complain and exit, instead of creating a file which
would have a logical to physical block mapping which breaks the
cluster alignment requirement.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 26 Aug 2014 20:34:24 +0000 (16:34 -0400)]
e2fsprogs.pot: update POT-Creation-Date
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 26 Aug 2014 13:40:06 +0000 (09:40 -0400)]
e2fsck: fix spelling error (strage vs storage)
Reported-by: Philipp Thomas <pth@suse.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Eric Sandeen [Tue, 26 Aug 2014 01:02:18 +0000 (21:02 -0400)]
e2fsprogs: add supported file attributes to ext4.5 manpage
The chattr(1) manpage now refers users to filesystem-specific
manpages for details on supported attributes, so add those to
ext4.5.
I've left out oddities like being able to set the compressed
or no-tail-packing flags, or setting data journaling on ext2.
That behavior seems like a bug, not a feature.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 25 Aug 2014 14:30:53 +0000 (10:30 -0400)]
Interim updates of release notes, etc. in preparation for 1.42.12 release
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Göran Uddeborg [Mon, 25 Aug 2014 14:05:34 +0000 (10:05 -0400)]
po: update sv.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Samuel Thibault [Mon, 25 Aug 2014 14:05:34 +0000 (10:05 -0400)]
po: update fr.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Antonio Ceballos [Mon, 25 Aug 2014 14:05:34 +0000 (10:05 -0400)]
po: update es.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Petr Pisar [Mon, 25 Aug 2014 14:05:34 +0000 (10:05 -0400)]
po: update cs.po (from translationproject.org)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 25 Aug 2014 03:54:37 +0000 (23:54 -0400)]
mke2fs: improve the error message when a non-existent file is specified
If the user does not specify the file system size, and the file does
not exist, give an error message like this:
The file /tmp/foo.img does not exist and no size was specified.
instead of this:
Creating regular file /tmp/foo.img
mke2fs: Device size reported to be zero. Invalid partition specified, or
partition table wasn't reread after running fdisk, due to
a modified partition being busy and in use. You may need to reboot
to re-read your partition table.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 25 Aug 2014 03:53:33 +0000 (23:53 -0400)]
mke2fs.8.in: explain how the fs-size parameter is interpreted
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 25 Aug 2014 03:23:41 +0000 (23:23 -0400)]
resize2fs: clarify the size of blocks in resize2fs's messages
Addresses-Debian-Bug: #758029
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 25 Aug 2014 02:40:43 +0000 (22:40 -0400)]
resize2fs.8.in: clarify when on-line resizing is supported
Addresses-Debian-Bug: #726760
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Mon, 25 Aug 2014 02:31:03 +0000 (22:31 -0400)]
dumpe2fs: complain if extra arguments are given on the command line
Addresses-Debian-Bug: #758074
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 19 Aug 2014 12:27:59 +0000 (08:27 -0400)]
debugfs: fix set_inode_field block[IND|DIND|TIND]
After we determine that we can't parse the array value as an integer,
we need to restore the square brackets to the field name, so that we
can find a match with block[IND], block[DIND], and block[TIND] in the
inode field table.
Reported-by: Jun He <jhe@cs.wisc.edu>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Wed, 13 Aug 2014 19:59:20 +0000 (15:59 -0400)]
filefrag: fix extent count calculation when using FIBMAP
The extent count calculation works correctly with the FIBMAP ioctl in
verbose (-v) mode, but without the verbose option, the calculation was
broken because we weren't properly updating the fm_ext data structures
in non-verbose mode.
Addresses-Launchpad-Bug: #1356496
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Tue, 12 Aug 2014 18:37:19 +0000 (14:37 -0400)]
tests: convert use of md5sum to crcsum
The following tests were using md5sum: i_e2image, u_mke2fs, and
u_tune2fs. Convert them to use crcsum for better portability (not all
environments have md5sum; some might have sha1sum instead :-)
For our purposes crcsum is quite sufficient.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Tue, 12 Aug 2014 18:19:37 +0000 (14:19 -0400)]
e2fsck: don't flush the FS unless it's actually dirty
ext2fs_flush2() unconditionally writes the block group descriptors to
disk even if the underlying FS isn't marked dirty. This causes the
following error message on a fsck -n run:
e2fsck 1.43-WIP (09-Jul-2014)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Error writing block 2 (Attempt to write block to filesystem resulted in short write). Ignore error? no
Error writing block 2 (Attempt to write block to filesystem resulted in short write). Ignore error? no
Error writing file system info: Attempt to write block to filesystem resulted in short write
Since ext2fs_close2() only calls flush if the dirty flag is set,
modify e2fsck to exhibit the same behavior so that we don't spit out
write errors for a read only check.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 10 Aug 2014 21:20:36 +0000 (17:20 -0400)]
e2fsck: flush out the superblock and bitmaps before printing final messages
A user who sees the message
***** REBOOT LINUX *****
or
***** FILE SYSTEM WAS MODIFIED *****
might think that e2fsck was complete even though we haven't finished
writing out the superblock or bitmap blocks, and then either forcibly
reboot or power cycle the box, or yank the USB key out while the
storage device is still being written (before e2fsck exits).
So rearrange the exit path of e2fsck so that we flush out the dirty
superblock/bg descriptors/bitmaps before we print the final message.
Also clean up this code so that the flow of control is easier to
understand, and add error checking to catch any errors (normally
caused by I/O errors writing to the disk) for these final writebacks.
Addresses-Debian-Bugs: #757543, #757544
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: Dan Jacobson <jidanni@jidanni.org>
Theodore Ts'o [Sat, 9 Aug 2014 17:05:21 +0000 (13:05 -0400)]
tests: add the r_meta_bg_shrink test
This test checks to make sure resize2fs can properly handle a file
system which started life as a normal ext4 file system and then was
grown to a size where meta_bg was enabled, and then shrunk back below
the point where the meta_bg format is still needed.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 9 Aug 2014 17:03:43 +0000 (13:03 -0400)]
tests: add f_first_meta_bg_too_big test
The test verifies that e2fsck can properly fix a file system where the
value of s_first_meta_bg in the superblock is larger than the number
of block group descriptors in the file system. E2fsck will fix this
by clearing the meta_bg feature.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 9 Aug 2014 17:02:36 +0000 (13:02 -0400)]
tests: make sure MKE2FS_FIRST_META_BG is unset while running tests
If the developer has set the MKE2FS_FIRST_META_BG environment
variable, this can cause test failures.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 9 Aug 2014 16:33:11 +0000 (12:33 -0400)]
resize2fs: disable the meta_bg feature if necessary
When shrinking a file system, if the number block groups drops below
the point where we started using the meta_bg layout, disable the
meta_bg feature and set s_first_meta_bg to zero. This is necessary to
avoid creating an invalid/corrupted file system after the shrink.
Addresses-Debian-Bug: #756922
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reported-by: Marcin Wolcendorf <antymat+debian@chelmska.waw.pl>
Tested-by: Marcin Wolcendorf <antymat+debian@chelmska.waw.pl>
Theodore Ts'o [Sat, 9 Aug 2014 16:31:04 +0000 (12:31 -0400)]
e2fsck: fix file systems with an overly large s_first_meta_bg
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 9 Aug 2014 16:24:54 +0000 (12:24 -0400)]
libext2fs: avoid buffer overflow if s_first_meta_bg is too big
If s_first_meta_bg is greater than the of number block group
descriptor blocks, then reading or writing the block group descriptors
will end up overruning the memory buffer allocated for the
descriptors. Fix this by limiting first_meta_bg to no more than
fs->desc_blocks. This doesn't correct the bad s_first_meta_bg value,
but it avoids causing the e2fsprogs userspace programs from
potentially crashing.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Fri, 8 Aug 2014 20:42:05 +0000 (16:42 -0400)]
libext2fs: have UNIX IO manager use pread64/pwrite64
Commit
baa3544609da3c ("libext2fs: have UNIX IO manager use
pread/pwrite) causes a breakage on 32-bit systems where off_t is
32-bits for file systems larger than 4GB. Fix this by using
pread64/pwrite64 if possible, and if pread64/pwrite64 is not present,
using pread/pwrite only if the size of off_t is at least as big as
ext2_loff_t.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Aaron Crane [Mon, 4 Aug 2014 01:54:14 +0000 (21:54 -0400)]
debugfs: teach rdump to take multiple source arguments
[ modified to update man page by tytso ]
Signed-off-by: Aaron Crane <arc@aaroncrane.co.uk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Aaron Crane [Mon, 4 Aug 2014 01:53:24 +0000 (21:53 -0400)]
debugfs: refactor do_rdump()
No behaviour changes. This will simplify the next commit.
Signed-off-by: Aaron Crane <arc@aaroncrane.co.uk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Aaron Crane [Mon, 4 Aug 2014 01:52:11 +0000 (21:52 -0400)]
debugfs: fix double-close bug in "rdump" and "dump -p"
Previously, both of these usages called dump_file() with a true value as
the "preserve" argument, which caused it to in turn call fix_perms() to
make the permissions on the locally-dumped file match those found on the
ext2 filesystem. fix_perms() then attempted to close(2) the file descriptor
(if any) before returning (though it didn't attempt to report on any errors
found while doing so).
However, in both of these situations, the local file being dumped had been
opened by the caller of dump_file(), which also closes it (and reports on
any errors detected when closing). This meant that both "rdump" and "dump
-p" would then emit a spurious EBADF message when trying to re-close the
local file descriptor.
Deleting the spurious close(2) call in fix_perms() fixes the problem in both
commands.
Signed-off-by: Aaron Crane <arc@aaroncrane.co.uk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Aaron Crane [Mon, 4 Aug 2014 01:51:04 +0000 (21:51 -0400)]
debugfs: be more specific in error messages
Signed-off-by: Aaron Crane <arc@aaroncrane.co.uk>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 3 Aug 2014 18:00:47 +0000 (14:00 -0400)]
libext2fs: place metadata blocks in the last flex_bg so they are contiguous
Place the allocation bitmaps and inode table blocks so they are
adjacent, even in the last flexbg.
Previously, after running "mke2fs -t ext4 DEV 286720", the layout of
the last few block groups would look like this:
Group 32: (Blocks 262145-270336) [INODE_UNINIT, ITABLE_ZEROED]
Block bitmap at 262145 (+0), Inode bitmap at 262161 (+16)
Inode table at 262177-262432 (+32)
Group 33: (Blocks 270337-278528) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
Block bitmap at 262146 (bg #32 + 1), Inode bitmap at 262162 (bg #32 + 17)
Inode table at 262433-262688 (bg #32 + 288)
Group 34: (Blocks 278529-286719) [INODE_UNINIT, ITABLE_ZEROED]
Block bitmap at 262147 (bg #32 + 2), Inode bitmap at 262163 (bg #32 + 18)
Inode table at 262689-262944 (bg #32 + 544)
Now, they look like this:
Group 32: (Blocks 262145-270336) [INODE_UNINIT, ITABLE_ZEROED]
Block bitmap at 262145 (+0), Inode bitmap at 262148 (+3)
Inode table at 262151-262406 (+6)
Group 33: (Blocks 270337-278528) [INODE_UNINIT, BLOCK_UNINIT, ITABLE_ZEROED]
Block bitmap at 262146 (bg #32 + 1), Inode bitmap at 262149 (bg #32 + 4)
Inode table at 262407-262662 (bg #32 + 262)
Group 34: (Blocks 278529-286719) [INODE_UNINIT, ITABLE_ZEROED]
Block bitmap at 262147 (bg #32 + 2), Inode bitmap at 262150 (bg #32 + 5)
Inode table at 262663-262918 (bg #32 + 518)
This reduces the free space fragmentation in a freshly created file
system. It also allows the following mke2fs command to succeed:
mke2fs -t ext4 -b 4096 -O ^resize_inode -G $((2**20)) DEV 2130483
(Note that while this allows people to run mke2fs with insanely large
flexbg sizes, this is not a recommended practice, as the kernel may
refuse to resize such a file system while mounted, since it currently
tries to allocate an in-memory data structure based on the size of the
flexbg, and so a file system with a very large flexbg size will cause
the memory allocation to fail. This will hopefully be fixed in a
future kernel release, but if the goal is to force all of the metadata
blocks to be at the beginning of the file system, it's better to use
the packed_meta_blocks configuration parameter in mke2fs.conf.)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sun, 3 Aug 2014 16:22:27 +0000 (12:22 -0400)]
Revert "mke2fs: prevent creation of unmountable ext4 with large flex_bg count"
This reverts commit
d988201ef9cb6f7b521e544061976ab4270a3f89.
The problem with this commit is that causes common small file system
configurations to fail. For example:
mke2fs -O flex_bg -b 4096 -I 1024 -F /tmp/tt 79106
mke2fs 1.42.11 (09-Jul-2014)
/tmp/tt: Invalid argument passed to ext2 library while setting
up superblock
This check in ext2fs_initialize() was added to prevent the metadata
from being allocated beyond the end of the filesystem, but it is
also causing a wide range of failures for small filesystems.
We'll address this in a different way, by using a smarter algorithm
for deciding the layout of metadata blocks for the last flex block
group.
Reported-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Artemiy Volkov [Sat, 2 Aug 2014 23:53:04 +0000 (19:53 -0400)]
debugfs: fix argument parsing in do_freefrag()
When do_freefrag() is called from debugfs, the value of optind is
not reset. Rectify that by calling reset_getopt().
Signed-off-by: Artemiy Volkov <artemiyv@acm.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Sat, 2 Aug 2014 23:43:10 +0000 (19:43 -0400)]
misc: fix Makefile for profiled build
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Thu, 1 May 2014 23:15:05 +0000 (16:15 -0700)]
libext2fs: when appending to a file, don't split an index block in equal halves
When we're appending an extent to the end of a file and the index
block is full, don't split the index block into two half-full index
blocks because this leaves us with under utilized index blocks, at
least in the fallocate case. Instead, copy the last extent from the
full block into the new block. This isn't perfect utilization, but
there's a lot of work involved in teaching extent.c to be able to goto
a nonexistent node in a newly allocated (and empty) extent block.
This patch does not fix the general problem of keeping the extent tree
balanced.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sat, 2 Aug 2014 23:18:03 +0000 (19:18 -0400)]
libext2fs: have UNIX IO manager use pread/pwrite
If pread/pwrite are present, have the UNIX IO manager use them for
aligned IOs (instead of the current seek -> read/write), thereby
saving us a (minor) amount of system call overhead.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Wed, 30 Jul 2014 20:25:49 +0000 (14:25 -0600)]
filefrag: minor code fixes and cleanups
Print filefrag_fiemap() error message to stderr instead of stdout.
Only call ioctl(EXT3_IOC_GETFLAGS) for ext{2,3,4} filesystems to
decide if the ext2 indirect block allocation heuristic shold be used.
Properly handle the the force_bmap (-B) option.
Exit with a positive error number instead of a negative one.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Tue, 29 Jul 2014 23:30:40 +0000 (17:30 -0600)]
tests: fix f_badcluster output formatting
The f_badcluster output format depends on how libreadline formats
and outputs the commands read from stdin. Instead of trying to
handle these differences, use an input command file, which does
not depend on external components to be consistent.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Andreas Dilger [Tue, 29 Jul 2014 23:30:39 +0000 (17:30 -0600)]
misc: quiet signed/unsigned charactr compiler warnings
Quiet warnings about signed vs. unsigned character mismatch.
Use __u8 for storing UUIDs instead of char to match the superblock
s_uuid field.
Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Theodore Ts'o [Thu, 31 Jul 2014 15:49:48 +0000 (11:49 -0400)]
tune2fs: fix uninitialized variable in remove_journal_device
This bug was introduced by commit
7dfefaf413bbd ("tune2fs: update
journal super block when changing UUID for fs").
Fixes-Coverity-Bug: 1229243
Reported-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Azat Khuzhin [Mon, 28 Jul 2014 07:43:25 +0000 (11:43 +0400)]
tune2fs: update journal users while updating fs UUID (with external journal)
When we have fs with external journal device, and updating it's UUID, we
should update UUID in users list for that external journal device.
Before:
$ tune2fs -U clear /tmp/dev
tune2fs 1.42.10 (18-May-2014)
$ dumpe2fs /tmp/dev | fgrep UUID
dumpe2fs 1.42.10 (18-May-2014)
Filesystem UUID: <none>
Journal UUID:
da1f2ed0-60f6-aaaa-92fd-
738701418523
$ dumpe2fs /tmp/journal | fgrep users -A10
dumpe2fs 1.42.10 (18-May-2014)
Journal number of users: 2
Journal users:
0707762d-638e-4bc6-944e-
ae8ee7a3359e
0ad849df-1041-4f0a-b1c1-
2f949d6a1e37
After:
$ sudo tune2fs -U clear /tmp/dev
tune2fs 1.43-WIP (18-May-2014)
$ dumpe2fs /tmp/dev | fgrep UUID
dumpe2fs 1.42.10 (18-May-2014)
Filesystem UUID: <none>
Journal UUID:
da1f2ed0-60f6-aaaa-92fd-
738701418523
$ dumpe2fs /tmp/journal | fgrep users -A10
dumpe2fs 1.42.10 (18-May-2014)
Journal number of users: 2
Journal users:
0707762d-638e-4bc6-944e-
ae8ee7a3359e
00000000-0000-0000-0000-
000000000000
Also add some consts to avoid *magic numbers*:
- UUID_STR_SIZE
- UUID_SIZE
- JFS_USERS_MAX
- JFS_USERS_SIZE
Proposed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Azat Khuzhin <a3at.mail@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Azat Khuzhin [Mon, 28 Jul 2014 07:43:24 +0000 (11:43 +0400)]
tune2fs: update journal super block when changing UUID for fs.
Using -U option you can change the UUID for fs, however it will not work
for journal device, since it have a copy of this UUID inside jsb (i.e.
journal super block). So copy UUID on change into that block.
Here is the initial thread:
http://comments.gmane.org/gmane.comp.file-systems.ext4/44532
You can reproduce this by executing following commands:
$ fallocate -l100M /tmp/dev
$ fallocate -l100M /tmp/journal
$ sudo /sbin/losetup /dev/loop1 /tmp/dev
$ sudo /sbin/losetup /dev/loop0 /tmp/journal
$ mke2fs -O journal_dev /tmp/journal
$ tune2fs -U
da1f2ed0-60f6-aaaa-92fd-
738701418523 /tmp/journal
$ sudo mke2fs -t ext4 -J device=/dev/loop0 /dev/loop1
$ dumpe2fs -h /tmp/dev | fgrep UUID
dumpe2fs 1.43-WIP (18-May-2014)
Filesystem UUID:
8a776be9-12eb-411f-8e88-
b873575ecfb6
Journal UUID:
e3d02151-e776-4865-af25-
aecb7291e8e5
$ sudo e2fsck /dev/vdc
e2fsck 1.43-WIP (18-May-2014)
External journal does not support this filesystem
/dev/loop1: ********** WARNING: Filesystem still has errors **********
Reported-by: Chin Tzung Cheng <chintzung@gmail.com>
Signed-off-by: Azat Khuzhin <a3at.mail@gmail.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Azat Khuzhin [Mon, 28 Jul 2014 07:43:23 +0000 (11:43 +0400)]
tune2fs: remove_journal_device(): use the correct block to find jsb
Signed-off-by: Azat Khuzhin <a3at.mail@gmail.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Azat Khuzhin [Mon, 28 Jul 2014 07:43:22 +0000 (11:43 +0400)]
journal: use consts instead of 1024 and add helper for journal with 1k blocksize
Use EXT2_MIN_BLOCK_SIZE, JFS_MIN_JOURNAL_BLOCKS, SUPERBLOCK_SIZE, and
SUPERBLOCK_OFFSET instead of hardcoded 1024 when it is okay, and also
add a helper ext2fs_journal_sb_start() that will return start of
journal sb with special case for fs with 1k block size.
Signed-off-by: Azat Khuzhin <a3at.mail@gmail.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Mon, 28 Jul 2014 19:37:03 +0000 (15:37 -0400)]
tests: add the f_badcluster test
This should have been part of commit
9a1d614df21 ("e2fsck: fix
rule-violating lblk->pblk mappings on bigalloc filesystems") but it
accidentally got dropped when the patch was applied.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Rakesh Pandit [Mon, 28 Jul 2014 00:04:48 +0000 (20:04 -0400)]
filefrag: fix block size value
ioctl(FIGETBSZ) was used to get block size earlier but
2508eaa7
(filefrag: improvements to filefrag FIEMAP handling) moved to fstatfs
f_bsize which doesn't work well for many files systems.
Block size returned using fstatfs isn't block size but "optimal
transfer block size" as per man page. Even stat st_blksize is
"preferred I/O block size" and in may file systems it may even vary
from file to file (POSIX). This patch changes filefrag to use
FIGETBSZ preferentially over f_bsize.
[ Modified by tytso to add the fallback to f_bsize if FIGETBSZ fails
for some reason ]
Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Rakesh Pandit [Sun, 27 Jul 2014 23:56:27 +0000 (19:56 -0400)]
filefrag: fix -B option and extents calculation for FIBMAP
29758d2 broke -B option which is useful for filesystems not supporting
FIEMAP. Also, fix extents calculation for -B which is broken since
2508eaa7.
Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sat, 26 Jul 2014 20:28:58 +0000 (16:28 -0400)]
e2fsck: during pass1b delete_file, only free a cluster once
If we're forced to delete a crosslinked file, only call
ext2fs_block_alloc_stats2() on cluster boundaries, since the block
bitmaps are all cluster bitmaps at this point. It's safe to do this
only once per cluster since we know all the blocks are going away.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Darrick J. Wong [Sat, 26 Jul 2014 00:34:04 +0000 (17:34 -0700)]
e2fsck: fix rule-violating lblk->pblk mappings on bigalloc filesystems
As far as I can tell, logical block mappings on a bigalloc filesystem are
supposed to follow a few constraints:
* The logical cluster offset must match the physical cluster offset.
* A logical cluster may not map to multiple physical clusters.
Since the multiply-claimed block recovery code can be used to fix these
problems, teach e2fsck to find these transgressions and fix them.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>