#
45d4e82b |
| 09-Aug-2024 |
Stefan Eßer <se@FreeBSD.org> |
msdosfs: fix cluster limit when mounting FAT-16 file systems
The maximum cluster number was calculated based on the number of data cluters that fit in the givem partition size and the size of the FA
msdosfs: fix cluster limit when mounting FAT-16 file systems
The maximum cluster number was calculated based on the number of data cluters that fit in the givem partition size and the size of the FAT area. This limit did not take into account that the highest 10 cluster numbers are reserved and must not be used for files.
PR: 280347 MFC after: 3 days Reported by: pho@FreeBSD.org
show more ...
|
Revision tags: release/14.1.0, release/13.3.0 |
|
#
4b3ffc59 |
| 20-Jan-2024 |
Konstantin Belousov <kib@FreeBSD.org> |
msdosfs_remount_ro(): correct vfs_unbusy() loop
PR: 276408 Reported by: John F. Carr Fixes: 13ccb04589e2c5c840e19b407a59e44cb70ac28e Sponsored by: The FreeBSD Foundation MFC after: 1 week
|
#
13ccb045 |
| 18-Jan-2024 |
Konstantin Belousov <kib@FreeBSD.org> |
msdosfs_integrity_error(): plug possible busy leak
If taskqueue_enqueue() returned error, unbusy(). Handle parallel calls to msdosfs_integrity_error() by unbusying in msdosfs_remount_ro() up to pend
msdosfs_integrity_error(): plug possible busy leak
If taskqueue_enqueue() returned error, unbusy(). Handle parallel calls to msdosfs_integrity_error() by unbusying in msdosfs_remount_ro() up to pending times.
Noted and reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D43482
show more ...
|
Revision tags: release/14.0.0 |
|
#
71625ec9 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
|
#
0728695c |
| 25-Apr-2023 |
Stefan Eßer <se@FreeBSD.org> |
fs/msdosfs: Fix potential panic and size calculations
Some combinations of FAT12 file system parameters could cause a kernel panic due to an unmapped access if the size of the FAT was larger than th
fs/msdosfs: Fix potential panic and size calculations
Some combinations of FAT12 file system parameters could cause a kernel panic due to an unmapped access if the size of the FAT was larger than the CPU page size. The reason is that FAT12 uses 3 bytes to store 2 FAT pointers, leading to partial FAT pointers at the end of buffers of a size that is not a multiple of 3.
With a typical page size of 4 KB, this caused the FAT entry at byte offsets 4095 and 4096 to cross the page boundary, with only the first page mapped. This was fixed by adjusting the mapping to always cover both bytes of each FAT entry.
Testing revealed 2 other inconsistencies that are fixed by this commit:
1) The calculation of the size of the data area did not take into account the fact that the first two data block numbers are reserved and that the data area starts with block 2. This could cause a FAT12 file system created with the maximum supported number of blocks to be incorrectly identified as FAT16.
2) The root directory does not take up space in the data area of a FAT12 or FAT16 file system, since it is placed into a reserved area outside of that data area. This commits makes stat() report the logical size of the root directory, but with 0 blocks allocated from the data area.
PR: 270587 Reviewed by: mckusick Differential Revision: https://reviews.freebsd.org/D39386
show more ...
|
Revision tags: release/13.2.0 |
|
#
c33db74b |
| 29-Mar-2023 |
Stefan Eßer <se@FreeBSD.org> |
fs/msdosfs: add tracking of free root directory entries
This update implements tallying of free directory entries during create, delete, or rename operations on FAT12 and FAT16 file systems.
Prior
fs/msdosfs: add tracking of free root directory entries
This update implements tallying of free directory entries during create, delete, or rename operations on FAT12 and FAT16 file systems.
Prior to this change, the total number of root directory entries was reported as number of inodes, but 0 as the number of free inodes, causing system health monitoring software to warn about a suspected disk full issue.
The FAT12 and FAT16 file systems provide a limited number of root directory entries, e.g. 512 on typical hard disk formats. The valid range of values is 1 to 65535, but the msdosfs code will effectively round up "odd" values to the next multiple of 16 (e.g. 513 would allow for 528 root directory entries).
This update implements tracking of directory entries during create, delete, or rename operations, with initial values determined by scanning the directory when the file system is mounted.
Total and free directory entries are reported in the f_files and f_ffree elements of struct statfs, despite differences in semantics of these values:
- There is no limit on the number of files and directories that can be created on a FAT file system. Only the root directory of FAT12 and FAT16 file systems is limited, any number of files can still be created in sub-directories, even when 0 free "inodes" are reported.
- A single file can require 1 to 21 directory entries, depending on the character set, structure, and length of the name. The DOS 8.3 style file name takes up 1 entry, and if the name does not comply with the syntax of a DOS 8.3 file name, 1 additional entry is used for each 13 characters of the file name. Since all these entries have to be contiguous, it is possible that a file or directory with a long name can not be created, despite a sufficient total number of free directory entries.
- Renaming a file can require more directory entries than currently allocated to store its long name, which may prevent an in-place update of the name if more entries are needed. This may cause a rename operation to fail if no contiguous range of free entries for the new name can be found.
- The volume label is stored in a directory entry. An empty FAT file system with a volume label will therefore show 1 used "inode" in df.
- The perceentage of free inodes shown in df or monitoring tools does only represent the state of the root directory of a FAT12 or FAT16 file system. Neither does a reported value of 0% free inodes does prevent files from being created in sub-directories, nor does a value of 50% free inodes guarantee that even a single file with a "long" name can be created in the root directory (if every other directory entry is occupied and there are no 2 contiguous entries).
The statfs(2) and df(1) man pages have been updated with a notice regarding the possibly different semantics of values reported as total and free inodes for non-Unix file systems.
PR: 270053 Reported by: Ben Woods <woodsb02@freebsd.org> Approved by: mckusick MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D38987
show more ...
|
#
1d9f3a37 |
| 06-Jan-2023 |
Konstantin Belousov <kib@FreeBSD.org> |
Stop cleaning MNT_LOCAL on unmount
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
Stop cleaning MNT_LOCAL on unmount
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
show more ...
|
#
ed1bb254 |
| 19-Dec-2022 |
Mateusz Guzik <mjg@FreeBSD.org> |
mntfs: change mntfs_allocvp API to relock on its own
Reviewed by: kib Tested by: pho Differential Revision: https://reviews.freebsd.org/D37759
|
Revision tags: release/12.4.0 |
|
#
b935e867 |
| 08-Nov-2022 |
Mateusz Guzik <mjg@FreeBSD.org> |
Tree-wide replacement of VOP_UNLOCK + vrele combo with vput
No functional changes.
|
Revision tags: release/13.1.0 |
|
#
bb92cd7b |
| 24-Mar-2022 |
Mateusz Guzik <mjg@FreeBSD.org> |
vfs: NDFREE(&nd, NDF_ONLY_PNBUF) -> NDFREE_PNBUF(&nd)
|
#
c7cd607a |
| 14-Feb-2022 |
Mark Johnston <markj@FreeBSD.org> |
msdosfs: Fix mounting when the device sector size is >512B
HugeSectors * BytesPerSec should be computed before converting HugeSectors to a DEV_BSIZE-based count.
Fixes: ba2c98389b78 ("msdosfs: sani
msdosfs: Fix mounting when the device sector size is >512B
HugeSectors * BytesPerSec should be computed before converting HugeSectors to a DEV_BSIZE-based count.
Fixes: ba2c98389b78 ("msdosfs: sanity check sector count from BPB") Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34264
show more ...
|
#
aaaa4fb5 |
| 06-Jan-2022 |
Konstantin Belousov <kib@FreeBSD.org> |
msdosfs: use mntfs vnode for pm_devvp
to prevent races with devfs VCHR vnode reclamation, same as it was done for UFS.
Reported by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC a
msdosfs: use mntfs vnode for pm_devvp
to prevent races with devfs VCHR vnode reclamation, same as it was done for UFS.
Reported by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33721
show more ...
|
#
b2e4b635 |
| 25-Dec-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
msdosfs: add msdosfs_integrity_error()
A function to remount the filesystem from rw to ro on integrity error. The work is performed in taskqueue to allow the call to be done from almost arbitrary co
msdosfs: add msdosfs_integrity_error()
A function to remount the filesystem from rw to ro on integrity error. The work is performed in taskqueue to allow the call to be done from almost arbitrary context where erronous state was detected.
Tested by: pho Reviewed by: markj, mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33721
show more ...
|
#
ba2c9838 |
| 30-Dec-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
msdosfs: sanity check sector count from BPB
We use sector count to size the FAT inuse bitset. If sector count is corrupted, kernel might be tricked into doing unbound allocation. Ensure that the se
msdosfs: sanity check sector count from BPB
We use sector count to size the FAT inuse bitset. If sector count is corrupted, kernel might be tricked into doing unbound allocation. Ensure that the sector count does not exceed the actual volume size.
In collaboration with: pho Reviewed by: markj, mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33721
show more ...
|
#
04fd468d |
| 30-Dec-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
mountmsdosfs(): some style
Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33721
|
Revision tags: release/12.3.0 |
|
#
7e1d3eef |
| 25-Nov-2021 |
Mateusz Guzik <mjg@FreeBSD.org> |
vfs: remove the unused thread argument from NDINIT*
See b4a58fbf640409a1 ("vfs: remove cn_thread")
Bump __FreeBSD_version to 1400043.
|
#
6ae13c0f |
| 07-Aug-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
msdosfs: add doscheckpath lock
Similar to the UFS revision 8df4bc48c89a130207
Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: http
msdosfs: add doscheckpath lock
Similar to the UFS revision 8df4bc48c89a130207
Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31464
show more ...
|
#
ae7e8a02 |
| 01-Aug-2021 |
Konstantin Belousov <kib@FreeBSD.org> |
msdosfs deget(): add locking flags argument
LK_EXCLUSIVE must be passed always, some consumers need the ability to specify LK_NOWAIT
Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD F
msdosfs deget(): add locking flags argument
LK_EXCLUSIVE must be passed always, some consumers need the ability to specify LK_NOWAIT
Reviewed by: mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31464
show more ...
|
Revision tags: release/13.0.0 |
|
#
cd853791 |
| 28-Nov-2020 |
Konstantin Belousov <kib@FreeBSD.org> |
Make MAXPHYS tunable. Bump MAXPHYS to 1M.
Replace MAXPHYS by runtime variable maxphys. It is initialized from MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys.
Make b_pag
Make MAXPHYS tunable. Bump MAXPHYS to 1M.
Replace MAXPHYS by runtime variable maxphys. It is initialized from MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys.
Make b_pages[] array in struct buf flexible. Size b_pages[] for buffer cache buffers exactly to atop(maxbcachebuf) (currently it is sized to atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1. The +1 for pbufs allow several pbuf consumers, among them vmapbuf(), to use unaligned buffers still sized to maxphys, esp. when such buffers come from userspace (*). Overall, we save significant amount of otherwise wasted memory in b_pages[] for buffer cache buffers, while bumping MAXPHYS to desired high value.
Eliminate all direct uses of the MAXPHYS constant in kernel and driver sources, except a place which initialize maxphys. Some random (and arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted straight. Some drivers, which use MAXPHYS to size embeded structures, get private MAXPHYS-like constant; their convertion is out of scope for this work.
Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs, dev/siis, where either submitted by, or based on changes by mav.
Suggested by: mav (*) Reviewed by: imp, mav, imp, mckusick, scottl (intermediate versions) Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D27225
show more ...
|
#
69367793 |
| 20-Nov-2020 |
Konstantin Belousov <kib@FreeBSD.org> |
msdosfs: suspend around unmount or remount rw->ro.
This also eliminates unsafe use of VFS_SYNC(MNT_WAIT).
Requested by: mckusick Discussed with: imp Tested by: pho (previous version) Sponsored by:
msdosfs: suspend around unmount or remount rw->ro.
This also eliminates unsafe use of VFS_SYNC(MNT_WAIT).
Requested by: mckusick Discussed with: imp Tested by: pho (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D27269
show more ...
|
#
1b3cb4dc |
| 20-Nov-2020 |
Konstantin Belousov <kib@FreeBSD.org> |
msdosfs: Add trivial support for suspension.
Tested by: pho (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27269
|
#
c1c4d0e9 |
| 18-Nov-2020 |
Conrad Meyer <cem@FreeBSD.org> |
msdosfs(5): Fix debug-only format string
No functional change; MSDOSFS_DEBUG isn't a real build option, so this isn't covered by LINT kernels.
|
Revision tags: release/12.2.0 |
|
#
e2515283 |
| 27-Aug-2020 |
Glen Barber <gjb@FreeBSD.org> |
MFH
Sponsored by: Rubicon Communications, LLC (netgate.com)
|
#
7ad2a82d |
| 19-Aug-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
vfs: drop the error parameter from vn_isdisk, introduce vn_isdisk_error
Most consumers pass NULL.
|
#
e81829d0 |
| 16-Aug-2020 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r364264 through r364278.
|