summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_mount.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r308618:kib2016-11-271-0/+6
| | | | | Provide simple mutual exclusion between mount point update and unmount. In the update path in ffs_mount(), drop vfs_busy() reference around namei().
* MFC r299913: dounmount: do not call mountcheckdirs() for mounts with MNT_IGNOREavg2016-07-131-2/+4
|
* MFC r301929:kib2016-06-221-3/+18
| | | | | Do not assume that we own the use reference on the covered vnode until we set MNTK_UNMOUNT flag on the mp.
* MFC r287107:trasz2016-01-121-0/+2
| | | | | | | | | Make vfs_unmountall() unmount /dev after /, not before. The only reason this didn't result in an unclean shutdown is that devfs ignores MNT_FORCE flag. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3467
* MFC r285039:kib2015-07-281-3/+0
| | | | Remove asserts which might reference freed memory.
* MFC r283602:kib2015-06-101-15/+15
| | | | | | | | | Prevent dounmount() from acting on the freed (although type-stable) memory by changing the interface to require the mount point to be referenced. MFC r283629: Add missed {}.
* MFC r278523:kib2015-02-241-2/+8
| | | | In mountd, silence a race with the parallel unmount.
* MFC r275638:kib2014-12-301-2/+2
| | | | Do not call VFS_SYNC() before VFS_UNMOUNT() for forced unmount.
* MFC r270096:trasz2014-08-311-0/+4
| | | | | | | | | | | | | Bring in the new automounter, similar to what's provided in most other UNIX systems, eg. MacOS X and Solaris. It uses Sun-compatible map format, has proper kernel support, and LDAP integration. There are still a few outstanding problems; they will be fixed shortly. Reviewed by: allanjude@, emaste@, kib@, wblock@ (earlier versions) Phabric: D523 Relnotes: yes Sponsored by: The FreeBSD Foundation
* MFC r269457:kib2014-08-171-23/+5
| | | | Remove Giant acquisition from the mount and unmount pathes.
* MFC r264385:bdrewery2014-05-141-1/+1
| | | | Use proper MFSNAMELEN for fs type.
* Change len checks for fstypelen and fspathlen to be against absolute lensbruno2013-10-031-1/+1
| | | | | | | | | | | | | not strlen as they are *not* strings. Discovered by GSOC student, Mike Ma <mikemandarine@gmail.com> during his fuse.glusterfs port to FreeBSD. Final patch from mckusick@ Submitted by: mckusick@ Approved by: re (hrs) MFC after: 2 weeks
* Forced dismounts of NFS mounts can fail when thread(s) are stuckrmacklem2013-09-011-1/+9
| | | | | | | | | | | | | | waiting for an RPC reply from the server while holding the mount point busy (mnt_lockref incremented). This happens because dounmount() msleep()s waiting for mnt_lockref to become 0, before calling VFS_UNMOUNT(). This patch adds a new VFS operation called VFS_PURGE(), which the NFS client implements as purging RPCs in progress. Making this call before checking mnt_lockref fixes the problem, by ensuring that the VOP_xxx() calls will fail and unbusy the mount point. Reported by: sbruno Reviewed by: kib MFC after: 2 weeks
* Add vfs_mounted and vfs_unmounted events so that components can be informedmarcel2013-07-101-1/+3
| | | | | | | | | | | | | | | | | about mount and unmount events. This is used by Juniper to implement a more optimal implementation of NetBSD's veriexec. This change differs from r253224 in the following way: o The vfs_mounted handler is called before mountcheckdirs() and with newdp locked. vp is unlocked. o The event handlers are declared in <sys/eventhandler.h> and not in <sys/mount.h>. The <sys/mount.h> header is used in user land code that pretends to be kernel code and as such creates a very convoluted environment. It's hard to untangle. Submitted by: stevek@juniper.net Discussed with: pjd@ Obtained from: Juniper Networks, Inc.
* Revert r251590. It unexpectedly broke the build and there were somemarcel2013-06-101-2/+0
| | | | | questions on locking. As part of commit-bit grooming, I'd like Steve to handle this, but can't leave things broken in the mean time.
* Add vfs_mounted and vfs_unmounted events so that components can be informedmarcel2013-06-091-0/+2
| | | | | | | | about mount and unmount events. This is used by Juniper to implement a more optimal implementation of NetBSD's veriexec. Submitted by: stevek@juniper.net Obtained from: Juniper Networks, Inc
* - Correct mispellings of the word occurrencegabor2013-04-171-1/+1
| | | | Submitted by: Christoph Mallon <christoph.mallon@gmx.de> (via private mail)
* When the journaled FFS volume is suspended due to the journal spacekib2013-03-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | becoming too low, the softdep flush thread processes the workitems, which frees the space in journal, and then unsuspends the fs. The softdep_flush() and other workitem processing functions busy the filesystem before iterating over the worklist, to prevent the parallel unmount from freeing the mount data. The vfs_busy() is called with MBF_NOWAIT flag. Now, if the unmount is already started and the filesystem is suspended due to low journal space, the journal is never flushed and filesystem is never unsuspended, because vfs_busy(MBF_NOWAIT) call cannot succeed for the unmounting fs, and softdep_flush() does not process the workitems. Unmount needs to write metadata, where it hangs in the "suspfs" state. Move the vn_start_write() call in the dounmount() before setting the MNTK_UNMOUNT flag. This practically ensures that softdep_flush() processed the pending journal writes by making dounmount() wait for the lift of the suspension. Sponsored by: The FreeBSD Foundation Reported and tested by: pho MFC after: 2 weeks
* Revert revision 244760 because strncpy pads trailing space with zero,davidxu2013-01-041-3/+3
| | | | | | this prevents kernel data from being leaked. Noticed by: Joerg Sonnenberger &lt; joerg at britannica dot bec dot de &gt;
* Remove the deprecated MNT_VNODE_FOREACH interface. Use thekib2013-01-031-97/+0
| | | | MNT_VNODE_FOREACH_ALL instead.
* Use strlcpy to NULL-terminate error message even if user provided a shortdavidxu2012-12-281-3/+3
| | | | buffer.
* Fixup r218424: uio_yield() was scaling directly to userland priority.attilio2012-12-211-1/+1
| | | | | | | | | | | | | | | When kern_yield() was introduced with the possibility to specify a new priority, the behaviour changed by not lowering priority at all in the consumers, making the yielding mechanism highly ineffective for high priority kthreads like bufdaemon, syncer, vlrudaemon, etc. There are no evidences that consumers could bear with such change in semantic and this situation could finally lead to bugs similar to the ones fixed in r244240. Re-specify userland pri for kthreads involved. Tested by: pho Reviewed by: kib, mdf MFC after: 1 week
* Fix typo.kib2012-12-091-1/+1
| | | | MFC after: 3 days
* IFp4 @208450:pjd2012-11-301-1/+0
| | | | | | | | Remove redundant call to AUDIT_ARG_UPATH1(). Path will be remembered by the following NDINIT(AUDITVNODE1) call. Sponsored by: FreeBSD Foundation (auditdistd) MFC after: 2 weeks
* Remove the support for using non-mpsafe filesystem modules.kib2012-10-221-23/+4
| | | | | | | | | | | | In particular, do not lock Giant conditionally when calling into the filesystem module, remove the VFS_LOCK_GIANT() and related macros. Stop handling buffers belonging to non-mpsafe filesystems. The VFS_VERSION is bumped to indicate the interface change which does not result in the interface signatures changes. Conducted and reviewed by: attilio Tested by: pho
* Add a facility for vgone() to inform the set of subscribed mountskib2012-09-091-1/+4
| | | | | | | | | | | | | | | | | about vnode reclamation. Typical use is for the bypass mounts like nullfs to get a notification about lower vnode going away. Now, vgone() calls new VFS op vfs_reclaim_lowervp() with an argument lowervp which is reclaimed. It is possible to register several reclamation event listeners, to correctly handle the case of several nullfs mounts over the same directory. For the filesystem not having nullfs mounts over it, the overhead added is a single mount interlock lock/unlock in the vnode reclamation path. In collaboration with: pho MFC after: 3 weeks
* This change creates a new list of active vnodes associated withmckusick2012-04-201-0/+4
| | | | | | | | | | | | | | | | | | | | a mount point. Active vnodes are those with a non-zero use or hold count, e.g., those vnodes that are not on the free list. Note that this list is in addition to the list of all the vnodes associated with a mount point. To avoid adding another set of linkage pointers to the vnode structure, the active list uses the existing linkage pointers used by the free list (previously named v_freelist, now renamed v_actfreelist). This update adds the MNT_VNODE_FOREACH_ACTIVE interface that loops over just the active vnodes associated with a mount point (typically less than 1% of the vnodes associated with the mount point). Reviewed by: kib Tested by: Peter Holm MFC after: 2 weeks
* Replace the MNT_VNODE_FOREACH interface with MNT_VNODE_FOREACH_ALL.mckusick2012-04-171-4/+6
| | | | | | | | | | | | | | | | | | | | | The primary changes are that the user of the interface no longer needs to manage the mount-mutex locking and that the vnode that is returned has its mutex locked (thus avoiding the need to check to see if its is DOOMED or other possible end of life senarios). To minimize compatibility issues for third-party developers, the old MNT_VNODE_FOREACH interface will remain available so that this change can be MFC'ed to 9. Following the MFC to 9, MNT_VNODE_FOREACH will be removed in head. The reason for this update is to prepare for the addition of the MNT_VNODE_FOREACH_ACTIVE interface that will loop over just the active vnodes associated with a mount point (typically less than 1% of the vnodes associated with the mount point). Reviewed by: kib Tested by: Peter Holm MFC after: 2 weeks
* Add vfs_getopt_size. Support human readable file system options in tmpfs.gleb2012-04-071-0/+42
| | | | | | | Increase maximum tmpfs file system size to 4GB*PAGE_SIZE on 32 bit archs. Discussed with: delphij MFC after: 2 weeks
* Decomission mnt_noasync. Introduce MNTK_NOASYNC mnt_kern_flag whichkib2012-03-091-3/+6
| | | | | | allows a filesystem to request VFS to not allow MNTK_ASYNC. MFC after: 1 week
* Analogous to r230407 a separate path buffer in vfs_mount.c is requiredmm2012-02-051-2/+6
| | | | | | for r230129. Fixes a out of bounds write to fspath. MFC after: 10 days
* Make sure all intermediate variables holding mount flags (mnt_flag)mckusick2012-01-171-19/+36
| | | | | | | and that all internal kernel calls passing mount flags are declared as uint64_t so that flags in the top 32-bits are not lost. MFC after: 2 weeks
* Introduce vn_path_to_global_path()mm2012-01-151-5/+24
| | | | | | | | | | | | | This function updates path string to vnode's full global path and checks the size of the new path string against the pathlen argument. In vfs_domount(), sys_unmount() and kern_jail_set() this new function is used to update the supplied path argument to the respective global path. Unbreaks jailed zfs(8) with enforce_statfs set to 1. Reviewed by: kib MFC after: 1 month
* Introduce the option VFS_ALLOW_NONMPSAFE and turn it on by default onattilio2011-11-081-0/+15
| | | | | | | | | | | | | | all the architectures. The option allows to mount non-MPSAFE filesystem. Without it, the kernel will refuse to mount a non-MPSAFE filesytem. This patch is part of the effort of killing non-MPSAFE filesystems from the tree. No MFC is expected for this patch. Tested by: gianni Reviewed by: kib
* Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.ed2011-11-071-1/+1
| | | | This means that their use is restricted to a single C file.
* When unmounting a filesystem always wait for the vfs_busy lock to clearmckusick2011-10-111-12/+0
| | | | | | | | | | | so that if no vnodes in the filesystem are actively in use the unmount will succeed rather than failing with EBUSY. Reported by: Garrett Cooper Reviewed by: Attilio Rao and Kostik Belousov Tested by: Garrett Cooper PR: kern/161016 MFC after: 3 weeks
* In order to maximize the re-usability of kernel code in user space thiskmacy2011-09-161-3/+3
| | | | | | | | | | | | | patch modifies makesyscalls.sh to prefix all of the non-compatibility calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel entry points and all places in the code that use them. It also fixes an additional name space collision between the kernel function psignal and the libc function of the same name by renaming the kernel psignal kern_psignal(). By introducing this change now we will ease future MFCs that change syscalls. Reviewed by: rwatson Approved by: re (bz)
* Revert r224655 and r224614 because vn_fullpath* does not always workmm2011-08-081-79/+7
| | | | | | | | | on nullfs mounts. Change shall be reconsidered after 9.0 is released. Requested by: re (kib) Approved by: re (kib)
* The change in r224615 didn't take into account that vn_fullpath_global()mm2011-08-051-31/+68
| | | | | | | | | | | | | | | doesn't operate on locked vnode. This could cause a panic. Fix by unlocking vnode, re-locking afterwards and verifying that it wasn't renamed or deleted. To improve readability and reduce code size, move code to a new static function vfs_verify_global_path(). In addition, fix missing giant unlock in unmount(). Reported by: David Wolfskill <david@catwhisker.org> Reviewed by: kib Approved by: re (bz) MFC after: 2 weeks
* For mount, discover f_mntonname from supplied path argumentmm2011-08-021-7/+42
| | | | | | | | | | | | using vn_fullpath_global(). This fixes f_mntonname if mounting inside chroot, jail or with relative path as argument. For unmount in jail, use vn_fullpath_global() to discover global path from supplied path argument. This fixes unmount in jail. Reviewed by: pjd, kib Approved by: re (kib) MFC after: 2 weeks
* This update changes the mnt_flag field in the mount structure frommckusick2011-07-241-1/+2
| | | | | | | | | | 32 bits to 64 bits and eliminates the unused mnt_xflag field. The existing mnt_flag field is completely out of bits, so this update gives us room to expand. Note that the f_flags field in the statfs structure is already 64 bits, so the expanded mnt_flag field can be exported without having to make any changes in the statfs structure. Approved by: re (bz)
* Include sys/sbuf.h directly.ae2011-07-111-0/+1
|
* Use a name instead of a magic number for kern_yield(9) when the prioritymdf2011-05-131-1/+1
| | | | | | | | should not change. Fetch the td_user_pri under the thread lock. This is probably not necessary but a magic number also seems preferable to knowing the implementation details here. Requested by: Jason Behmer < jason DOT behmer AT isilon DOT com >
* Utilize vfs_sanitizeopts() in vfs_mergeopts() to merge options. Becausejh2011-04-221-57/+14
| | | | | | | | | | | vfs_sanitizeopts() can handle "ro" and "rw" options properly, there is no more need to add "noro" in vfs_donmount() to cancel "ro". This also fixes a problem of canceling options beginning with "no". For example, "noatime" didn't cancel "nonoatime". Thus it was possible that both "noatime" and "nonoatime" were active at the same time. Reviewed by: bde
* Fix some style issues in r219925.jh2011-03-261-5/+2
| | | | | Reported by: bde MFC after: 1 month
* Recognize "ro", "rdonly", "norw", "rw" and "noro" as equal options injh2011-03-231-0/+26
| | | | | | | | | | vfs_equalopts(). This allows vfs_sanitizeopts() to filter redundant occurrences of these options. It was possible that for example both "ro" and "rw" options became active concurrently. PR: kern/133614 Discussed on: freebsd-hackers MFC after: 1 month
* Don't restore old mount options and flags if VFS_MOUNT(9) succeeds butjh2011-02-191-26/+29
| | | | | | | | | | vfs_export() fails. Restoring old options and flags after successful VFS_MOUNT(9) call may cause the file system internal state to become inconsistent with mount options and flags. Specifically the FFS super block fs_ronly field and the MNT_RDONLY flag may get out of sync. PR: kern/133614 Discussed on: freebsd-hackers
* Based on discussions on the svn-src mailing list, rework r218195:mdf2011-02-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | - entirely eliminate some calls to uio_yeild() as being unnecessary, such as in a sysctl handler. - move should_yield() and maybe_yield() to kern_synch.c and move the prototypes from sys/uio.h to sys/proc.h - add a slightly more generic kern_yield() that can replace the functionality of uio_yield(). - replace source uses of uio_yield() with the functional equivalent, or in some cases do not change the thread priority when switching. - fix a logic inversion bug in vlrureclaim(), pointed out by bde@. - instead of using the per-cpu last switched ticks, use a per thread variable for should_yield(). With PREEMPTION, the only reasonable use of this is to determine if a lock has been held a long time and relinquish it. Without PREEMPTION, this is essentially the same as the per-cpu variable.
* Put the general logic for being a CPU hog into a new functionmdf2011-02-021-2/+1
| | | | | | | | | | should_yield(). Use this in various places. Encapsulate the common case of check-and-yield into a new function maybe_yield(). Change several checks for a magic number of iterations to use should_yield() instead. MFC after: 1 week
* Replace spaces with tabs.jh2011-01-241-2/+2
|
OpenPOWER on IntegriCloud