summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_mount.c
Commit message (Collapse)AuthorAgeFilesLines
* Don't ignore errors from vfs_allocate_syncvnode.cperciva2004-02-181-1/+1
| | | | | | PR: kern/18503 Submitted by: Anatoly Vorobey <mellon@pobox.com> Approved by: rwatson (mentor)
* Fix many issues related to mount/unmount:pjd2004-02-021-8/+33
| | | | | | | | | | | | | | | | | | | | | 1. Root from inside a jail was able to unmount any file system (except /). 2. Unprivileged root was able to unmount file systems mounted by privileged root (execpt /). 3. User from inside a jail was able to mount file system when sysctl vfs.usermount was set to 1. 4. User was able to mount file system when vfs.usermount was set to 1 (that's ok) and unmount it even if vfs.usermount was equal to 0 (that's not correct). Possibility from point 1 was reported by: Dariusz Kowalski <darek@76.pl> Only a part of this fix will be MFC'ed (if approved). PR: kern/60149 Reviewed by: rwatson Approved by: scottl (mentor) MFC after: 3 days
* In dounmount(), only call checkdirs() prior to VFS_UNMOUNT() in theiedowse2003-11-301-3/+7
| | | | | | | | | | | | | forced unmount case. Otherwise, a file system that is referenced only by process fd_cdir/fd_rdir references to the file system root vnode will be successfully unmounted without the MNT_FORCE flag. The previous behaviour was not compatible with the unmount semantics required by amd(8), so file systems could be unexpectedly unmounted while there were still references to the file system root directory. Reported by: Erez Zadok <ezk@cs.sunysb.edu> Approved by: re (scottl)
* Do not attempt to destroy NULL vfs options list.kan2003-11-231-1/+1
| | | | | Approved by: re (scottl) Reported by: Christian Laursen <xi atborderworlds dot dk>
* Fix a number of style(9) bugs introduced in r1.113 by me.kan2003-11-141-47/+46
| | | | Suggested by: bde
* MNAMELEN is back to an int again after Kirk's statfs commitpeter2003-11-121-1/+1
| | | | | kern/vfs_mount.c:1305: warning: signed size_t format, different type arg (arg 4) *** Error code 1
* 1. Consolidate mount struct allocation/destruction into a common code inkan2003-11-121-429/+171
| | | | | | | | | | | | | | | | | | | | | | | vfs_mount_alloc/vfs_mount_destroy functions and take care to completely destroy the mount point along with its locks. Mount struct has grown in coplexity recently and depending on each failure path to destroy it completely isn't working anymore. 2. Eliminate largely identical vfs_mount and vfs_unmount question by moving the code to handle both cases into a newly introduced vfs_domount function. 3. Simplify nfs_mount_diskless to always expect an allocated mount struct and never attempt an allocation/destruction itself. The vfs_allocroot allocation was there to support 'magic' swap space configuration for diskless clients that was already removed by PHK some time ago. 4. Include a vfs_buildopts cleanups by Peter Edwards to validate the sanity of nmount parameters passed from userland. Submitted by: (4) Peter Edwards <peter.edwards@openet-telecom.com> Reviewed by: rwatson
* Remove mntvnode_mtx and replace it with per-mountpoint mutex.kan2003-11-051-3/+4
| | | | | | | | | | Introduce two new macros MNT_ILOCK(mp)/MNT_IUNLOCK(mp) to operate on this mutex transparently. Eventually new mutex will be protecting more fields in struct mount, not only vnode list. Discussed with: jeff
* Update the list of CDROM device names to try for booting with RB_CDROMphk2003-09-261-3/+2
| | | | flag set.
* In the !MNT_BYFSID case, return EINVAL from unmount(2) when theiedowse2003-09-081-2/+9
| | | | | | | | | | | | | | specified directory is not found in the mount list. Before the MNT_BYFSID changes, unmount(2) used to return ENOENT for a nonexistent path and EINVAL for a non-mountpoint, but we can no longer distinguish between these cases. Of the two error codes, EINVAL was more likely to occur in practice, and it was the only one of the two that was documented. Update the manual page to match the current behaviour. Suggested by: tjr Reviewed by: tjr
* Add a new mount flag MNT_BYFSID that can be used to unmount a fileiedowse2003-07-011-23/+32
| | | | | | | | | | | | | | | | | | system by specifying the file system ID instead of a path. Use this by default in umount(8). This avoids the need to perform any vnode operations to look up the mount point, so it makes it possible to unmount a file system whose root vnode cannot be looked up (e.g. due to a dead NFS server, or a file system that has become detached from the hierarchy because an underlying file system was unmounted). It also provides an unambiguous way to specify which file system is to be unmunted. Since the ability to unmount using a path name is retained only for compatibility, that case now just uses a simple string comparison of the supplied path against f_mntonname of each mounted file system. Discussed on: freebsd-arch mdoc help from: ru
* Use __FBSDID().obrien2003-06-111-2/+3
|
* Improve the root-dev prompt facility for printing devices which couldphk2003-06-071-11/+2
| | | | possibly be a root filesystem.
* Free mount credentials (mnt_cred) when freeing the mount structtjr2003-04-241-0/+5
| | | | | in failure cases to avoid leaking struct ucreds, and ultimately leaking struct uidinfo references.
* Add /dev to the Alpha manual mount root example.obrien2003-04-231-1/+1
|
* Adjust the number of vnodes scanned by vlrureclaim() according to thetegge2003-03-261-0/+3
| | | | size of the vnode list.
* Export the name of the device used to mount the root file system asrwatson2003-02-221-0/+24
| | | | | | | kern.rootdev. If rootdev is undefined (NFS mount, etc), export an empty string. Desired by: peter
* Back out M_* changes, per decision of the TRB.imp2003-02-191-17/+17
| | | | Approved by: trb
* Fix LOR with PROC/filedesc. Introduce fdesc_mtx that will be used as aalfred2003-02-151-3/+3
| | | | | | barrier between free'ing filedesc structures. Basically if you want to access another process's filedesc, you want to hold this mutex over the entire operation.
* Style nit.des2003-02-141-4/+2
|
* KASSERT format string does not need newline terminationalfred2003-02-141-2/+2
|
* Add kasserts to catch bad API usage.alfred2003-02-141-0/+6
| | | | Submitted by: Hiten Pandya <hiten@unixdaemons.com>
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-17/+17
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* When compiling the kernel do not implicitly include filedesc.h from proc.h,alfred2003-01-011-0/+1
| | | | | | this was causing filedesc work to be very painful. In order to make this work split out sigio definitions to thier own header (sigio.h) which is included from proc.h for the time being.
* unwrap lines made short enough by SCARGS removalalfred2002-12-141-4/+2
|
* remove syscallarg().alfred2002-12-141-9/+9
| | | | Suggested by: peter
* SCARGS removal take II.alfred2002-12-141-8/+8
|
* Backout removal SCARGS, the code freeze is only "selectively" over.alfred2002-12-131-8/+8
|
* Remove SCARGS.alfred2002-12-131-8/+8
| | | | Reviewed by: md5
* - Use a better definition for MNAMELEN which doesn't requiremux2002-11-071-1/+1
| | | | | | | to have one #ifdef per architecture. - Change a space to a tab after a nearby #define. Obtained from: bde
* #include <geom/geom.h> to get proper prototypes. Contrary to my fears wephk2002-10-251-10/+12
| | | | | | | | | | | seem to have all the prerequisites already. Call g_waitidle() as the first thing in vfs_mountroot() so that we have it out of the way before we even decide if we should call .._ask() or .._try(). Call the g_dev_print() function to provide better guidance for the root-mount prompt.
* Make sure GEOM has stopped rattling the disks before we try to mountphk2002-10-241-0/+4
| | | | the root filesystem, this may be implicated in the PC98 issue.
* This update removes a race between unmount and lookup. The lookupmckusick2002-10-221-4/+1
| | | | | | | | | | | locks the mount point directory while waiting for vfs_busy to clear. Meanwhile the unmount which holds the vfs_busy lock tried to lock the mount point vnode. The fix is to observe that it is safe for the unmount to remove the vnode from the mount point without locking it. The lookup will wait for the unmount to complete, then recheck the mount point when the vfs_busy lock clears. Sponsored by: DARPA & NAI Labs.
* GEOM does not (and shall not) propagate flags like D_MEMDISK, so we willphk2002-10-211-11/+11
| | | | | | | revert to checking the name to determine if our root device is a ramdisk, md(4) specifically to determine if we should attempt the root-mount RW Sponsored by: DARPA & NAI Labs.
* - Don't protect mountedhere with the vn interlock.jeff2002-09-251-5/+7
| | | | - Protect mountedhere with the vn lock.
* Switch to using strlcpy() in several places. It seems theremux2002-09-191-7/+7
| | | | were cases where we could get unterminated strings before.
* Keep a copy of the credential used to mount filesystems around sophk2002-08-191-3/+7
| | | | | | | | | | | | | | | | | we can check and use it later on. Change the pieces of code which relied on mount->mnt_stat.f_owner to check which user mounted the filesystem. This became needed as the EA code needs to be able to allocate blocks for "system" EA users like ACLs. There seems to be some half-baked (probably only quarter- actually) notion that the superuser for a given filesystem is the user who mounted it, but this has far from been carried through. It is unclear if it should be. Sponsored by: DARPA & NAI Labs.
* - Replace v_flag with v_iflag and v_vflagjeff2002-08-041-47/+50
| | | | | | | | | | | | | | | - 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
* Make the consumers of the linker_load_file() function usemux2002-08-021-2/+2
| | | | | | | | | | | | | linker_load_module() instead. This fixes a bug where the kernel was unable to properly locate and load a kernel module in vfs_mount() (and probably in the netgraph code as well since it was using the same function). This is because the linker_load_file() does not properly search the module path. Problem found by: peter Reviewed by: peter Thanks to: peter
* Include file cleanup; mac.h and malloc.h at one point had orderingrwatson2002-08-011-1/+1
| | | | | | relationship requirements, and no longer do. Reminded by: bde
* Introduce support for Mandatory Access Control and extensiblerwatson2002-07-311-1/+33
| | | | | | | | | | | | | | | kernel access control. Invoke the necessary MAC entry points to maintain labels on mount structures. In particular, invoke entry points for intialization and destruction in various scenarios (root, non-root). Also introduce an entry point in the boot procedure following the mount of the root file system, but prior to the start of the userland init process to permit policies to perform further initialization. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* - Backout the patch made in revision 1.75 of vfs_mount.c. The vputs herejeff2002-07-291-3/+3
| | | | | | | were hiding the real problem of the missing unlock in sync_inactive. - Add the missing unlock in sync_inactive. Submitted by: iedowse
* Fix a stupid bug where I wasn't initializing the namesmux2002-07-241-9/+10
| | | | of 0-length mount options.
* - Merge the mount options at MNT_UPDATE time with vfs_mergeopts().mux2002-07-191-19/+113
| | | | | | | | - Sanity check the mount options list (remove duplicates) with vfs_sanitizeopts(). - Fix some malloc(0)/free(NULL) bugs. Reviewed by: rwatson (some time ago)
* - Use standard locking functions in syncer's opvjeff2002-07-091-3/+3
| | | | | - vput instead of vrele syncer vnodes in vfs_mount - Add vop_lookup_{pre,post} to verify locking in VOP_LOOKUP
* Add a VFS_START() call in vfs_mountroot_try() for the sakemux2002-07-081-1/+2
| | | | | | | | | of being correct. None of the root mountable filesystems do something at VFS_START(). Shorten a comment to fix a style bug while I'm here. PR: kern/18505
* Include systm.h before vnode.h so Debugger() and printf() are available whenjeff2002-07-051-1/+1
| | | | full vnode lock debugging is enabled.
* Move vfs_rootmountalloc() in vfs_mount.c and remove lite2_vfs_mountroot()mux2002-07-031-0/+44
| | | | which was #if 0'd and is not likely to be used now.
* Remove an unused argument in vfs_mountroot().mux2002-07-031-1/+1
|
* I didn't pay enough attention when copy/pasting disclaimers.mux2002-07-021-2/+2
| | | | The disclaimer in vfs_conf.c was slightly different. Fix this.
OpenPOWER on IntegriCloud