summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_lookup.c
Commit message (Collapse)AuthorAgeFilesLines
* - Tweak kern_msgctl() to return a copy of the requested message queue idjhb2005-02-071-0/+113
| | | | | | | | | | | | | | | | | structure in the struct pointed to by the 3rd argument for IPC_STAT and get rid of the 4th argument. The old way returned a pointer into the kernel array that the calling function would then access afterwards without holding the appropriate locks and doing non-lock-safe things like copyout() with the data anyways. This change removes that unsafeness and resulting race conditions as well as simplifying the interface. - Implement kern_foo wrappers for stat(), lstat(), fstat(), statfs(), fstatfs(), and fhstatfs(). Use these wrappers to cut out a lot of code duplication for freebsd4 and netbsd compatability system calls. - Add a new lookup function kern_alternate_path() that looks up a filename under an alternate prefix and determines which filename should be used. This is basically a more general version of linux_emul_convpath() that can be shared by all the ABIs thus allowing for further reduction of code duplication.
* Don't call VOP_CREATEVOBJECT(), it's the responsibility of thephk2005-01-241-10/+0
| | | | filesystem which owns the vnode.
* - Acquire and release Giant as we enter and leave filesystems whichjeff2005-01-241-6/+37
| | | | | | | | | require it. - Track the status of Giant with the nd flag HASGIANT. - Release giant on return of namei() callers are not marked MPSAFE as they already own giant. Sponsored By: Isilon Systems, Inc.
* Ditch vfs_object_create() and make the callers call VOP_CREATEVOBJECT()phk2005-01-131-3/+3
| | | | directly.
* /* -> /*- for copyright notices, minor format tweaks as necessaryimp2005-01-061-1/+1
|
* Make NAMEI_DIAGNOSTIC compile again and add a stragic vprint()phk2004-12-031-8/+9
|
* Assert Giant in namei(). Bugs have been reported in which, followingrwatson2004-08-041-0/+2
| | | | | | | a sleep() call waking up in namei(), a later assertion triggers that Giant is not held. By asserting Giant at the start of namei(), we can know that if that assertion triggers, Giant is lost during the call to namei(), and not before.
* Make VFS_ROOT() and vflush() take a thread argument.alfred2004-07-121-1/+1
| | | | | | This is to allow filesystems to decide based on the passed thread which vnode to return. Several filesystems used curthread, they now use the passed thread.
* Remove advertising clause from University of California Regent's license,imp2004-04-051-4/+0
| | | | | | per letter dated July 22, 1999. Approved by: core
* Use __FBSDID().obrien2003-06-111-1/+3
|
* Back out M_* changes, per decision of the TRB.imp2003-02-191-2/+2
| | | | Approved by: trb
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-2/+2
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* 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
|
OpenPOWER on IntegriCloud