summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_lookup.c
Commit message (Collapse)AuthorAgeFilesLines
* Add a new 'NOMACCHECK' flag to namei() NDINIT flags, which permits therwatson2002-10-191-6/+11
| | | | | | | | | | | | | | | | | | caller to indicate that MAC checks are not required for the lookup. Similar to IO_NOMACCHECK for vn_rdwr(), this indicates that the caller has already performed all required protections and that this is an internally generated operation. This will be used by the NFS server code, as we don't currently enforce MAC protections against requests delivered via NFS. While here, add NOCROSSMOUNT to PARAMASK; apparently this was used at one point for name lookup flag checking, but isn't any longer or it would have triggered from the NFS server code passing it to indicate that mountpoints shouldn't be crossed in lookups. Approved by: re Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* - Replace v_flag with v_iflag and v_vflagjeff2002-08-041-2/+2
| | | | | | | | | | | | | | | - v_vflag is protected by the vnode lock and is used when synchronization with VOP calls is needed. - v_iflag is protected by interlock and is used for dealing with vnode management issues. These flags include X/O LOCK, FREE, DOOMED, etc. - All accesses to v_iflag and v_vflag have either been locked or marked with mp_fixme's. - Many ASSERT_VOP_LOCKED calls have been added where the locking was not clear. - Many functions in vfs_subr.c were restructured to provide for stronger locking. Idea stolen from: BSD/OS
* Introduce support for Mandatory Access Control and extensiblerwatson2002-08-011-0/+12
| | | | | | | | | | kernel access control. Authorize vop_readlink() and vop_lookup() activities during recursive path lookup via namei() via calls to appropriate MAC entry points. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Under #ifdef DIAGNOSTIC, NULL out componentname pointers if we free therwatson2002-07-241-2/+18
| | | | | | pnbuf to increase the chances of detecting use of a free'd name buffer if SAVENAME or SAVESTART wasn't passed in. Curiously, running with these changes doesn't panic the kernel, and should.
* Catch up to changes in ktrace API.jhb2002-06-071-2/+5
|
* More s/file system/filesystem/gtrhodes2002-05-161-4/+4
|
* Remove references to vm_zone.h and switch over to the new uma API.jeff2002-03-201-12/+12
| | | | | Also, remove maxsockets. If you look carefully you'll notice that the old zone allocator never honored this anyway.
* This is the first part of the new kernel memory allocator. This replacesjeff2002-03-191-2/+3
| | | | | | malloc(9) and vm_zone with a slab like allocator. Reviewed by: arch@
* - Change namei() to use td_ucred instead of p_ucred.jhb2002-02-271-1/+1
| | | | | - Change the hack in access() that uses a temporary credential to set td_ucred to the temp cred instead of p_ucred.
* Include sys/_lock.h and sys/_mutex.h to reduce namespace pollution.alfred2002-01-131-0/+1
| | | | Requested by: jhb
* SMP Lock struct file, filedesc and the global file list.alfred2002-01-131-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Seigo Tanimura (tanimura) posted the initial delta. I've polished it quite a bit reducing the need for locking and adapting it for KSE. Locks: 1 mutex in each filedesc protects all the fields. protects "struct file" initialization, while a struct file is being changed from &badfileops -> &pipeops or something the filedesc should be locked. 1 mutex in each struct file protects the refcount fields. doesn't protect anything else. the flags used for garbage collection have been moved to f_gcflag which was the FILLER short, this doesn't need locking because the garbage collection is a single threaded container. could likely be made to use a pool mutex. 1 sx lock for the global filelist. struct file * fhold(struct file *fp); /* increments reference count on a file */ struct file * fhold_locked(struct file *fp); /* like fhold but expects file to locked */ struct file * ffind_hold(struct thread *, int fd); /* finds the struct file in thread, adds one reference and returns it unlocked */ struct file * ffind_lock(struct thread *, int fd); /* ffind_hold, but returns file locked */ I still have to smp-safe the fget cruft, I'll get to that asap.
* KSE Milestone 2julian2001-09-121-26/+26
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* After exhaustive discussions and some meandering and confusion, enoughdillon2001-06-241-0/+6
| | | | | | | | | | | | | | | people are on track with the cause and effect of this, and although fixing this severely degenerate case appears to violate the letter of POSIX.1-200x, Bruce and I (and enough others) agree that it should be comitted. So, this patch generates an ENOENT error for any attempt to do a path lookup through an empty symlink (e.g. open(), stat()). Submitted by: "Andrey A. Chernov" <ache@nagual.pp.ru> Reviewed by: bde Discussed exhaustively on: freebsd-current Previously committed to: NetBSD 4 years ago
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inmarkm2001-05-011-1/+1
| | | | | | | | | | | other "system" header files. Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files. Sort sys/*.h includes where possible in affected files. OK'ed by: bde (with reservations)
* Revert consequences of changes to mount.h, part 2.grog2001-04-291-2/+0
| | | | Requested by: bde
* Correct #includes to work with fixed sys/mount.h.grog2001-04-231-0/+2
|
* Untangle vfsinit() a bit. Use seperate sysinit functions rather thanpeter2000-12-061-0/+14
| | | | having a super-function calling bits all over the place.
* This is a fix for a problem described in PR kern/19572. It wasalfred2000-11-301-1/+11
| | | | | | | | | | | recently discussed at -hackers. The problem is a null-pointer dereference that happens in kern/vfs_lookup.c when accessing ".." with a v_mount entry for the current directory vnode of NULL. This happens when a volume is forcibly unmounted, and the vnode for a working directory in the mounted volume is cleared. PR: 23191 Submitted by: Thomas Moestl <tmoestl@gmx.net>
* Add new flag PDIRUNLOCK to the component.cn_flags which should be set bybp2000-09-171-2/+7
| | | | | | | | | | | | | | | | | | filesystem lookup() routine if it unlocks parent directory. This flag should be carefully tracked by filesystems if they want to work properly with nullfs and other stacked filesystems. VFS takes advantage of this flag to perform symantically correct usage of vrele() instead of vput() if parent directory already unlocked. If filesystem fails to track this flag then previous codepath in VFS left unchanged. Convert UFS code to set PDIRUNLOCK flag if necessary. Other filesystmes will be changed after some period of testing. Reviewed in general by: mckusick, dillon, adrian Obtained from: NetBSD
* Unlock current directory when calling VFS_ROOT() because underlyingbp2000-09-131-3/+10
| | | | | | | filesystem may hold the lock. Otherwise unavoidable deadlock will occur. This shouldn't have any side effects as long as we hold vfs lock. Obtained from: NetBSD
* Introduce NDFREE (and remove VOP_ABORTOP)eivind1999-12-151-3/+4
|
* Before we start to mess with the VFS name-cache clean things up a little bit:phk1999-10-031-8/+1
| | | | Isolate the namecache in its own file, and give it a dedicated malloc type.
* Fix a hole in jail(2).phk1999-09-251-1/+6
| | | | Noticed by: Alexander Bezroutchko <abb@zenon.net>
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Add sysctl and support code to allow directories to be VMIO'd. The defaultalc1999-07-261-3/+3
| | | | | | setting for the sysctl is OFF, which is the historical operation. Submitted by: dillon
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-281-2/+2
| | | | kernel compile
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-271-2/+2
| | | | kernel compile
* KNFize, by bde.eivind1999-01-101-4/+4
|
* Split DIAGNOSTIC -> DIAGNOSTIC, INVARIANTS, and INVARIANT_SUPPORT aseivind1999-01-081-21/+10
| | | | | | | | | discussed on -hackers. Introduce 'KASSERT(assertion, ("panic message", args))' for simple check + panic. Reviewed by: msmith
* Remove the 'waslocked' parameter to vfs_object_create().eivind1999-01-051-4/+6
|
* This commit fixes various 64bit portability problems required fordfr1998-06-071-3/+3
| | | | | | | | | | FreeBSD/alpha. The most significant item is to change the command argument to ioctl functions from int to u_long. This change brings us inline with various other BSD versions. Driver writers may like to use (__FreeBSD_version == 300003) to detect this change. The prototype FreeBSD/alpha machdep will follow in a couple of days time.
* New mount option nosymfollow. If enabled, the kernel lookup()wosch1998-04-081-1/+5
| | | | | function will not follow symbolic links on the mounted file system and return EACCES (Permission denied).
* Make the rootdir handling more consistent. Now, processes alwaysdyson1998-02-151-3/+3
| | | | | | have a root vnode associated with them, and no special checks for the null case are needed. Submitted by: terry@freebsd.org
* Back out DIAGNOSTIC changes.eivind1998-02-061-2/+1
|
* Turn DIAGNOSTIC into a new-style option.eivind1998-02-041-1/+2
|
* Make our v_usecount vnode reference count work identically to thedyson1998-01-061-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | original BSD code. The association between the vnode and the vm_object no longer includes reference counts. The major difference is that vm_object's are no longer freed gratuitiously from the vnode, and so once an object is created for the vnode, it will last as long as the vnode does. When a vnode object reference count is incremented, then the underlying vnode reference count is incremented also. The two "objects" are now more intimately related, and so the interactions are now much less complex. When vnodes are now normally placed onto the free queue with an object still attached. The rundown of the object happens at vnode rundown time, and happens with exactly the same filesystem semantics of the original VFS code. There is absolutely no need for vnode_pager_uncache and other travesties like that anymore. A side-effect of these changes is that SMP locking should be much simpler, the I/O copyin/copyout optimizations work, NFS should be more ponderable, and further work on layered filesystems should be less frustrating, because of the totally coherent management of the vnode objects and vnodes. Please be careful with your system while running this code, but I would greatly appreciate feedback as soon a reasonably possible.
* Lots of improvements, including restructring the caching and managementdyson1997-12-291-1/+7
| | | | | | | | | | | | | | of vnodes and objects. There are some metadata performance improvements that come along with this. There are also a few prototypes added when the need is noticed. Changes include: 1) Cleaning up vref, vget. 2) Removal of the object cache. 3) Nuke vnode_pager_uncache and friends, because they aren't needed anymore. 4) Correct some missing LK_RETRY's in vn_lock. 5) Correct the page range in the code for msync. Be gentle, and please give me feedback asap.
* Unspammed nested include of <vm/vm_zone.h>.bde1997-12-271-2/+3
|
* Change the M_NAMEI allocations to use the zone allocator. This changedyson1997-09-211-10/+10
| | | | | | | | plus the previous changes to use the zone allocator decrease the useage of malloc by half. The Zone allocator will be upgradeable to be able to use per CPU-pools, and has more intelligent usage of SPLs. Additionally, it has reasonable stats gathering capabilities, while making most calls inline.
* Removed unused #includes.bde1997-09-021-4/+1
|
* [Previous comment was incorrect for these files]dfr1997-04-041-1/+1
| | | | | Added calls to VFS lock debugging macros to make fixing filesystems' locking easier.
* Add a function vop_sharedlock which a copy of vop_nolock without thedfr1997-04-041-1/+7
| | | | | | | implementation #ifdef out. This can be used for now by NFS. As soon as all the other filesystems' locking is fixed, this can go away. Print the vnode address in vprint for easier debugging.
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* Fixed namei caching for LOOKUPs. It was broken for lstat() and olstat().bde1997-02-181-1/+2
| | | | | | | | | | | Successful lstat()s purged an existing entry as well as not caching the result. This bug was introduced in Lite1 by setting the LOCKPARENT flag for [o]lstat() in order to support the inherit-attributes-from-parent- directory misfeature for symlinks. LOCKPARENT was previously only set for CREATEs and DELETEs. It is now set for LOOKUPs, but only for [o]lstat(), so the problem wasn't very noticeable.
* This is the kernel Lite/2 commit. There are some requisite userlanddyson1997-02-101-26/+26
| | | | | | | | | | | | | | | changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes. The system boots and can mount UFS filesystems. Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed. Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org>
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Don't allow empty pathnames. POSIX standard.bde1996-12-011-1/+8
| | | | | | | | Most of the standard utilities that depended on (or were broken in a different way by) the old behaviour of interpreting "" as "." were fixed a year or two ago. There is still a fairly harmless bug in tar and a harmless bug in gzip. Tar apparently replaces "/" by "" when it strips leading slashes.
* Converted two options over to the new scheme: USER_LDT and KTRACE.wollman1996-01-031-1/+3
|
* Moved the filesystem read-only check out of the syscalls and into thedg1995-10-221-27/+13
| | | | | | | | filesystem layer, as was done in lite-2. Merged in some other cosmetic changes while I was at it. Rewrote most of msdosfs_access() to be more like ufs_access() and to include the FS read-only check. Obtained from: partially from 4.4BSD-lite2
* Add support for amd direct maps.dfr1995-08-241-18/+19
| | | | Reviewed by: Thomas Graichen <graichen@sirius.physik.fu-berlin.de>
OpenPOWER on IntegriCloud