Commit Graph

1486 Commits (d6adf070b0e85f209c0d7f310188b134b5cb7180)

Author SHA1 Message Date
Theodore Ts'o 0da058af9f mke2fs.conf: don't enable metadata_csum by default
For the 1.43 release, we will not be enabling the metadata_csum
feature by default.  We will leave that up to distribution vendors to
decide whether they want to be aggressive about enabling this feature
by default.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-17 01:32:58 -04:00
Theodore Ts'o 051fd4e028 misc: fix various Coverity warnings
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-17 00:53:47 -04:00
Marcus Huewe 0935fa8da3 e2undo: support the undo header's fs_offset feature
If the fs_offset feature is present (and no "-o offset"
option is specified), e2undo performs the undo operation at
the stored offset.

Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-12 15:36:39 -04:00
Marcus Huewe 6930537d52 e2undo: add "-o offset" option to specify the filesystem offset
This is useful if the filesystem is located at an arbitrary
offset instead of the beginning of a device or file.

Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-12 15:36:00 -04:00
Marcus Huewe dc01088db5 mke2fs: fix filesystem size calculation, if an offset is specified
If a filesystem size is explicitly specified, it should be used without
subtracting the offset.

Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-12 15:25:14 -04:00
Theodore Ts'o b8d0b0e1f6 fuse2fs.1: fix man page section of fuse2fs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-12 00:02:07 -04:00
Theodore Ts'o d0e855fa47 misc: avoid PATH_MAX dependency in create_inode.c
Addresses-Debian-Bug: #822576

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-11 00:08:58 -04:00
Theodore Ts'o f9b16db868 More man page and usage message fixups
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-10 23:23:14 -04:00
Theodore Ts'o a039df9c4a mke2fs: support multiple -O options
Some users will get confused and try to specify multiple -O options.
So teach mke2fs to treat "-O feature1 -O feature2" as
"-O feature1,feature2".

https://bugzilla.kernel.org/show_bug.cgi?id=117421

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-10 17:41:08 -04:00
Theodore Ts'o bc8f1ae523 Fix various man pages and usage message
Thanks to pete@lyptonyx for doing a close pass editing of e2fsprogs's
man pages.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-08 22:18:51 -04:00
Theodore Ts'o a195e862ca mke2fs: fix the parsing used for -E quotatype=usrquota:grpquota:prjquota
Commit 2d2d799c72 tried to use parse_quota_options(), which uses
commas to separate out the quota types.  Unfortunately, when parsing
extended options, commands are used to separate different extended
options.

To fix this, I've add a new support function parse_quota_type(), which
allows either commas or colons to used as a separator character, and
which manipulates a bit field to indicate which quota types should be
enabled.  Eventually tune2fs should be converted to use
parse_quota_type() as well, thus obsoleting parse_quota_options(), but
that's a more complicated cleanup patch for later.

Fix a lint warning which could the number of blocks to be incorretly
printed if it exceeds 2**32.

Also fix some typos and other minor bugs in the usage message.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-08 21:25:55 -04:00
Theodore Ts'o 1973233e53 e4crypt: remove debugging code which broke the set_policy subcommand
Also fixed some spelling typos in help messages.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-06 23:38:33 -04:00
Theodore Ts'o 87d9b2fb9e mke2fs: adjust the default file system size by the offset
If the user specifies an offset using -E offset without specifying an
explicit size, the system will use the block device (or file) size as
the default file system size.  If we are using the default file system
size, subtract out the offset so the resulting file system will stay
within the block device.  Also print a warning that this might not be
what the user wants.

