summaryrefslogtreecommitdiffstats
path: root/sys/msdosfs (follow)
Commit message (Collapse)AuthorAgeFilesLines
* spellingjsg2021-03-111-3/+3
|
* Refactor klist insertion and removalvisa2020-12-251-3/+3
| | | | | | | | | | | | Rename klist_{insert,remove}() to klist_{insert,remove}_locked(). These functions assume that the caller has locked the klist. The current state of locking remains intact because the kernel lock is still used with all klists. Add new functions klist_insert() and klist_remove() that lock the klist internally. This allows some code simplification. OK mpi@
* consistently return EINVAL on invalid BPBjsg2020-08-101-3/+3
| | | | | | | | | | | | reverts changes from msdosfs_vfsops.c rev 1.7 Prompted by a patch from John Carmack to add an an error path when exFAT is detected on mount to give a more helpful error message. Returning EINVAL in the existing sanity checks will make mount_msdos(8) print "not an MSDOS filesystem" when attempting to mount exFAT and matches historic and documented behaviour. ok kn@
* Rename poll-compatibility flag to better reflect what it is.mpi2020-06-111-2/+2
| | | | | | While here prefix kernel-only EV flags with two underbars. Suggested by kettenis@, ok visa@
* Use a new EV_OLDAPI flag to match the behavior of poll(2) and select(2).mpi2020-06-081-1/+5
| | | | | | | | | Adapt FS kqfilters to always return true when the flag is set and bypass the polling mechanism of the NFS thread. While here implement a write filter for NFS. ok visa@
* Abstract the head of knote lists. This allows extending the lists,visa2020-04-071-3/+3
| | | | | | for example, with locking assertions. OK mpi@, anton@
* Kill some dead code that tests bits immediately after setting them.krw2020-03-241-8/+5
| | | | CID 1452873
* Remove unused "struct proc *" argument from the following functions:mpi2020-02-272-24/+3
| | | | | | | | | | | | | - ufs_chown() & ufs_chmod() - ufs_reclaim() - ext2fs_chown() & ext2fs_chmod() - ntfs_ntget() & ntfs_ntput() - ntfs_vgetex(), ntfs_ntlookup() & ntfs_ntlookupfile() While here use `ap->a_p' directly when it is only required to re-enter the VFS layer in order to help reducing the loop. ok visa@
* Replace field f_isfd with field f_flags in struct filterops to allowvisa2020-02-201-4/+4
| | | | | | adding more filter properties without cluttering the struct. OK mpi@, anton@
* remove a notyet that remains more not than yet after 25 years. ok krwtedu2020-01-241-9/+1
|
* struct vops is not modified during runtime so use const which moves eachclaudio2020-01-202-4/+4
| | | | | into read-only data segment. OK deraadt@ tedu@
* Use C99 designated initializers with struct filterops. In addition,visa2019-12-311-7/+21
| | | | | | make the structs const so that the data are put in .rodata. OK mpi@, deraadt@, anton@, bluhm@
* Convert struct vfsops initializer to C99 style.bluhm2019-12-261-14/+14
| | | | OK visa@
* msdosfs: remove timezone supportcheloha2019-09-041-5/+3
| | | | | | | | | | | This support is undocumented, only works if you're using the kernel timezone, and breaks during a DST shift. It also preferences file systems managed by a Windows installation: many implementations, like ours, use UTC by default (think: phones, digital cameras). No complaints on tech@. "good riddance" tedu@, "Yep." deraadt@
* Allow concurrent reads of the f_offset field of struct file byanton2019-08-051-2/+2
| | | | | | | | | serializing both read/write operations using the existing file mutex. The vnode lock still grants exclusive write access to the offset; the mutex is only used to make the actual write atomic and prevent any concurrent reader from observing intermediate values. ok mpi@ visa@
* vinvalbuf(9): tlseep -> tsleep_nsec(9); ok millert@cheloha2019-07-252-4/+4
|
* getblk(9): tsleep(9) -> tsleep_nsec(9); ok visa@cheloha2019-07-192-7/+8
|
* Revert anton@ changes about read/write unlockingsolene2019-07-121-2/+2
| | | | | | https://marc.info/?l=openbsd-cvs&m=156277704122293&w=2 ok anton@
* Make read/write of the f_offset field belonging to struct file MP-safe;anton2019-07-101-2/+2
| | | | | | | | | | | | | | | | as part of the effort to unlock the kernel. Instead of relying on the vnode lock, introduce a dedicated lock per file. Exclusive write access is granted using the new foffset_enter and foffset_leave API. A convenience function foffset_get is also available for threads that only need to read the current offset. The lock acquisition order in vn_write has been changed to match the one in vn_read in order to avoid a potential deadlock. This change also gets rid of a documented race in vn_read(). Inspired by the FreeBSD implementation. With help and ok mpi@ visa@
* Introduce a dedicated entry point data structure for file locks. This new dataanton2019-01-211-2/+2
| | | | | | | | | | | | structure allows for better tracking of pending lock operations which is essential in order to prevent a use-after-free once the underlying vnode is gone. Inspired by the lockf implementation in FreeBSD. ok visa@ Reported-by: syzbot+d5540a236382f50f1dac@syzkaller.appspotmail.com
* Drop redundant "node == parent node" checks from VOP_RMDIR()visa2018-06-211-9/+1
| | | | | | implementations. Rely on the VFS layer to do the checking. OK mpi@, helg@
* Make callers of VOP_CREATE(9) and VOP_MKNOD(9) responsible forvisa2018-06-071-4/+1
| | | | | | unlocking the directory vnode. OK mpi@, helg@
* Drop unnecessary `p' parameter from vget(9).visa2018-05-272-5/+4
| | | | OK mpi@
* Implement VFS read clustering for MSDOSFS, take 3.mpi2018-05-073-57/+78
| | | | With sf@, inputs from krw@, tested by many, ok visa@
* Remove proc from the parameters of vn_lock(). The parameter isvisa2018-05-024-16/+12
| | | | | | unnecessary because curproc always does the locking. OK mpi@
* Clean up the parameters of VOP_LOCK() and VOP_UNLOCK(). It is alwaysvisa2018-04-284-24/+24
| | | | | | | curproc that does the locking or unlocking, so the proc parameter is pointless and can be dropped. OK mpi@, deraadt@
* Use RWL_IS_VNODE with locks that are acquired through VOP_LOCK(),visa2018-03-281-2/+2
| | | | | | | | to appease WITNESS. ext2fs and ffs already use the flag. The same locking pattern appears with other file systems too, so this patch addresses the remaining cases. OK mpi@
* Syncronize filesystems to disk when suspending. Each mountpoint's vnodesderaadt2018-02-102-6/+7
| | | | | | | | | | are pushed to disk. Dangling vnodes (unlinked files still in use) and vnodes undergoing change by long-running syscalls are identified -- and such filesystems are marked dirty on-disk while we are suspended (in case power is lost, a fsck will be required). Filesystems without dangling or busy vnodes are marked clean, resulting in faster boots following "battery died" circumstances. Tested by numerous developers, thanks for the feedback.
* Stop assuming <sys/file.h> will pull in fcntl.h when _KERNEL is defined.guenther2018-01-021-2/+3
| | | | ok millert@ sthen@
* Don't pull in <sys/file.h> just to get fcntl.hguenther2017-12-301-2/+2
| | | | ok deraadt@ krw@
* Delete unnecessary <sys/file.h> includesguenther2017-12-301-2/+1
| | | | ok millert@ krw@
* In uvm Chuck decided backing store would not be allocated proactivelyderaadt2017-12-111-17/+15
| | | | | | | | | | | | | | | | | | | | | | for blocks re-fetchable from the filesystem. However at reboot time, filesystems are unmounted, and since processes lack backing store they are killed. Since the scheduler is still running, in some cases init is killed... which drops us to ddb [noted by bluhm]. Solution is to convert filesystems to read-only [proposed by kettenis]. The tale follows: sys_reboot() should pass proc * to MD boot() to vfs_shutdown() which completes current IO with vfs_busy VB_WRITE|VB_WAIT, then calls VFS_MOUNT() with MNT_UPDATE | MNT_RDONLY, soon teaching us that *fs_mount() calls a copyin() late... so store the sizes in vfsconflist[] and move the copyin() to sys_mount()... and notice nfs_mount copyin() is size-variant, so kill legacy struct nfs_args3. Next we learn ffs_mount()'s MNT_UPDATE code is sharp and rusty especially wrt softdep, so fix some bugs adn add ~MNT_SOFTDEP to the downgrade. Some vnodes need a little more help, so tie them to &dead_vnops. ffs_mount calling DIOCCACHESYNC is causing a bit of grief still but this issue is seperate and will be dealt with in time. couple hundred reboots by bluhm and myself, advice from guenther and others at the hut
* msdofs: Add new CLUST_END constantsf2017-08-141-2/+3
| | | | | | | | | | | | | | | (forgot to commit fat.h) Add new CLUST_END and use it as parameter to pcbmap() when searching for end cluster, instead of explicitly passing 0xffff. This fixes potential problem for FAT32, where cluster number may be legally bigger than 0xffff. Also change clusteralloc() so that fillwith is not explicitly passed by caller anymore (there is no need to use anything other than CLUST_EOFE). From NetBSD commit by jdolecek@NetBSD.org ok tb@ mpi@
* msdofs: Add new CLUST_END constantsf2017-08-143-8/+9
| | | | | | | | | | | | | Add new CLUST_END and use it as parameter to pcbmap() when searching for end cluster, instead of explicitly passing 0xffff. This fixes potential problem for FAT32, where cluster number may be legally bigger than 0xffff. Also change clusteralloc() so that fillwith is not explicitly passed by caller anymore (there is no need to use anything other than CLUST_EOFE). From NetBSD commit by jdolecek@NetBSD.org ok tb@ mpi@
* minor msdosfs tweakssf2017-08-131-2/+4
| | | | | | | * add to comments for pcbmap() * remove useless ";" ok tb@
* Revert 'Implement VFS read clustering for MSDOSFS' againsf2017-06-132-67/+44
| | | | | | | | | | | This has again caused regressions, this time when reading from msdosfs. This reverts denode.h 1.31 msdosfs_vnops.c 1.114 Requested by deraadt@
* msdosfs & ffs: flush cache if updating mount from r/w to r/osf2017-05-291-2/+9
| | | | ok deraadt@
* Implement VFS read clustering for MSDOSFSsf2017-05-292-44/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the reverted commit by mpi@ from msdosfs_vnops.c 1.105 plus some additional tweaks to fix some cluster/block number confusion that lead to regressions when seeking past the end of a file. The original commit message was: The logic used in msdosfs_bmap() to loop calling pcbmap() comes from FreeBSD and is not really efficient but it is good enough since it is only called when generating I/O. With this diff I get a 100% improvement when reading big files from a crappy USB stick. With this and bread_cluster(9) modified to not re-fetch B_CACHED buffers, reading large contiguous files with chunk sizes of MAXPHYS is almost as fast as physio(9) on the same device. For a 'real world' example, when copying music files from a USB stick I see a speed jump from 15MB/s on -current to 24Mb/s with this diff. While here rename some 'lbn' variables into 'cn' to better reflect what we're dealing with. Tested by Mathieu, with support from deraadt@ ok mpi@
* Tweak lock inits to make the system runnable with witness(4)visa2017-04-201-2/+2
| | | | on amd64 and i386.
* Rename BIOS parameter block field from bsPBP to bsBPB. This typobluhm2016-10-102-4/+4
| | | | | has been fixed in FreeBSD in 2002. No binary change. From Alexander von Gernler; OK krw@
* Do not check the SecPerTrack field of the BPB when mounting a MSDOSbluhm2016-10-091-2/+2
| | | | | | | file system. In modern images the field is not set properly and the value is not used anyway. FreeBSD has removed the check already in 2008. From Alexander von Gernler; OK krw@
* Kill empty ifdef; ok fcambus@jca2016-09-281-3/+1
|
* Remove usermount remnants. ok tedunatano2016-09-071-32/+3
|
* Revert "Implement VFS read clustering for MSDOSFS"sf2016-08-302-70/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This caused garbage to be written instead of blocks of 0-bytes if a file is extended by seeking past the end. This happens for example when extracting files containing lots of 0-bytes with tar. ok mpi@ Details of original commit: msdosfs_vnops.c revision 1.105 denode.h revision 1.28 date: 2016/01/13 10:00:55; author: mpi; commitid: ru9jHQwQX09BC5Bw; Implement VFS read clustering for MSDOSFS. The logic used in msdosfs_bmap() to loop calling pcbmap() comes from FreeBSD and is not really efficient but it is good enough since it is only called when generating I/O. With this diff I get a 100% improvement when reading big files from a crappy USB stick. With this and bread_cluster(9) modified to not re-fetch B_CACHED buffers, reading large contiguous files with chunk sizes of MAXPHYS is almost as fast as physio(9) on the same device. For a 'real world' example, when copying music files from a USB stick I see a speed jump from 15MB/s on -current to 24Mb/s with this diff. While here rename some 'lbn' variables into 'cn' to better reflect what we're dealing with. Tested by Mathieu, with support from deraadt@
* Eliminate pointless casts to qaddr_t of a value being assigned to a void*guenther2016-08-131-2/+2
| | | | ok kettenis@ krw@ natano@ dlg@ espie@
* Remove the lockmgr() API. It is only used by filesystems, where it is anatano2016-06-193-8/+9
| | | | | | | | trivial change to use rrw locks instead. All it needs is LK_* defines for the RW_* flags. tested by naddy and sthen on package building infrastructure input and ok jmc mpi tedu
* When pulling an msdos formated umass stick during mount while thebluhm2016-05-221-2/+3
| | | | | | | | | | usb stack was busy, the kernel could trigger an uvm fault. There is a race between vop_generic_revoke() and sys_mount() where vgonel() could reset v_specinfo. Then v_specmountpoint is no longer valid. So after sleeping, msdosfs_mountfs() could crash in the error path. The code in the different *_mountfs() functions was inconsistent, implement the same check everywhere. OK krw@ natano@
* Remove the -x flag from mount_msdos and always assume the execute bitnatano2016-05-212-16/+12
| | | | | | | | | | | for readable directories, while making it subject to the mask option (-m in mount_msdos), so it is still possible to mount with non-executable directories, but with semantics that are easier to comprehend. This makes directory listings with default mount options work again. ok deraadt@
* by default, files were made executable. that does not make sense today.deraadt2016-05-211-3/+3
| | | | | | noone should be executing a binary from a msdos filesystem, considering the mountpoint tracking permission mode model ok natano krw
* Populate all necessary statfs members in .vfs_statfs. cd9660, udf,natano2016-04-261-9/+9
| | | | | | | | | | msdosfs and nfsv2 don't set f_namemax. ntfs and ext2fs don't set f_namemeax and f_favail. fusefs doesn't set f_mntfromspec, f_favail and f_iosize. Also, make all filesystems use copy_statfs_info(), so that all statfs information is filled in correctly for the (sb != &mp->mnt-stat) case. ok stefan