summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_mount.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Introduce a new kevent filter. EVFILT_FS that will be used to signalalfred2004-07-041-0/+2
| | | | | | | | | | | generic filesystem events to userspace. Currently only mount and unmount of filesystems are signalled. Soon to be added, up/down status of NFS. Introduce a sysctl node used to route requests to/from filesystems based on filesystem ids. Introduce a new vfsop, vfs_sysctl(mp, req) that is used as the callback/ entrypoint by the sysctl code to change individual filesystems.
* When we traverse the vnodes on a mountpoint we need to look out forphk2004-07-041-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | our cached 'next vnode' being removed from this mountpoint. If we find that it was recycled, we restart our traversal from the start of the list. Code to do that is in all local disk filesystems (and a few other places) and looks roughly like this: MNT_ILOCK(mp); loop: for (vp = TAILQ_FIRST(&mp...); (vp = nvp) != NULL; nvp = TAILQ_NEXT(vp,...)) { if (vp->v_mount != mp) goto loop; MNT_IUNLOCK(mp); ... MNT_ILOCK(mp); } MNT_IUNLOCK(mp); The code which takes vnodes off a mountpoint looks like this: MNT_ILOCK(vp->v_mount); ... TAILQ_REMOVE(&vp->v_mount->mnt_nvnodelist, vp, v_nmntvnodes); ... MNT_IUNLOCK(vp->v_mount); ... vp->v_mount = something; (Take a moment and try to spot the locking error before you read on.) On a SMP system, one CPU could have removed nvp from our mountlist but not yet gotten to assign a new value to vp->v_mount while another CPU simultaneously get to the top of the traversal loop where it finds that (vp->v_mount != mp) is not true despite the fact that the vnode has indeed been removed from our mountpoint. Fix: Introduce the macro MNT_VNODE_FOREACH() to traverse the list of vnodes on a mountpoint while taking into account that vnodes may be removed from the list as we go. This saves approx 65 lines of duplicated code. Split the insmntque() which potentially moves a vnode from one mount point to another into delmntque() and insmntque() which does just what the names say. Fix delmntque() to set vp->v_mount to NULL while holding the mountpoint lock.
* Initialize ni_cnd.cn_cred before calling lookup() (this is normally donetmm2004-06-201-0/+1
| | | | | | | by namei(), which cannot easily be used here however). This fixes boot time crashes on sparc64 and probably other platforms. Reviewed by: phk
* Reduce the thaumaturgical level of root filesystem mounts: Instead of usingphk2004-06-171-9/+51
| | | | | | | an otherwise redundant clone routine in geom_disk.c, mount a temporary DEVFS and do a proper lookup. Submitted by: thomas
* Second half of the dev_t cleanup.phk2004-06-171-6/+6
| | | | | | | | | | | The big lines are: NODEV -> NULL NOUDEV -> NODEV udev_t -> dev_t udev2dev() -> findcdev() Various minor adjustments including handling of userland access to kernel space struct cdev etc.
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-8/+8
| | | | Bump __FreeBSD_version accordingly.
* Remove advertising clause from University of California Regent's license,imp2004-04-051-4/+0
| | | | | | per letter dated July 22, 1999. Approved by: core
* - Add a description for vfs.usermount sysctl.pjd2004-03-271-58/+54
| | | | | | | | - Add the vfs_equalopts() function for mount options comparsion. Now it looks much more clear. - Style fixed. In co-operation with: bde
* - Loudly disallow MNT_SUIDDIR mount flag for unprivileged users mounts.pjd2004-03-271-8/+7
| | | | | | - Style fixed. Submitted by: bde
* We probably shouldn't allow users to mount file systems with MNT_SUIDDIR.pjd2004-03-261-2/+4
| | | | | | | There should be not shell access when SUIDDIR is compiled in, but better be sure. Reviewed by: rwatson
* Make vfs_nmount() public. The Linux emulator needs this in order to mounttjr2004-03-161-2/+1
| | | | linprocfs filesystems.
* Remove unused mnt_reservedvnlist field.phk2004-03-111-1/+0
|
* 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
OpenPOWER on IntegriCloud