Addresses-Debian-Bug: #803629

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-05-01 00:57:19 -04:00
Theodore Ts'o a7dc56f45e mke2fs.8, badblocks.8: fix spelling errors and other miscellaneous typos
Reported-by: Pete <pete@leptonyx.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-04-30 22:00:54 -04:00
Darrick J. Wong 8feb6f439a fuse2fs: delete unused variables
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-04-25 14:53:24 -04:00
Darrick J. Wong 7dd0dfca04 e2image: ignore checksum errors
Since e2image is used to capture broken fs images for debugging,
ignore checksum errors when creating the image.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-04-25 11:03:09 -04:00
Theodore Ts'o 1fc23b5e77 Fix support for configure --enable-jbd-debug
We haven't used this in a while, so it's bitrotted a bit.  Fix it up
so that it works correctly.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-04-15 19:01:38 -04:00
Theodore Ts'o 4ea40c0bc2 Merge branch 'maint' into next 2016-04-15 11:33:30 -04:00
Eric Sandeen be5ce27525 e2image: don't leak progress info to stdout
Commit c8ee0d60 fixed most of these, but missed this one.

# e2image -r -p <device> - > imagefile

leads to a corrupted image due to the "Scanning inodes..."
printf going to stdout.

Reported-by: Alex Markley <alex@malexmedia.net>
Addresses-Red-Hat-Bugzilla: #1327329
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-04-15 10:59:02 -04:00
Marcus Huewe cba3fd5ca1 mke2fs: fix for the "-E offset=N" option
Configure the io channel with the specified offset before
calling mke2fs_discard_device(). Otherwise the data before offset
is discarded.

Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-26 22:26:40 -04:00
Theodore Ts'o 31ddef52ba Fix warnings caused by glibc 2.20
Glibc has depcreated _SVID_SOURCE and _BSD_SOURCE in favor of
_DEFAULT_SOURCE.  So define _DEFAULT_SOURCE to shut up glibc 2.20

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-21 13:05:25 -04:00
Theodore Ts'o 25040c0431 chattr: fix verbose message while setting the project id
This was caused by a cut and paste error.  (Thanks to Coverity for
pointing this out).

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-18 16:49:51 -04:00
Theodore Ts'o 9c05bb9fba tune2fs: don't include journal recovery when building for Android
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-18 16:07:34 -04:00
Theodore Ts'o dd9a866b08 fuse2fs.1: add manual page for fuse2fs
Also add libfuse-dev to the Debian build depends so that fuse2fs gets
built for Debian.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-18 15:23:35 -04:00
Theodore Ts'o 82e48fb163 Fix various clang and gcc -Wall warnings
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-18 12:45:19 -04:00
Alex Deymo 205593f65b Android.mk: Replace _host suffix with more standard -host suffix
Most libraries use the "-host" suffix when building for the host. This
patch renames all the libraries to use -host instead of _host.

Addresses-Google-Bug: #24619596
TEST=make dist

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-15 01:25:11 -04:00
Alex Deymo 5eeb0cca33 libext2fs: export the library include path
When adding 'libext2fs' as a library dependency from any other binary,
the binary needs to find the library headers. Users of this library
should not hard-code the include path themselves. This patch exports the
library headers on all three version of the libext2fs library and
removes the redundant include path from executables in e2fsprogs.

Addresses-Google-Bug: #23084776
TEST=mma

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-14 18:39:48 -04:00
Tao Bao 4ccb2366d8 Wrap tune2fs.h to be C++ compatible
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-14 18:38:26 -04:00
Theodore Ts'o 69df84967f fuse2fs: improve command-line parsing
Use libfuse's command line parsing, which is much more powerful and
flexible than what we had before, and to allow the user to have more
fine-grained control over FUSE's run-time options.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-12 02:13:34 -05:00
Theodore Ts'o dcb8e1fa04 Merge branch 'maint' into next 2016-03-06 20:37:49 -05:00
Darrick J. Wong c864b9eb50 tune2fs: recover the journal
If the journal needs to be recovered to avoid clobbering whatever
changes tune2fs makes, do so.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 20:08:53 -05:00
Darrick J. Wong 62e0d34b51 tune2fs: confirm dangerous operations
Give admins a short amount of time to confirm that they want to
proceed with a dangerous operation.  Refuse to perform the op
unless the filesystem is freshly checked.

