aboutsummaryrefslogtreecommitdiff
path: root/sys/fs/ext2fs
Commit message (Collapse)AuthorAgeFilesLines
* ext2fs: Use __sdt_used for variables only used by SDT probesJohn Baldwin2026-02-091-5/+1
| | | | | Reviewed by: imp, markj Differential Revision: https://reviews.freebsd.org/D55164
* vfs: retire the VREF macroMateusz Guzik2025-09-272-4/+4
| | | | | | | | | | | | It is defined as a plain use of vref. Churn generated with coccinelle: @@ expression vp; @@ - VREF(vp) + vref(vp)
* vfs: retire the NULLVP macroMateusz Guzik2025-09-271-2/+2
| | | | | | | | | | | | The kernel was already mostly using plain NULL, just whack it and be doen with the legacy. Churn generated with coccinelle: @@ @@ - NULLVP + NULL
* ext2fs: Set st_rdev to NODEV when not a deviceDag-Erling Smørgrav2025-08-171-1/+1
| | | | | Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51955
* vfs: Introduce VN_ISDEV() macroDag-Erling Smørgrav2025-08-171-7/+7
| | | | | | | | | | | | | | We frequently need to check if a vnode refers to either a character or block special, so we might as well have a macro for it. We somewhat less frequently need to perform similar checks on things that aren't vnodes (usually a struct vattr *), so add VATTR_ISDEV() and a generic VTYPE_ISDEV() as well. Sponsored by: Klara, Inc. Sponsored by: NetApp, Inc. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D51947
* ext2fs: 'struct ufid': Re-order fields and unpackOlivier Certner2024-12-131-5/+5
| | | | | | | | | | | | Re-ordering the fields suppresses the trailing padding which was causing the structure to overflow 'struct fid'. While here, re-indent in a more visually pleasing way. Reviewed by: rmacklem, emaste, markj Approved by: markj (mentor) MFC after: 5 days Differential Revision: https://reviews.freebsd.org/D47955
* ext2fs: Fix the size of struct ufid and add a static assertRick Macklem2024-12-062-1/+3
| | | | | | | | | | | File system specific *fid structures are copied into the generic struct fid defined in sys/mount.h. As such, they cannot be larger than struct fid. This patch packed the structure and checks via a __Static_assert(). Reviewed by: markj MFC after: 2 weeks
* ext4_ext_tree_init: correct memset initializationRyan Libby2024-06-251-1/+1
| | | | | | | | | gcc -Wmemset-elt-size diagnosed this. The code was only initializing 1/4 of the array. However, it was actually harmless, as the only caller had done an M_ZERO allocation anyway. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D45701
* Stop treating size 0 as unknown size in vnode_create_vobject().Pawel Jakub Dawidek2024-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | Whenever file is created, the vnode_create_vobject() function will try to determine its size by calling vn_getsize_locked() as size 0 is ambigious: it means either the file size is 0 or the file size is unknown. Introduce special value for the size argument: VNODE_NO_SIZE. Only when it is given, the vnode_create_vobject() will try to obtain file's size on its own. Introduce dedicated vnode_disk_create_vobject() for use by g_vfs_open(), so we don't have to call vn_isdisk() in the common case (for regular files). Handle the case of mediasize==0 in g_vfs_open(). Reviewed by: alc, kib, markj, olce Approved by: oshogbo (mentor), allanjude (mentor) Differential Revision: https://reviews.freebsd.org/D45244
* sys: Remove ancient SCCS tags.Warner Losh2023-11-2712-25/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* Fix build with gcc12.Navdeep Parhar2023-10-271-0/+6
|
* sys: Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-1613-13/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-1613-26/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* ext2fs: Add large sectorsize disks supportFedor Uporov2023-05-212-24/+30
| | | | | | | | | | | | | | The ext2fs does not support disks with sectorsize more 512 bytes. The main issue is in reading/writing superblock, which is not aligned with 4k value. Reimplement the superblock reading logic to make it indifferent to disk logical sector size. The logical sector size more then page size is not supported, like it is doing on Linux side. PR: 271105 Reported by: k(at)vodka.home.kg Reviewed by: pfg MFC after: 2 week Differential Revision: https://reviews.freebsd.org/D40047
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-1213-13/+13
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* ext2fs: extract crc16 into sys/crc16.hVal Packett2023-04-241-50/+5
| | | | | | | | | deduplicate this as it might be needed for other drivers (e.g. Apple SPI-HID) Sponsored by: https://www.patreon.com/valpackett Reviewed by: chuck, imp MFC after: 1 month Differential revision: https://reviews.freebsd.org/D32879
* Fix compilation issue, when DTRACE is not definedFedor Uporov2023-03-201-4/+1
| | | | | | PR: 270346 Reported by: Michael Paepcke MFC after: 2 week
* ext2_dirbad(): fix !DTRACE buildKonstantin Belousov2023-03-201-1/+1
| | | | | | Fixes: 3c2dc524c333747a8c5deb3f0f88b29a8e36dff4 Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* Do not panic in case of corrupted directoryFedor Uporov2023-03-182-9/+14
| | | | | | | | | | | The panic() will be called under ext2_dirbad() function in case of rw mount. It cause user confusion, like in BZ 265951. PR: 265951 Reviewed by: pfg, mckusick MFC after: 2 week Differential revision: https://reviews.freebsd.org/D38503
* Add root directory entry check.Fedor Uporov2023-03-181-0/+7
| | | | | | | | | | | | | Add check that directory entry with ino=EXT2_ROOTINO have correct namelength and name. It is possible to create malicious image which will cause panic if root directory entry have incorrect name. PR: 259068 Reported by: Robert Morris Reviewed by: pfg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D38502
* Fix block bitmap end position computationFedor Uporov2023-01-291-1/+1
| | | | | | PR: 261850 Reported by: chenguang.wang MFC after: 2 weeks
* Stop cleaning MNT_LOCAL on unmountKonstantin Belousov2023-01-141-3/+0
| | | | | | | | | | There is no point in clearing just this flag. Flags are reset on the struct mount re-allocation for reuse anyway. Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37966
* Fix vop_readdir's ncookies handling in UFS and EXT2.Kirk McKusick2023-01-021-1/+1
| | | | | | Submitted by: Kusumi Tomohiro PR: 267706 MFC after: 1 week
* vfs: add the concept of vnode state transitionsMateusz Guzik2022-12-262-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | To quote from a comment above vput_final: <quote> * XXX Some filesystems pass in an exclusively locked vnode and strongly depend * on the lock being held all the way until VOP_INACTIVE. This in particular * happens with UFS which adds half-constructed vnodes to the hash, where they * can be found by other code. </quote> As is there is no mechanism which allows filesystems to denote that a vnode is fully initialized, consequently problems like the above are only found the hard way(tm). Add rudimentary support for state transitions, which in particular allow to assert the vnode is not legally unlocked until its fate is decided (either construction finishes or vgone is called to abort it). The new field lands in a 1-byte hole, thus it does not grow the struct. Bump __FreeBSD_version to 1400077 Reviewed by: kib (previous version) Tested by: pho Differential Revision: https://reviews.freebsd.org/D37759
* vfs: make relookup take an additional argumentMateusz Guzik2022-12-191-2/+2
| | | | | | | | | | instead of looking at SAVESTART This is a step towards removing the flag. Reviewed by: mckusick Tested by: pho Differential Revision: https://reviews.freebsd.org/D34468
* ext2fs: fix potential memory leak in ext4_ext_grow_indepth()Pedro F. Giffuni2022-12-171-2/+6
| | | | PR: 265071
* Tree-wide replacement of VOP_UNLOCK + vrele combo with vputMateusz Guzik2022-11-071-6/+3
| | | | No functional changes.
* filesystems: return error from vn_rlimit_fsize() instead of EFBIGKonstantin Belousov2022-09-241-2/+3
| | | | | | | | Reviewed by: asomers, jah, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D36625
* vfs: always retain path buffer after lookupMateusz Guzik2022-09-172-25/+0
| | | | | | | | This removes some of the complexity needed to maintain HASBUF and allows for removing injecting SAVENAME by filesystems. Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D36542
* ext2: plug a set-but-not-used varMateusz Guzik2022-04-191-0/+4
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* vfs: NDFREE(&nd, NDF_ONLY_PNBUF) -> NDFREE_PNBUF(&nd)Mateusz Guzik2022-03-241-1/+1
|
* vfs: prefix lookup and relookup with vfs_Mateusz Guzik2022-03-131-2/+2
| | | | | Reviewed by: imp, mckusick Differential Revision: https://reviews.freebsd.org/D34530
* fs: fix a few common typos in source code commentsGordon Bergling2022-02-061-3/+3
| | | | | | | | - s/quadradically/quadratically/ - s/persistant/persistent/ Obtained from: NetBSD MFC after: 3 days
* ext2fs: remove remnants of the UFS snapshot codeKonstantin Belousov2022-01-312-13/+2
| | | | | | | Noted and reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D34095
* Improve extents verification logicFedor Uporov2021-12-302-75/+224
| | | | | | | | | | | | | Add functionality for extents validation inside the filesystem extents block. The main logic is implemented under ext4_validate_extent_entries() function, which verifies extents or extents indexes depending of extent depth value. PR: 259112 Reported by: Robert Morris Reviewed by: pfg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D33375
* Add more accurate check for root inodeFedor Uporov2021-12-301-9/+10
| | | | | | | | Check that root inode has links and is directory. PR: 259105 Reported by: Robert Morris MFC after: 2 weeks
* Add more accurate directory entries checkFedor Uporov2021-12-301-29/+10
| | | | | | | | | | | | Rename ext2_dirbadentry() to ext2_check_direntry(). Add directory entry inode value check, and call ext2_check_direntry() in all cases. The dirchk sysctl is removed. PR: 259024,259041 Reported by: Robert Morris Reviewed by: pfg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D33374
* Remove unnecessary e2fs_first_dblock value checkFedor Uporov2021-12-301-7/+0
| | | | MFC after: 2 weeks
* Change VOP_READDIR's cookies argument to a **uint64_tAlan Somers2021-12-161-1/+1
| | | | | | | | | | | | | The cookies argument is only used by the NFS server. NFSv2 defines the cookie as 32 bits on the wire, but NFSv3 increased it to 64 bits. Our VOP_READDIR, however, has always defined it as u_long, which is 32 bits on some architectures. Change it to 64 bits on all architectures. This doesn't matter for any in-tree file systems, but it matters for some FUSE file systems that use 64-bit directory cookies. PR: 260375 Reviewed by: rmacklem Differential Revision: https://reviews.freebsd.org/D33404
* ext2: Check for e2fs_first_dblock in ext2_compute_sb_data()Neel Chauhan2021-11-291-1/+9
| | | | | | | | This prevents a kernel panic on a damaged ext2 superblock. PR: 259107 Reported by: Robert Morris <rtm@lcs.mit.edu> Differential Revision: https://reviews.freebsd.org/D33029
* vfs: remove the unused thread argument from NDINIT*Mateusz Guzik2021-11-251-1/+1
| | | | | | See b4a58fbf640409a1 ("vfs: remove cn_thread") Bump __FreeBSD_version to 1400043.
* ext2: plug set-but-not-used varsMateusz Guzik2021-11-241-8/+0
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* ext2fs: check for eh_depth in ext4_ext_check_header()Neel Chauhan2021-11-181-0/+4
| | | | | | | | PR: 259112 Reported by: Robert Morris <rtm@lcs.mit.edu> Reviewed by: fsu MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D33030
* vfs: remove cn_threadMateusz Guzik2021-10-112-9/+9
| | | | | | | It is always curthread. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D32453
* vfs: remove dead fifoop VOP_KQFILTER implementationsKyle Evans2021-10-031-18/+0
| | | | | | | | | | | These began to become obsolete in d6d64f0f2c26 (r137739) and the deal was later sealed in 003e18aef4c4 (r137801) when vfs.fifofs.fops was dropped and vop-bypass for pipes became mandatory. PR: 225934 Suggested by: markj Reviewe by: kib, markj Differential Revision: https://reviews.freebsd.org/D32270
* ext2fs(5): Correct a typo in an error messageGordon Bergling2021-08-221-1/+1
| | | | | | - s/talbes/tables/ MFC after: 1 week
* ext2: add missing uio_td initialization to ext2_htree_append_blockMateusz Guzik2021-05-301-0/+1
| | | | Reported by: pho
* Move mnt_maxsymlinklen into appropriate fs mount data structuresKonstantin Belousov2021-05-224-5/+7
| | | | | | | | | Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week X-MFC-Note: struct mount layout Differential revision: https://reviews.freebsd.org/D30325
* Make encode/decode extra time functions inline.Fedor Uporov2021-05-081-2/+2
| | | | | Mentioned by: pfg MFC after: 2 weeks
* Make inode extra time fields updating logic more closer to linux.Fedor Uporov2021-05-072-19/+43
| | | | | | | | | Found using pjdfstest: pjdfstest/tests/utimensat/09.t Reviewed by: pfg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29933