summaryrefslogtreecommitdiff
path: root/sys/fs/udf/udf_vfsops.c
Commit message (Collapse)AuthorAgeFilesLines
* Make MAXPHYS tunable. Bump MAXPHYS to 1M.Konstantin Belousov2020-11-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=368124
* udf: Validate the full file entry lengthMark Johnston2020-09-221-16/+30
| | | | | | | | | | | | | | | Otherwise a corrupted file entry containing invalid extended attribute lengths or allocation descriptor lengths can trigger an overflow when the file entry is loaded. admbug: 965 PR: 248613 Reported by: C Turt <ecturt@gmail.com> MFC after: 3 days Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=366005
* fs: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-2/+1
| | | | Notes: svn path=/head/; revision=365070
* vfs: drop the error parameter from vn_isdisk, introduce vn_isdisk_errorMateusz Guzik2020-08-191-1/+1
| | | | | | | Most consumers pass NULL. Notes: svn path=/head/; revision=364372
* vfs: drop the mostly unused flags argument from VOP_UNLOCKMateusz Guzik2020-01-031-1/+1
| | | | | | | | | | | Filesystems which want to use it in limited capacity can employ the VOP_UNLOCK_FLAGS macro. Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D21427 Notes: svn path=/head/; revision=356337
* sys/fs: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326268
* Remove drop/reacquire of Giant around geom calls for cd9660 and udf.Konstantin Belousov2016-05-221-6/+0
| | | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Notes: svn path=/head/; revision=300427
* Complete MPSAFE VFS interface and remove MNTK_MPSAFE flag.Attilio Rao2012-11-091-2/+1
| | | | | | | | Porters should refer to __FreeBSD_version 1000021 for this change as it may have happened at the same timeframe. Notes: svn path=/head/; revision=242833
* Use NULL instead of 0 for pointersKevin Lo2012-07-221-1/+1
| | | | Notes: svn path=/head/; revision=238697
* Add a lock flags argument to the VFS_FHTOVP() file systemRick Macklem2011-05-221-1/+1
| | | | | | | | | | | | | | method, so that callers can indicate the minimum vnode locking requirement. This will allow some file systems to choose to return a LK_SHARED locked vnode when LK_SHARED is specified for the flags argument. This patch only adds the flag. It does not change any file system to use it and all callers specify LK_EXCLUSIVE, so file system semantics are not changed. Reviewed by: kib Notes: svn path=/head/; revision=222167
* Revert the previous commit. The race is not applicable to the lockmgrJohn Baldwin2010-07-161-4/+1
| | | | | | | | | | | implementation in 8.0 and later as its flags field does not hold dynamic state such as waiters flags, but is only modified in lockinit() aside from VN_LOCK_*(). Discussed with: attilio Notes: svn path=/head/; revision=210172
* When the MNTK_EXTENDED_SHARED mount option was added, some filesystems wereJohn Baldwin2010-07-161-1/+4
| | | | | | | | | | | | | | | | | changed to defer the setting of VN_LOCK_ASHARE() (which clears LK_NOSHARE in the vnode lock's flags) until after they had determined if the vnode was a FIFO. This occurs after the vnode has been inserted a VFS hash or some similar table, so it is possible for another thread to find this vnode via vget() on an i-node number and block on the vnode lock. If the lockmgr interlock (vnode interlock for vnode locks) is not held when clearing the LK_NOSHARE flag, then the lk_flags field can be clobbered. As a result the thread blocked on the vnode lock may never get woken up. Fix this by holding the vnode interlock while modifying the lock flags in this case. MFC after: 3 days Notes: svn path=/head/; revision=210171
* Remove the thread argument from the FSD (File-System Dependent) parts ofAttilio Rao2009-05-111-5/+7
| | | | | | | | | | | | | | | | | | | | the VFS. Now all the VFS_* functions and relating parts don't want the context as long as it always refers to curthread. In some points, in particular when dealing with VOPs and functions living in the same namespace (eg. vflush) which still need to be converted, pass curthread explicitly in order to retain the old behaviour. Such loose ends will be fixed ASAP. While here fix a bug: now, UFS_EXTATTR can be compiled alone without the UFS_EXTATTR_AUTOSTART option. VFS KPI is heavilly changed by this commit so thirdy parts modules needs to be recompiled. Bump __FreeBSD_version in order to signal such situation. Notes: svn path=/head/; revision=191990
* Add a new internal mount flag (MNTK_EXTENDED_SHARED) to indicate that aJohn Baldwin2009-03-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | filesystem supports additional operations using shared vnode locks. Currently this is used to enable shared locks for open() and close() of read-only file descriptors. - When an ISOPEN namei() request is performed with LOCKSHARED, use a shared vnode lock for the leaf vnode only if the mount point has the extended shared flag set. - Set LOCKSHARED in vn_open_cred() for requests that specify O_RDONLY but not O_CREAT. - Use a shared vnode lock around VOP_CLOSE() if the file was opened with O_RDONLY and the mountpoint has the extended shared flag set. - Adjust md(4) to upgrade the vnode lock on the vnode it gets back from vn_open() since it now may only have a shared vnode lock. - Don't enable shared vnode locks on FIFO vnodes in ZFS and UFS since FIFO's require exclusive vnode locks for their open() and close() routines. (My recent MPSAFE patches for UDF and cd9660 already included this change.) - Enable extended shared operations on UFS, cd9660, and UDF. Submitted by: ups Reviewed by: pjd (ZFS bits) MFC after: 1 month Notes: svn path=/head/; revision=189696
* udf_readatoffset: read through directory vnode, do not read > MAXBSIZEAndriy Gapon2009-02-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Currently bread()-ing through device vnode with (1) VMIO enabled, (2) bo_bsize != DEV_BSIZE (3) more than 1 block results in data being incorrectly cached. So instead a more common approach of using a vnode belonging to fs is now employed. Also, prevent attempt to bread more than MAXBSIZE bytes because of adjustments made to account for offset that doesn't start on block boundary. Add expanded comments to explain the calculations. Also drop unused inline function while here. PR: kern/120967 PR: kern/129084 Reviewed by: scottl, kib Approved by: jhb (mentor) Notes: svn path=/head/; revision=189082
* udf: add read-ahead support modeled after cd9660Andriy Gapon2009-02-261-0/+5
| | | | | | | | Reviewed by: scottl Approved by: jhb (mentor) Notes: svn path=/head/; revision=189070
* - Consolidate error handling in the cd9660 and udf mount routines.John Baldwin2009-02-111-14/+18
| | | | | | | | | | | | - Always read the character device pointer while the associated devfs vnode is locked. Also, use dev_ref() to obtain a new reference on the vnode for the mountpoint. This reference is released on unmount. This mirrors the earlier fix to FFS. Reviewed by: kib Notes: svn path=/head/; revision=188502
* Mark udf(4) MPSAFE and add support for shared vnode locks during pathnameJohn Baldwin2009-02-091-10/+25
| | | | | | | | | | | | | | | | | lookups: - Honor the caller's locking flags in udf_root() and udf_vget(). - Set VV_ROOT for the root vnode in udf_vget() instead of only doing it in udf_root(). - Honor the requested locking flags during pathname lookups in udf_lookup(). - Release the buffer holding the directory data before looking up the vnode for a given file to avoid a LOR between the "udf" vnode locks and "bufwait". - Use vn_vget_ino() to handle ".." lookups. - Special case "." lookups instead of calling udf_vget(). We have to do extra checking for the vnode lock for "." lookups. Notes: svn path=/head/; revision=188407
* Add support for fifos to UDF:John Baldwin2009-02-061-0/+1
| | | | | | | | | | | | - Add a separate set of vnode operations that inherits from the fifo ops and use it for fifo nodes. - Add a VOP_SETATTR() method that allows setting the size (by silently ignoring the requests) of fifos. This is to allow O_TRUNC opens of fifo devices (e.g. I/O redirection in shells using ">"). - Add a VOP_PRINT() handler while I'm here. Notes: svn path=/head/; revision=188245
* Fix a number of style issues in the MALLOC / FREE commit. I've tried toDag-Erling Smørgrav2008-10-231-3/+3
| | | | | | | | be careful not to fix anything that was already broken; the NFSv4 code is particularly bad in this respect. Notes: svn path=/head/; revision=184214
* Retire the MALLOC and FREE macros. They are an abomination unto style(9).Dag-Erling Smørgrav2008-10-231-9/+8
| | | | | | | MFC after: 3 months Notes: svn path=/head/; revision=184205
* Remove the struct thread unuseful argument from bufobj interface.Attilio Rao2008-10-101-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | In particular following functions KPI results modified: - bufobj_invalbuf() - bufsync() and BO_SYNC() "virtual method" of the buffer objects set. Main consumers of bufobj functions are affected by this change too and, in particular, functions which changed their KPI are: - vinvalbuf() - g_vfs_close() Due to the KPI breakage, __FreeBSD_version will be bumped in a later commit. As a side note, please consider just temporary the 'curthread' argument passing to VOP_SYNC() (in bufsync()) as it will be axed out ASAP Reviewed by: kib Tested by: Giovanni Trematerra <giovanni dot trematerra at gmail dot com> Notes: svn path=/head/; revision=183754
* Cleanup lockmgr interface and exported KPI:Attilio Rao2008-01-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | - Remove the "thread" argument from the lockmgr() function as it is always curthread now - Axe lockcount() function as it is no longer used - Axe LOCKMGR_ASSERT() as it is bogus really and no currently used. Hopefully this will be soonly replaced by something suitable for it. - Remove the prototype for dumplockinfo() as the function is no longer present Addictionally: - Introduce a KASSERT() in lockstatus() in order to let it accept only curthread or NULL as they should only be passed - Do a little bit of style(9) cleanup on lockmgr.h KPI results heavilly broken by this change, so manpages and FreeBSD_version will be modified accordingly by further commits. Tested by: matteo Notes: svn path=/head/; revision=175635
* udf_vget() shall vgone() the vnode when the file_entry cannot be allocatedKonstantin Belousov2008-01-181-0/+3
| | | | | | | | | | | or read from the volume. Otherwise, half-constructed vnode could be found later and cause panic when accessed. PR: 118322 MFC after: 1 week Notes: svn path=/head/; revision=175436
* VOP_LOCK1() (and so VOP_LOCK()) and VOP_UNLOCK() are only used inAttilio Rao2008-01-131-1/+1
| | | | | | | | | | | | | | conjuction with 'thread' argument passing which is always curthread. Remove the unuseful extra-argument and pass explicitly curthread to lower layer functions, when necessary. KPI results broken by this change, which should affect several ports, so version bumping and manpage update will be further committed. Tested by: kris, pho, Diego Sardina <siarodx at gmail dot com> Notes: svn path=/head/; revision=175294
* Fix calculation of descriptor tag checksums. According to ECMA-167, Part 4,Markus Brueffer2007-12-111-1/+1
| | | | | | | | | | | | | 7.2.3, bytes 0-3 and 5-15 are used to calculate the checksum of a descriptor tag. PR: kern/90521 Submitted by: Björn König <bkoenig@cs.tu-berlin.de> Reviewed by: scottl Approved by: emax (mentor) Notes: svn path=/head/; revision=174538
* Get rid of qaddr_t.Alfred Perlstein2007-10-161-2/+2
| | | | | | | Requested by: bde Notes: svn path=/head/; revision=172697
* Make insmntque() externally visibile and allow it to fail (e.g. duringTor Egge2007-03-131-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | late stages of unmount). On failure, the vnode is recycled. Add insmntque1(), to allow for file system specific cleanup when recycling vnode on failure. Change getnewvnode() to no longer call insmntque(). Previously, embryonic vnodes were put onto the list of vnode belonging to a file system, which is unsafe for a file system marked MPSAFE. Change vfs_hash_insert() to no longer lock the vnode. The caller now has that responsibility. Change most file systems to lock the vnode and call insmntque() or insmntque1() after a new vnode has been sufficiently setup. Handle failed insmntque*() calls by propagating errors to callers, possibly after some file system specific cleanup. Approved by: re (kensmith) Reviewed by: kib In collaboration with: kib Notes: svn path=/head/; revision=167497
* Move vnode-to-file-handle translation from vfs_vptofh to vop_vptofh method.Pawel Jakub Dawidek2007-02-151-23/+0
| | | | | | | | | | | | | | | | | | | This way we may support multiple structures in v_data vnode field within one file system without using black magic. Vnode-to-file-handle should be VOP in the first place, but was made VFS operation to keep interface as compatible as possible with SUN's VFS. BTW. Now Solaris also implements vnode-to-file-handle as VOP operation. VFS_VPTOFH() was left for API backward compatibility, but is marked for removal before 8.0-RELEASE. Approved by: mckusick Discussed with: many (on IRC) Tested with: ufs, msdosfs, cd9660, nullfs and zfs Notes: svn path=/head/; revision=166774
* Tell backing v_object the filesize right on it's creation.Pav Lucistnik2007-01-071-1/+6
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=165879
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningRobert Watson2006-11-061-1/+2
| | | | | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net> Notes: svn path=/head/; revision=164033
* Use mount interlock to protect all changes to mnt_flag and mnt_kern_flag.Tor Egge2006-09-261-0/+6
| | | | | | | | This eliminates a race where MNT_UPDATE flag could be lost when nmount() raced against sync(), sync_fsync() or quotactl(). Notes: svn path=/head/; revision=162647
* In udf_find_partmaps(), when we find a type 1 partition map, we have toYaroslav Tykhiy2006-07-251-7/+9
| | | | | | | | | | skip the actual type 1 length (6 bytes). With this change, it is now possible to correctly spot the VAT partition map in certain discs. Submitted by: Pedro Martelletto <pedro@ambientworks.net> Notes: svn path=/head/; revision=160664
* Fix a memory leak and a nested 'for' loop in the spare table handling.Scott Long2006-06-261-4/+6
| | | | | | | Submitted by: Pedro Martelletto Notes: svn path=/head/; revision=159939
* Remove calls to vfs_export() for exporting a filesystem for NFS mountingCraig Rodrigues2006-05-261-8/+1
| | | | | | | | from individual filesystems. Call it instead in vfs_mount.c, after we call VFS_MOUNT() for a specific filesystem. Notes: svn path=/head/; revision=158927
* Make UDF endian-safe.Will Andrews2006-02-031-1/+1
| | | | | | | | Submitted by: Pedro Martelletto <pedro@ambientworks.net> (via scottl) Tested on: sparc64 Notes: svn path=/head/; revision=155256
* Normalize a significant number of kernel malloc type names:Robert Watson2005-10-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | - Prefer '_' to ' ', as it results in more easily parsed results in memory monitoring tools such as vmstat. - Remove punctuation that is incompatible with using memory type names as file names, such as '/' characters. - Disambiguate some collisions by adding subsystem prefixes to some memory types. - Generally prefer lower case to upper case. - If the same type is defined in multiple architecture directories, attempt to use the same name in additional cases. Not all instances were caught in this change, so more work is required to finish this conversion. Similar changes are required for UMA zone names. Notes: svn path=/head/; revision=151897
* Unconditionally mount a UDF filesystem as read-only, instead ofCraig Rodrigues2005-10-171-2/+4
| | | | | | | returning an EROFS if we forget to mount it as read-only. Notes: svn path=/head/; revision=151405
* - Do not hardcode the bsize to a sectorsize of 2048, even thoughCraig Rodrigues2005-10-091-5/+21
| | | | | | | | | | | | | | | the UDF specification specifies a logical sectorsize of 2048. Instead, get it from GEOM. - When reading the UDF Anchor Volume Descriptor, use the logical sectorsize of 2048 when calculating the offset to read from, but use the actual sectorsize to determine how much to read. - works with reading a DVD disk and a DVD disk image file via mdconfig - correctly returns EINVAL if we try to mount_udf an audio CD, instead of panicking inside GEOM when INVARIANTS is set Notes: svn path=/head/; revision=151157
* We don't need 'imp' here.Pawel Jakub Dawidek2005-10-071-1/+0
| | | | Notes: svn path=/head/; revision=151054
* Unbreak hpfs/ntfs/udf/ext2fs/reiserfs mounting.Suleiman Souhlal2005-09-031-1/+0
| | | | | | | Another pointyhat to: ssouhlal Notes: svn path=/head/; revision=149771
* *_mountfs() (if the filesystem mounts from a device) needs devvp to beSuleiman Souhlal2005-09-021-4/+2
| | | | | | | | | | locked, so lock it. Glanced at by: phk MFC after: 3 days Notes: svn path=/head/; revision=149720
* - Update vfs_root implementations to match the new prototype. None ofJeff Roberson2005-03-241-1/+1
| | | | | | | | | | | these filesystems will support shared locks until they are explicitly modified to do so. Careful review must be done to ensure that this is safe for each individual filesystem. Sponsored by: Isilon Systems, Inc. Notes: svn path=/head/; revision=144058
* Add two arguments to the vfs_hash() KPI so that filesystems which doPoul-Henning Kamp2005-03-161-2/+2
| | | | | | | not have unique hashes (NFS) can also use it. Notes: svn path=/head/; revision=143692
* Don't hold a reference to the disk vnode for each inode.Poul-Henning Kamp2005-03-151-3/+0
| | | | | | | | Eliminate cdev and vnode pointer to the disk from the inodes, the mount holds everything we need. Notes: svn path=/head/; revision=143668
* Improve the vfs_hash() API: vput() the unneeded vnode centrally toPoul-Henning Kamp2005-03-151-3/+1
| | | | | | | avoid replicating the vput in all the filesystems. Notes: svn path=/head/; revision=143663
* Simplify the vfs_hash calling convention.Poul-Henning Kamp2005-03-151-23/+3
| | | | Notes: svn path=/head/; revision=143619
* Use vfs_hash instead of home-rolled.Poul-Henning Kamp2005-03-141-34/+50
| | | | | | | Correct locking around g_vfs_close() Notes: svn path=/head/; revision=143571
* Remove basically unused root_vp pointer in udfmount.Robert Watson2005-02-181-1/+0
| | | | | | | | MFC after: 1 week Discussed with: scottl Notes: svn path=/head/; revision=142043
* Make a bunch of malloc types static.Poul-Henning Kamp2005-02-101-1/+1
| | | | | | | Found by: src/tools/tools/kernxref Notes: svn path=/head/; revision=141616