summaryrefslogtreecommitdiffstats
path: root/sys/fs/ext2fs
Commit message (Collapse)AuthorAgeFilesLines
* MFC r310705, r310706:pfg2017-01-0420-270/+286
| | | | | | style(9) cleanups. Just to reduce some of the issues found with indent(1).
* MFC r309179:pfg2016-12-031-1/+2
| | | | | | ext2fs: avoid possible overflow when calculating malloc size. This is inspired on r308064 for the case of mounting UFS.
* MFC r303799, r303800:pfg2016-09-062-0/+15
| | | | | | | | | | 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
* MFC r298609:pfg2016-05-101-4/+4
| | | | | | | 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.
* MFC r298518:pfg2016-04-281-1/+1
| | | | | | | | | | | | 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
* MFC r297796:pfg2016-04-251-1/+2
| | | | | | | | | ext2fs: replace 0 with NULL for pointers. While here do late initialization of ebap, similar as was done in UFS. Found with devel/coccinelle.
* MFC r297479, r297695:kevlo2016-04-142-6/+4
| | | | | | | 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
* MFC r297335:kevlo2016-04-012-17/+47
| | | | | | Update superblock and inode structs for ext4. Reviewed by: pfg
* MFC r295811:pfg2016-03-191-5/+3
| | | | | | | | | | | | 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
* MFC r294504, r294652, r294653, r294655:pfg2016-03-1711-120/+1498
| | | | | | | | | | | | | | | | | | 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
* MFC r295616:pfg2016-02-171-5/+8
| | | | | | | | | | | | 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)
* MFC r295209;pfg2016-02-061-5/+7
| | | | | | | | | | | 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
* MFC r294695:pfg2016-01-281-7/+5
| | | | | | | | | | | | | 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.
* Revert r294271:pfg2016-01-224-80/+34
| | | | | | | ext4: add support for reading sparse files Our older GCC can't handle anonymous unions, so ia64 and powerpc LINT kernels are now failing.
* MFC r293680pfg2016-01-184-34/+80
| | | | | | | | | | | | 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
* MFC r293683:pfg2016-01-141-1/+1
| | | | | | | | | | | 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
* MFC r293370:pfg2016-01-101-6/+13
| | | | | | | | | | 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
* MFC r292872:pfg2016-01-061-0/+3
| | | | | | | | | | 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
* MFC: r281562rmacklem2015-04-301-1/+2
| | | | | | | | | | | 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.
* MFC r281670, r281703:pfg2015-04-227-1492/+115
| | | | | | | | | | | | | | | | | | | | | | | 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
* MFC r278790, r278802:pfg2015-02-221-5/+6
| | | | | | | | | 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.
* MFC r278791:pfg2015-02-221-1/+1
| | | | | | Reuse value of cursize instead of recalculating. Reported by: Clang static checker
* MFC r277354, r277365:pfg2015-02-027-13/+7
| | | | | | ext2: Garbage-collect some unused variables Reported by: clang static analysis
* MFC r277340, r277349:pfg2015-01-282-7/+4
| | | | | | | | | | | | | | | 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
* MFC r277301:pfg2015-01-241-2/+5
| | | | | | ext2: cosmetical issues Minor sorting and note when the cases are expected to fall through.
* MFC r276007:kib2015-01-041-1/+3
| | | | Handle MAKEENTRY cnp flag in the VOP_CREATE().
* MFC r275897:kib2015-01-011-1/+1
| | | | | Set NOCACHE flag for CREATE namei() calls, do not specially handle MAKEENTRY in VOP_LOOKUP().
* MFC r274437;pfg2014-12-233-2/+6
| | | | | | | | 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.
* MFC r275645;pfg2014-12-161-6/+16
| | | | | | | | | | | | | | | 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
* MFC r272952:kib2014-10-181-1/+1
| | | | Do not set IN_ACCESS flag for read-only mounts.
* MFC r271467, r271468:pfg2014-10-041-2/+47
| | | | | | | | ext2fs: add ext2_getpages(). Literally copy/pasted from ffs_getpages(). Tested with: fsx
* MFC r268764:kib2014-07-301-4/+0
| | | | | Check for the cross-device cross-link attempt in the VFS, instead of VOP_LINK() implemenations.
* MFC r262869:pfg2014-03-091-1/+1
| | | | | | | | ext2fs: Fix a bug when sorting htree entries. This a typo introduced when bringing the original code from NetBSD. Reported by: Mike Ma
* MFC r262623, r262667:pfg2014-03-0418-221/+219
| | | | | | | | | | 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.
* MFC r262346:pfg2014-02-272-6/+14
| | | | | | | | | | | | | | | | | 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
* MFC r261136:pfg2014-01-311-2/+2
| | | | | | | | ext2fs: Re-enable reallocblk. The major corruption issues affecting this code have been fixed. Tested by: Mike Ma
* MFC r260988, r261034, r261120, r261235:pfg2014-01-319-26/+35
| | | | | | | | | | | | | | | | 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
* MFC r260545:pfg2014-01-141-2/+2
| | | | | | | | | | | | | | | | | | | 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
* MFC r258904, r259780:pfg2013-12-262-2/+4
| | | | | | | | | Small ext2fs updates. Add two new reserved inodes. Make the hashing algorithm match the linux code. PR: kern/183230
* MFC r256448, r257029;pfg2013-12-111-1/+1
| | | | | | | | | | | | | 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
* ext2fs: temporarily disable htree directory index.pfg2013-09-072-0/+4
| | | | | | | | | | | | 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
* ext2fs: update format specifiers for ext4 type.pfg2013-08-141-4/+4
| | | | | | | | | 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
* ext2fs: update format specifiers for ext4 type.pfg2013-08-131-1/+1
| | | | | Reported by: Sam Fourman Jr. MFC after: 3 weeks
* Define ext2fs local types and use them.pfg2013-08-138-44/+48
| | | | | | | | | | | | | | | | | | | | | | 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
* Add read-only support for extents in ext2fs.pfg2013-08-1211-29/+561
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Small typo.pfg2013-08-081-1/+1
| | | | MFC after: 3 days
* Add license for the half MD4 algorithm used in ext2_half_md4().pfg2013-08-011-5/+29
| | | | | | | | | | 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)
* ext2fs: Return EINVAL for negative uio_offset as in UFS.pfg2013-07-251-8/+2
| | | | | | | While here drop old comment that doesn't really apply. MFC after: 1 month Discussed with: gleb
* ext2fs: Drop a check that wan't supposed to be in r253651.pfg2013-07-251-4/+1
| | | | MFC after: 1 month
* ext2fs: Don't assume that on-disk format of a directory is the samepfg2013-07-251-81/+99
| | | | | | | | | | | | | | | | | | | | 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
OpenPOWER on IntegriCloud