Cc: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 20:08:53 -05:00
Darrick J. Wong 84244683c0 filefrag: accommodate holes when calculating expected values
Currently, filefrag's "expected physical block" column expects extent
records to be physically adjacent regardless of the amount of logical
block space between the two records.  This means that if we punch a
hole in a file, we get reports like this:

ext:   logical_offset:   physical_offset: length:  expected: flags:
4:     4096..    8343:   57376..  61623:   4248:
5:     8345..   10313:   61625..  63593:   1969:   61624:

Notice how it expects 8345 to map to 61624, and scores this against
the fragmentation of the file.  Flagging this as "unexpected" is
incorrect because the gap in the logical mapping is exactly the same
size as the gap in the physical extents.

Furthermore, this particular mapping leaves the door open to the
optimal mapping -- if a write to block 8344 causes it to be mapped to
61624, the entire range 4096-10313 can be mapped with a single extent.
Until that happens, there's no way to combine extents 4 and 5 because
of the gap in the logical mapping at block 8344.

Therefore, tweak the extent report to account for holes.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 20:08:53 -05:00
Darrick J. Wong 1b7623b822 mke2fs: store checksum seed at format time
Allow users to turn on metadata_csum_seed at format time so that UUIDs
can be live-changed at any time.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 20:08:53 -05:00
Darrick J. Wong 2be9cd8655 tune2fs: allow user to turn on saving the checksum seed
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 20:08:52 -05:00
Li Xi 3627e83830 Add project ID support for chattr/lsattr
Chattr and lsattr can be used to set or get project ID:
chattr -p <project id> file
lsattr -p file

Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 20:08:45 -05:00
Andreas Dilger ba60bb903f findsuper: improve output if s_mkfs_time unset
If s_mkfs_time is not set in the superblock, print the s_mtime field
instead to identify the different superblocks.  This can happen if the
superblock is corrupted, since s_mkfs_time is not reset by e2fsck.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 18:16:04 -05:00
Andreas Dilger 1e3f5c889d lsattr: treat inode generation as an unsigned int
The EXT2_GETVERSION ioctl is defined to take a "long" parameter, but
fgetversion() calls ioctl() with an "int" parameter instead.  This is
handled in the kernel correctly, but the generation is sign-extended
in fgetversion() before return on 64-bit systems and lsattr prints
it as a huge positive number for inode generation above 0x80000000:

        1635574212 -------------e-- /mnt/ost0/O/0/d0/12928
        18446744073045131735 -------------e-- /mnt/ost0/O/0/d0/166240
        782808861 -------------e-- /mnt/ost0/O/0/d0/31744
        18446744072181134840 -------------e-- /mnt/ost0/O/0/d0/135008

Correctly assign the returned generation number as an unsigned value,
and print it with a 10-character field width.  The version is printed
left-aligned for consistency with the old code and to ensure it is
always printed in the first column for use with tools like "cut":

        1635574212 -------------e-- /mnt/ost0/O/0/d0/12928
        3630547415 -------------e-- /mnt/ost0/O/0/d0/166240
        782808861  -------------e-- /mnt/ost0/O/0/d0/31744
        2766550520 -------------e-- /mnt/ost0/O/0/d0/135008

