| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
style(9) cleanups.
Just to reduce some of the issues found with indent(1).
|
|
|
|
|
|
| |
ext2fs: avoid possible overflow when calculating malloc size.
This is inspired on r308064 for the case of mounting UFS.
|
|
|
|
|
|
|
|
|
|
| |
ext2fs: Add defines for some missing ext4 features and inode flags.
These are currently unused in our implementation and some even appear to
have not been implemented yet on linux but it is good to keep them for
reference.
Obtained from: NetBSD
|
|
|
|
|
|
|
| |
ext2fs: make use of the howmany() macro when available.
We have a howmany() macro in the <sys/param.h> header that is
convenient to re-use as it makes things easier to read.
|
|
|
|
|
|
|
|
|
|
|
|
| |
ext2_htree_release(): prevent signed integer overflow in a loop.
h_levels_num, as most data structs in ext2fs, is unsigned so
the index that addresses it has to be unsigned as well.
To get to overflow here we would probably be considering a
degenerate case though.
MFC after: 5 days
|
|
|
|
|
|
|
|
|
| |
ext2fs: replace 0 with NULL for pointers.
While here do late initialization of ebap, similar as was
done in UFS.
Found with devel/coccinelle.
|
|
|
|
|
|
|
| |
Update comment: Linux does set a randomized generation number of an inode
on ext2/3/4. While here use arc4random() instead of random().
Reviewed by: pfg
|
|
|
|
|
|
| |
Update superblock and inode structs for ext4.
Reviewed by: pfg
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ext2: cleanup setting of ctime/mtime/birthtime.
This adopts the same change as r291936 for UFS.
Directly clear IN_ACCESS or IN_UPDATE when user supplied the time, and
copy the value into the inode.
This keeps the behaviour cleaner and is consistent with UFS.
Reviewed by: bde
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ext2fs: Bring back the htree dir_index implementation.
The htree dir_index is perhaps one of the most characteristic
features of the linux ext3 implementation. It was removed
in r281670, due to repeated bug reports.
Damjan Jovanic detected and fixed three bugs and did some
stress testing by building Apache OpenOffice on top of it
so it is now in good shape to bring back.
Differential Revision: https://reviews.freebsd.org/D5007
Submitted by: Damjan Jovanovic
Reviewed by: pfg
RelNotes: yes
|
|
|
|
|
|
|
|
|
|
|
|
| |
ext2fs: Remove panics for rename() race conditions.
Sync with r84642 from UFS:
The panics are inappropriate because the IN_RENAME flag only fixes a
few of the huge number of race conditions that can result in the
source path becoming invalid even prior to the VOP_RENAME() call.
Approved by: re (glebius)
|
|
|
|
|
|
|
|
|
|
|
| |
Revert r294695; passthrough any extra timestamps to the dinode struct.
The original ext2fs change worked fine on disks formated with default
values, but it was the cause of a regression when inodes are small.
Revert it for now, while we figure out safer ways pass such values,
PR: 206820
Approved by: re
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ext2fs: passthrough any extra timestamps to the dinode struct.
In general we don't trust any of the extended timestamps unless the
EXT2F_ROCOMPAT_EXTRA_ISIZE feature is set. However, in the case where
we freshly allocated a new inode the information is valid and it is
better to pass it along instead of leaving the value undefined.
This should have no practical effect but should reduce the amount of
garbage if EXT2F_ROCOMPAT_EXTRA_ISIZE is set, like in cases where the
filesystem is converted from ext3 to ext4.
|
|
|
|
|
|
|
| |
ext4: add support for reading sparse files
Our older GCC can't handle anonymous unions, so
ia64 and powerpc LINT kernels are now failing.
|
|
|
|
|
|
|
|
|
|
|
|
| |
ext4: add support for reading sparse files
Add support for sparse files in ext4. Also implement read-ahead, which
greatly increases the performance when transferring files from ext4.
The sparse file support has become very common in ext4.
Both features implemented by Damjan Jovanovic.
PR: 205816
|
|
|
|
|
|
|
|
|
|
|
| |
ext4: mount panic from freeing invalid pointers
Initialize the struct with those fields to zeroes on allocation,
preventing the panic.
Patch by: Damjan Jovanovic.
PR: 206056
|
|
|
|
|
|
|
|
|
|
| |
ext2fs: reading mmaped file in Ext4 causes panic
Always call brelse(path.ep_bp), fixing reading EXT4 files using mmap().
Patch by Damjan Jovanovic.
PR: 205938
|
|
|
|
|
|
|
|
|
|
| |
ext2: recognize ext4 INCOMPAT_RECOVER flag
This is a flag specific for journalling in ext4.
Add it to the list of ext4 features we ignore for
read-only purposes.
PR: 205668
|
|
|
|
|
|
|
|
|
|
|
| |
File systems that do not use the buffer cache (such as ZFS) must
use VOP_FSYNC() to perform the NFS server's Commit operation.
This patch adds a mnt_kern_flag called MNTK_USES_BCACHE which
is set by file systems that use the buffer cache. If this flag
is not set, the NFS server always does a VOP_FSYNC().
This should be ok for old file system modules that do not set
MNTK_USES_BCACHE, since calling VOP_FSYNC() is correct, although
it might not be optimal for file systems that use the buffer cache.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Drop experimental ext2fs dir_index support.
The htree directory index is a highly desirable feature for research
purposes and was meant to improve performance in our ext2/3 driver.
Unfortunately our implementation has two problems:
- It never really delivered any performance improvement.
- It appears to corrupt the filesystem in undetermined circumstances.
Strictly speaking dir_index is not required for read/write support in
ext2/3 and our limited ext4 support still works fine without it.
Regain stability in the ext2 driver by removing it. We may need it back
(fixed) if we want to support encrypted ext4 support but thanks to the
wonders of version control we can always revert this change and bring it
back.
PR: 191895
PR: 198731
PR: 199309
|
|
|
|
|
|
|
|
|
| |
Initialize the allocation of variables related to the ext2 allocator.
Use malloc to clear the values and initialize e2fs_contigdirs
during allocation. free() e2fs_contigdirs upon error.
While here clean up small style issues.
|
|
|
|
|
|
| |
Reuse value of cursize instead of recalculating.
Reported by: Clang static checker
|
|
|
|
|
|
| |
ext2: Garbage-collect some unused variables
Reported by: clang static analysis
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Remove dead code.
After the ext2 variant of the "orlov allocator" was implemented,
the case for a negative or zero dirsize disappeared.
Drop the dead code and unsign dirsize given that it can't be
negative anyways.
ext2fs: fix for uninitialized pointer read.
path.ep_bp was being used uninitialized in ext4_ext_find_extent().
CID: 1062344
CID: 1008669
|
|
|
|
|
|
| |
ext2: cosmetical issues
Minor sorting and note when the cases are expected to fall through.
|
|
|
|
| |
Handle MAKEENTRY cnp flag in the VOP_CREATE().
|
|
|
|
|
| |
Set NOCACHE flag for CREATE namei() calls, do not specially handle
MAKEENTRY in VOP_LOOKUP().
|
|
|
|
|
|
|
|
| |
ifdef ext2_print_inode which is not really used.
ext2_print_inode was nice to have for initial development work but
is not really used anymore. #ifdef it under a new EXT2FS_DEBUG knob
so that we don't spend time compiling it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ext2fs: Fix old out-of-bounds access.
Overrunning buffer pointed to by (caddr_t)&oip->i_db[0] of 48 bytes by
passing it to a function which accesses it at byte offset 59 using
argument 60UL.
The issue was inherited from an older FFS implementation and
fixed there with by merging UFS2 in r98542. We follow the
FFS fix.
CID: 1007665
Discussed with: bde
|
|
|
|
| |
Do not set IN_ACCESS flag for read-only mounts.
|
|
|
|
|
|
|
|
| |
ext2fs: add ext2_getpages().
Literally copy/pasted from ffs_getpages().
Tested with: fsx
|
|
|
|
|
| |
Check for the cross-device cross-link attempt in the VFS, instead of
VOP_LINK() implemenations.
|
|
|
|
|
|
|
|
| |
ext2fs: Fix a bug when sorting htree entries.
This a typo introduced when bringing the original code from NetBSD.
Reported by: Mike Ma
|
|
|
|
|
|
|
|
|
|
| |
ext2fs: use of tab vs spaces.
Consistently use a single tab after a #define as mentioned in style(9).
Use tabs instead of space for indenting.
Fix a typo: "hash_vesion".
No functional change.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ext2fs: fully enable ext4 read-only support.
The ext4 developers tend to tag Ext4-specific flags as
"incompatible" even when such features are not relevant for
read-only support. This is a consequence of the process
though which this filesystem is implemented without design
and the fact that some new features are not extensible to
ext2/3.
Organize the features according to what we support and sort
them so that we can now read-only mount filesystems with
some features that may be found in newly formatted ext4 fs.
Submitted by: Zheng Liu
|
|
|
|
|
|
|
|
| |
ext2fs: Re-enable reallocblk.
The major corruption issues affecting this code have been fixed.
Tested by: Mike Ma
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ext2fs: Properly the EXT4_EXTENTS and EXT4_INDEX to the inode flags.
In order to support Ext4 extents we need to pass the Ext4 inode flags
without interfering with the chflags. This is better done by using the
i_flag field in the inode and doing proper translation to the linux
ext4 equivalents.
Solve a potential corruption issue in the dirindex code. The dirindex
code can now be renabled as the problems related to it have been
solved.
Suggested by: bde
Tested by: kevlo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ext2fs: fix inode flag conversion.
After r252890 we are naively attempting to pass through the
inode flags. This is technically incorrect as the ext2
inode flags don't match the UFS/system values used in
FreeBSD and a clean conversion is needed.
Some filtering was left in place so the change didn't cause
significant changes in FreeBSD but some of the garbage passed
is likely to be the cause for warning messages in linux.
Fix the issue by resetting the flags before conversion as was
done previously. This also means we will not pass the EXT4_*
inode flags into FreeBSD's inode.
PR: kern/185448
|
|
|
|
|
|
|
|
|
| |
Small ext2fs updates.
Add two new reserved inodes.
Make the hashing algorithm match the linux code.
PR: kern/183230
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make di_blocks unsigned in UFS1 as is the case already for UFS2.
Most of the code between UFS1 and UFS2 is shared so this change
is pretty safe. Not only this makes UFS1 and 2 consistent but it
also matches what NetBSD and MacOS X have for some years now.
UFS2: make di_extsize unsigned.
di_extsize is the EA size and as such it should be unsigned.
Adjust related types for consistency.
Reviewed by: mckusick
|
|
|
|
|
|
|
|
|
|
|
|
| |
Our code does not consider yet the case of hash collisions. This
is a rather annoying situation where two or more files that
happen to have the same hash value will not appear accessible.
The situation is not difficult to work-around but given that things
will just work without enabling htree we will save possible
embarrassments for the next release.
Reported by: Kevin Lo
|
|
|
|
|
|
|
|
|
| |
Previous bandaid was not appropriate and didn't really work for
all platforms. While here, cleanup the surrounding code to match
ffs_checkoverlap()
Reported by: dim, jmallet and bde
MFC after: 3 weeks
|
|
|
|
|
| |
Reported by: Sam Fourman Jr.
MFC after: 3 weeks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add definitions for e2fs_daddr_t, e4fs_daddr_t in addition
to the already existing e2fs_lbn_t and adjust them for ext4.
Other than making the code more readable these changes should
fix problems related to big filesystems.
Setting the proper types can be tricky so the process was
helped by looking at UFS. In our implementation, logical block
numbers can be negative and the code depends on it. In ext2,
block numbers are unsigned so it is convenient to keep
e2fs_daddr_t unsigned and use the complete 32 bits. In the
case of e4fs_daddr_t, while the value should be unsigned, for
ext4 we only need to support 48 bits so preserving an extra
bit from the sign is not an issue.
While here also drop the ext2_setblock() prototype that was
never used.
Discussed with: mckusick, bde
MFC after: 3 weeks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Basic support for extents was implemented by Zheng Liu as part
of his Google Summer of Code in 2010. This support is read-only
at this time.
In addition to extents we also support the huge_file extension
for read-only purposes. This works nicely with the additional
support for birthtime/nanosec timestamps and dir_index that
have been added lately.
The implementation may not work for all ext4 filesystems as
it doesn't support some features that are being enabled by
default on recent linux like flex_bg. Nevertheless, the feature
should be very useful for migration or simple access in
filesystems that have been converted from ext2/3 or don't use
incompatible features.
Special thanks to Zheng Liu for his dedication and continued
work to support ext2 in FreeBSD.
Submitted by: Zheng Liu (lz@)
Reviewed by: Mike Ma, Christoph Mallon (previous version)
Sponsored by: Google Inc.
MFC after: 3 weeks
|
|
|
|
| |
MFC after: 3 days
|
|
|
|
|
|
|
|
|
|
| |
The htree implementation uses code derived from the
RSA Data Security, Inc. MD4 Message-Digest Algorithm.
Add a proper licensing statement for the code and clarify
the corresponding comments.
Approved by: core (hrs)
|
|
|
|
|
|
|
| |
While here drop old comment that doesn't really apply.
MFC after: 1 month
Discussed with: gleb
|
|
|
|
| |
MFC after: 1 month
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
as in <sys/dirent.h>
ext2_readdir() has always been very fs specific and different
with respect to its ufs_ counterpart. Recent changes from UFS
have made it possible to share more closely the implementation.
MFUFS r252438:
Always start parsing at DIRBLKSIZ aligned offset, skip first entries if
uio_offset is not DIRBLKSIZ aligned. Return EINVAL if buffer is too
small for single entry.
Preallocate buffer for cookies.
Skip entries with zero inode number.
Reviewed by: gleb, Zheng Liu
MFC after: 1 month
|