Do not return a random value from the stack as the version on error.
Clean up some style issues and consolidate some duplicate code.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 18:12:57 -05:00
Andreas Dilger 7fd5374012 misc: add missing declarations on maint
Fix compile warnings for missing declarations on the maint branch.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 18:12:06 -05:00
Li Xi e1cec4464b Add inherit flags for project quota
This patch add EXT4_PROJINHERIT_FL to enable inherit feature for
project ID. If an directory has its inherit flag set, all its
newly created children will inherit its project ID. Conversely,
new inodes will get a default project ID (i.e. zero). Also, no
hard link or rename is permitted if the directory and child has
different project ID.

Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 17:33:45 -05:00
Li Xi 080e09b46f Add project quota support
This patch adds project quota support. An new quota type PRJQUOTA(2)
is added. EXT4_PRJ_QUOTA_INO(11) is reserved for project quota inode.
The super block reservers an field s_prj_quota_inum for saving
project quota inode. And each inode adds an internal field i_projid
for saving its project ID.

Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 17:33:39 -05:00
Li Xi 0c18d0368a Add project feature flag EXT4_FEATURE_RO_COMPAT_PROJECT
This patch add project feature flag EXT4_FEATURE_RO_COMPAT_PROJECT.
Project feature is a read-only compat feature. Thus, an ext4 file
system with project feature enabled could only be read by ext4
kernel module without project feature support.

Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 15:56:28 -05:00
Li Xi 2d2d799c72 Clean up codes for adding new quota type
Project quota related fields are reserved in Linux kernel.
As a preparation for it, this patch cleans up quota codes
of e2fsprogs so as to make it easier to add new quota type(s).

Signed-off-by: Li Xi <lixi@ddn.com>
Signed-off-by: Wang Shilong <wshilong@ddn.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-03-06 15:56:24 -05:00
Theodore Ts'o 0355d6d047 Fix build system to be compatible with BSD pmake
This fixes a number of incompatibilities which caused maint branch to
fail to build on on FreeBSD.  Also fix the Makefile in the tests
directory so that "make -jN check" works correctly on FreeBSD.

Previously the Makefile in the tests directory used a construct which
was specific to GNU Make, which which silently expanded to an empty
list, which caused "make check" to be a no-op when running using BSD's
pmake.  This Makefile has been changed to use the != macro assignment
syntax which is common to GNU make and BSD pmake.  It's technically
not completely portable (it will not be recognized by Solaris's ccs
make, for example), but most other operating systems ship GNU make
(Solaris, AIX), or BSD pmake (*BSD, Mac OS) as either the primary or
alternative make utility that this should an acceptable compromise,
since it makes running all of tests using something like "make -j8
check" or "make -j16 check" run *much* faster.

There are still some caveats if using BSD pmake; in particular, if the
configure script is run on a system which has GNU make (installed as
gmake on FreeBSD for example), the configure script will find it, and
enable some GNU make features in the Makefile, and the generated
makefiles *must* be built using gmake.  However, if isolated build
jail / chroot is used which only has pmake, the Makefiles should now
work with pmake.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-01-02 01:29:55 -05:00
Andreas Dilger 0f26747167 mke2fs: sort "-d" option alphabetically
Move the mke2fs "-d" option to be alphabetical like other options.

Rename "root_dir" to "src_root_dir" to avoid confusion with the
actual root inode in the new filesystem.

Signed-off-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-11-30 18:30:11 -05:00
Darrick J. Wong f150bdec8c fuse2fs: set inode's uid/gid when creating inode
When creating a file in op_create, set the file's uid and gid to the
user's uid and gid.  Do the same in op_mknod.

Reported-by: Lennart Lövstrand <lennart@lovstrand.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-11-30 18:28:42 -05:00
Theodore Ts'o 94676ef2b3 Merge branch 'maint' into next 2015-11-30 18:16:36 -05:00
Jim Garlick c5b3ae7fb5 tune2fs: warn if the filesystem journal is dirty
Running tune2fs on a filesystem with an unrecovered journal can
cause the tune2fs settings changes in the superblock to be reverted
when the journal is replayed if it contains an uncommitted copy of
the superblock.  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>

Updated message printed to include steps to replay journal.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-11-30 12:13:39 -05:00
Jan Kara 5cb290e233 chattr: fix typo in a manpage
Signed-off-by: Jan Kara <jack@suse.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-11-30 11:56:59 -05:00
Matthieu Dupont 79ffbf251e make2fs: parse a human readable inode ratio for the -i option
Signed-off-by: Matthieu Dupont <matt.59491@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-11-15 20:05:44 -05:00