FreeBSD kernel kern code
vfs_mount.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/smp.h>
#include <sys/devctl.h>
#include <sys/eventhandler.h>
#include <sys/fcntl.h>
#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/libkern.h>
#include <sys/limits.h>
#include <sys/malloc.h>
#include <sys/mount.h>
#include <sys/mutex.h>
#include <sys/namei.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/filedesc.h>
#include <sys/reboot.h>
#include <sys/sbuf.h>
#include <sys/syscallsubr.h>
#include <sys/sysproto.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/sysent.h>
#include <sys/systm.h>
#include <sys/taskqueue.h>
#include <sys/vnode.h>
#include <vm/uma.h>
#include <geom/geom.h>
#include <machine/stdarg.h>
#include <security/audit/audit.h>
#include <security/mac/mac_framework.h>
Include dependency graph for vfs_mount.c:

Go to the source code of this file.

Data Structures

struct  nmount_args
 
struct  mount_args
 
struct  unmount_args
 
struct  vfs_op_barrier_ipi
 
struct  mntaarg
 
struct  mntarg
 

Macros

#define VFS_MOUNTARG_SIZE_MAX   (1024 * 64)
 
#define DEVCTL_LEN   1024
 

Functions

 __FBSDID ("$FreeBSD$")
 
static int vfs_domount (struct thread *td, const char *fstype, char *fspath, uint64_t fsflags, struct vfsoptlist **optlist)
 
static void free_mntarg (struct mntarg *ma)
 
 SYSCTL_INT (_vfs, OID_AUTO, usermount, CTLFLAG_RW, &usermount, 0, "Unprivileged users may mount and unmount file systems")
 
 SYSCTL_BOOL (_vfs, OID_AUTO, default_autoro, CTLFLAG_RW, &default_autoro, 0, "Retry failed r/w mount as r/o if no explicit ro/rw option is specified")
 
 SYSCTL_BOOL (_vfs, OID_AUTO, recursive_forced_unmount, CTLFLAG_RW, &recursive_forced_unmount, 0, "Recursively unmount stacked upper mounts" " when a file system is forcibly unmounted")
 
static SYSCTL_NODE (_vfs, OID_AUTO, deferred_unmount, CTLFLAG_RD|CTLFLAG_MPSAFE, 0, "deferred unmount controls")
 
 SYSCTL_UINT (_vfs_deferred_unmount, OID_AUTO, retry_limit, CTLFLAG_RW, &deferred_unmount_retry_limit, 0, "Maximum number of retries for deferred unmount failure")
 
 SYSCTL_INT (_vfs_deferred_unmount, OID_AUTO, retry_delay_hz, CTLFLAG_RW, &deferred_unmount_retry_delay_hz, 0, "Delay in units of [1/kern.hz]s when retrying a failed deferred unmount")
 
 SYSCTL_INT (_vfs_deferred_unmount, OID_AUTO, total_retries, CTLFLAG_RD, &deferred_unmount_total_retries, 0, "Total number of retried deferred unmounts")
 
 MALLOC_DEFINE (M_MOUNT, "mount", "vfs mount structure")
 
 MALLOC_DEFINE (M_STATFS, "statfs", "statfs structure")
 
 EVENTHANDLER_LIST_DEFINE (vfs_mounted)
 
 EVENTHANDLER_LIST_DEFINE (vfs_unmounted)
 
static void vfs_deferred_unmount (void *arg, int pending)
 
 MTX_SYSINIT (deferred_unmount, &deferred_unmount_lock, "deferred_unmount", MTX_DEF)
 
static STAILQ_HEAD (mount)
 
static int mount_init (void *mem, int size, int flags)
 
static void mount_fini (void *mem, int size)
 
static void vfs_mount_init (void *dummy __unused)
 
 SYSINIT (vfs_mount, SI_SUB_VFS, SI_ORDER_ANY, vfs_mount_init, NULL)
 
static void vfs_freeopt (struct vfsoptlist *opts, struct vfsopt *opt)
 
void vfs_freeopts (struct vfsoptlist *opts)
 
void vfs_deleteopt (struct vfsoptlist *opts, const char *name)
 
static int vfs_isopt_ro (const char *opt)
 
static int vfs_isopt_rw (const char *opt)
 
static int vfs_equalopts (const char *opt1, const char *opt2)
 
static void vfs_sanitizeopts (struct vfsoptlist *opts)
 
int vfs_buildopts (struct uio *auio, struct vfsoptlist **options)
 
static void vfs_mergeopts (struct vfsoptlist *toopts, struct vfsoptlist *oldopts)
 
int sys_nmount (struct thread *td, struct nmount_args *uap)
 
struct mount * vfs_ref_from_vp (struct vnode *vp)
 
void vfs_ref (struct mount *mp)
 
struct mount * vfs_register_upper_from_vp (struct vnode *vp, struct mount *ump, struct mount_upper_node *upper)
 
void vfs_register_for_notification (struct mount *mp, struct mount *ump, struct mount_upper_node *upper)
 
static void vfs_drain_upper_locked (struct mount *mp)
 
void vfs_unregister_for_notification (struct mount *mp, struct mount_upper_node *upper)
 
void vfs_unregister_upper (struct mount *mp, struct mount_upper_node *upper)
 
void vfs_rel (struct mount *mp)
 
struct mount * vfs_mount_alloc (struct vnode *vp, struct vfsconf *vfsp, const char *fspath, struct ucred *cred)
 
void vfs_mount_destroy (struct mount *mp)
 
static bool vfs_should_downgrade_to_ro_mount (uint64_t fsflags, int error)
 
int vfs_donmount (struct thread *td, uint64_t fsflags, struct uio *fsoptions)
 
int sys_mount (struct thread *td, struct mount_args *uap)
 
static int vfs_domount_first (struct thread *td, struct vfsconf *vfsp, char *fspath, struct vnode *vp, uint64_t fsflags, struct vfsoptlist **optlist)
 
static int vfs_domount_update (struct thread *td, struct vnode *vp, uint64_t fsflags, struct vfsoptlist **optlist)
 
int sys_unmount (struct thread *td, struct unmount_args *uap)
 
int kern_unmount (struct thread *td, const char *path, int flags)
 
static int vfs_check_usecounts (struct mount *mp)
 
static void dounmount_cleanup (struct mount *mp, struct vnode *coveredvp, int mntkflags)
 
void vfs_op_enter (struct mount *mp)
 
void vfs_op_exit_locked (struct mount *mp)
 
void vfs_op_exit (struct mount *mp)
 
static void vfs_op_action_func (void *arg)
 
static void vfs_op_wait_func (void *arg, int cpu)
 
void vfs_op_barrier_wait (struct mount *mp)
 
int vfs_mount_fetch_counter (struct mount *mp, enum mount_counter which)
 
static bool deferred_unmount_enqueue (struct mount *mp, uint64_t flags, bool requeue, int timeout_ticks)
 
static void vfs_deferred_unmount (void *argi __unused, int pending __unused)
 
int dounmount (struct mount *mp, uint64_t flags, struct thread *td)
 
void vfs_mount_error (struct mount *mp, const char *fmt,...)
 
void vfs_opterror (struct vfsoptlist *opts, const char *fmt,...)
 
int vfs_filteropt (struct vfsoptlist *opts, const char **legal)
 
int vfs_getopt (struct vfsoptlist *opts, const char *name, void **buf, int *len)
 
int vfs_getopt_pos (struct vfsoptlist *opts, const char *name)
 
int vfs_getopt_size (struct vfsoptlist *opts, const char *name, off_t *value)
 
char * vfs_getopts (struct vfsoptlist *opts, const char *name, int *error)
 
int vfs_flagopt (struct vfsoptlist *opts, const char *name, uint64_t *w, uint64_t val)
 
int vfs_scanopt (struct vfsoptlist *opts, const char *name, const char *fmt,...)
 
int vfs_setopt (struct vfsoptlist *opts, const char *name, void *value, int len)
 
int vfs_setopt_part (struct vfsoptlist *opts, const char *name, void *value, int len)
 
int vfs_setopts (struct vfsoptlist *opts, const char *name, const char *value)
 
int vfs_copyopt (struct vfsoptlist *opts, const char *name, void *dest, int len)
 
int __vfs_statfs (struct mount *mp, struct statfs *sbp)
 
void vfs_mountedfrom (struct mount *mp, const char *from)
 
struct mntargmount_argb (struct mntarg *ma, int flag, const char *name)
 
struct mntargmount_argf (struct mntarg *ma, const char *name, const char *fmt,...)
 
struct mntargmount_argsu (struct mntarg *ma, const char *name, const void *val, int len)
 
struct mntargmount_arg (struct mntarg *ma, const char *name, const void *val, int len)
 
int kernel_mount (struct mntarg *ma, uint64_t flags)
 
static void mount_devctl_event (const char *type, struct mount *mp, bool donew)
 
int vfs_remount_ro (struct mount *mp)
 
void suspend_all_fs (void)
 
void resume_all_fs (void)
 

Variables

static int usermount = 0
 
static bool default_autoro = false
 
static bool recursive_forced_unmount = false
 
static unsigned int deferred_unmount_retry_limit = 10
 
static int deferred_unmount_retry_delay_hz
 
static int deferred_unmount_total_retries = 0
 
static uma_zone_t mount_zone
 
struct mntlist mountlist = TAILQ_HEAD_INITIALIZER(mountlist)
 
struct mtx_padalign __exclusive_cache_line mountlist_mtx
 
static struct timeout_task deferred_unmount_task
 
static struct mtx deferred_unmount_lock
 
static struct mntoptnames optnames []
 

Macro Definition Documentation

◆ DEVCTL_LEN

#define DEVCTL_LEN   1024

Definition at line 2824 of file vfs_mount.c.

◆ VFS_MOUNTARG_SIZE_MAX

#define VFS_MOUNTARG_SIZE_MAX   (1024 * 64)

Definition at line 79 of file vfs_mount.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ __vfs_statfs()

int __vfs_statfs ( struct mount *  mp,
struct statfs *  sbp 
)

Definition at line 2612 of file vfs_mount.c.

◆ deferred_unmount_enqueue()

static bool deferred_unmount_enqueue ( struct mount *  mp,
uint64_t  flags,
bool  requeue,
int  timeout_ticks 
)
static

Definition at line 1925 of file vfs_mount.c.

References deferred_unmount_lock, deferred_unmount_task, flags, and taskqueue_enqueue_timeout().

Referenced by dounmount(), and vfs_deferred_unmount().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dounmount()

◆ dounmount_cleanup()

static void dounmount_cleanup ( struct mount *  mp,
struct vnode *  coveredvp,
int  mntkflags 
)
static

Definition at line 1701 of file vfs_mount.c.

References vdrop(), vfs_op_exit_locked(), vn_finished_write(), and wakeup().

Referenced by dounmount().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EVENTHANDLER_LIST_DEFINE() [1/2]

EVENTHANDLER_LIST_DEFINE ( vfs_mounted  )

◆ EVENTHANDLER_LIST_DEFINE() [2/2]

EVENTHANDLER_LIST_DEFINE ( vfs_unmounted  )

◆ free_mntarg()

static void free_mntarg ( struct mntarg ma)
static

Definition at line 2782 of file vfs_mount.c.

References free(), and mntarg::v.

Referenced by kernel_mount().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kern_unmount()

int kern_unmount ( struct thread *  td,
const char *  path,
int  flags 
)

Definition at line 1589 of file vfs_mount.c.

References dounmount(), flags, free(), malloc(), mountlist, mountlist_mtx, namei(), NDFREE(), path, priv_check(), sscanf(), usermount, vfs_getvfs(), vfs_ref(), vfs_rel(), vn_path_to_global_path(), and vput().

Referenced by sys_unmount().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ kernel_mount()

int kernel_mount ( struct mntarg ma,
uint64_t  flags 
)

Definition at line 2799 of file vfs_mount.c.

References mntarg::error, flags, free_mntarg(), mntarg::len, mntarg::v, and vfs_donmount().

Referenced by parse_mount().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MALLOC_DEFINE() [1/2]

MALLOC_DEFINE ( M_MOUNT  ,
"mount"  ,
"vfs mount structure"   
)

◆ MALLOC_DEFINE() [2/2]

MALLOC_DEFINE ( M_STATFS  ,
"statfs"  ,
"statfs structure"   
)

◆ mount_arg()

struct mntarg * mount_arg ( struct mntarg ma,
const char *  name,
const void *  val,
int  len 
)

Definition at line 2753 of file vfs_mount.c.

References mntarg::error, mntarg::len, malloc(), name, realloc(), and mntarg::v.

Referenced by mount_argb(), mount_argsu(), parse_mount(), and parse_mountroot_options().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mount_argb()

struct mntarg * mount_argb ( struct mntarg ma,
int  flag,
const char *  name 
)

Definition at line 2672 of file vfs_mount.c.

References flag, mount_arg(), and name.

Referenced by sys_mount().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mount_argf()

struct mntarg * mount_argf ( struct mntarg ma,
const char *  name,
const char *  fmt,
  ... 
)

Definition at line 2685 of file vfs_mount.c.

References mntarg::error, mntarg::len, malloc(), name, realloc(), sbuf_data(), sbuf_delete(), sbuf_finish(), sbuf_len(), sbuf_vprintf(), and mntarg::v.

Here is the call graph for this function:

◆ mount_argsu()

struct mntarg * mount_argsu ( struct mntarg ma,
const char *  name,
const void *  val,
int  len 
)

Definition at line 2727 of file vfs_mount.c.

References mntarg::error, malloc(), mount_arg(), and name.

Referenced by sys_mount().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mount_devctl_event()

static void mount_devctl_event ( const char *  type,
struct mount *  mp,
bool  donew 
)
static

Definition at line 2826 of file vfs_mount.c.

References buf, DEVCTL_LEN, devctl_notify(), devctl_safe_quote_sb(), free(), malloc(), optnames, sbuf_cat(), sbuf_cpy(), sbuf_data(), sbuf_delete(), sbuf_error(), sbuf_finish(), sbuf_new(), sbuf_printf(), sbuf_putc(), and type.

Referenced by dounmount(), vfs_domount_first(), and vfs_domount_update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mount_fini()

static void mount_fini ( void *  mem,
int  size 
)
static

Definition at line 171 of file vfs_mount.c.

References lockdestroy(), and pcpu_zone_16.

Referenced by vfs_mount_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mount_init()

static int mount_init ( void *  mem,
int  size,
int  flags 
)
static

Definition at line 155 of file vfs_mount.c.

References lockinit(), and pcpu_zone_16.

Referenced by vfs_mount_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MTX_SYSINIT()

MTX_SYSINIT ( deferred_unmount  ,
deferred_unmount_lock,
"deferred_unmount"  ,
MTX_DEF   
)

◆ resume_all_fs()

void resume_all_fs ( void  )

Definition at line 3004 of file vfs_mount.c.

References mountlist, mountlist_mtx, vfs_unbusy(), and vfs_write_resume().

Here is the call graph for this function:

◆ STAILQ_HEAD()

static STAILQ_HEAD ( mount  )
static

Definition at line 134 of file vfs_mount.c.

Referenced by vfs_deferred_unmount().

Here is the caller graph for this function:

◆ suspend_all_fs()

void suspend_all_fs ( void  )

Definition at line 2970 of file vfs_mount.c.

References mountlist, mountlist_mtx, printf(), vfs_busy(), vfs_unbusy(), and vfs_write_suspend().

Here is the call graph for this function:

◆ sys_mount()

int sys_mount ( struct thread *  td,
struct mount_args uap 
)

Definition at line 1021 of file vfs_mount.c.

References mount_args::data, mntarg::error, flags, mount_args::flags, free(), malloc(), mount_argb(), mount_argsu(), mount_args::path, mount_args::type, vfs_byname_kld(), and vfsconf.

Here is the call graph for this function:

◆ sys_nmount()

int sys_nmount ( struct thread *  td,
struct nmount_args uap 
)

Definition at line 433 of file vfs_mount.c.

References copyinuio(), flags, nmount_args::flags, free(), nmount_args::iovcnt, nmount_args::iovp, and vfs_donmount().

Here is the call graph for this function:

◆ sys_unmount()

int sys_unmount ( struct thread *  td,
struct unmount_args uap 
)

Definition at line 1582 of file vfs_mount.c.

References unmount_args::flags, kern_unmount(), and unmount_args::path.

Here is the call graph for this function:

◆ SYSCTL_BOOL() [1/2]

SYSCTL_BOOL ( _vfs  ,
OID_AUTO  ,
default_autoro  ,
CTLFLAG_RW  ,
default_autoro,
,
"Retry failed r/w mount as r/o if no explicit ro/rw option is specified"   
)

◆ SYSCTL_BOOL() [2/2]

SYSCTL_BOOL ( _vfs  ,
OID_AUTO  ,
recursive_forced_unmount  ,
CTLFLAG_RW  ,
recursive_forced_unmount,
,
"Recursively unmount stacked upper mounts" " when a file system is forcibly unmounted"   
)

◆ SYSCTL_INT() [1/3]

SYSCTL_INT ( _vfs  ,
OID_AUTO  ,
usermount  ,
CTLFLAG_RW  ,
usermount,
,
"Unprivileged users may mount and unmount file systems"   
)

◆ SYSCTL_INT() [2/3]

SYSCTL_INT ( _vfs_deferred_unmount  ,
OID_AUTO  ,
retry_delay_hz  ,
CTLFLAG_RW  ,
deferred_unmount_retry_delay_hz,
,
"Delay in units of s when retrying a failed deferred unmount"  [1/kern.hz] 
)

◆ SYSCTL_INT() [3/3]

SYSCTL_INT ( _vfs_deferred_unmount  ,
OID_AUTO  ,
total_retries  ,
CTLFLAG_RD  ,
deferred_unmount_total_retries,
,
"Total number of retried deferred unmounts"   
)

◆ SYSCTL_NODE()

static SYSCTL_NODE ( _vfs  ,
OID_AUTO  ,
deferred_unmount  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
,
"deferred unmount controls"   
)
static

◆ SYSCTL_UINT()

SYSCTL_UINT ( _vfs_deferred_unmount  ,
OID_AUTO  ,
retry_limit  ,
CTLFLAG_RW  ,
deferred_unmount_retry_limit,
,
"Maximum number of retries for deferred unmount failure"   
)

◆ SYSINIT()

SYSINIT ( vfs_mount  ,
SI_SUB_VFS  ,
SI_ORDER_ANY  ,
vfs_mount_init  ,
NULL   
)

◆ vfs_buildopts()

int vfs_buildopts ( struct uio *  auio,
struct vfsoptlist **  options 
)

Definition at line 319 of file vfs_mount.c.

References malloc(), vfs_freeopts(), VFS_MOUNTARG_SIZE_MAX, and vfs_sanitizeopts().

Referenced by kern_jail_get(), kern_jail_set(), and vfs_donmount().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_check_usecounts()

static int vfs_check_usecounts ( struct mount *  mp)
static

Definition at line 1683 of file vfs_mount.c.

Referenced by dounmount().

Here is the caller graph for this function:

◆ vfs_copyopt()

int vfs_copyopt ( struct vfsoptlist *  opts,
const char *  name,
void *  dest,
int  len 
)

Definition at line 2593 of file vfs_mount.c.

References name.

Referenced by kern_jail_get(), kern_jail_set(), msg_prison_check(), msg_prison_set(), sem_prison_check(), sem_prison_set(), shm_prison_check(), shm_prison_set(), and vfs_domount_update().

Here is the caller graph for this function:

◆ vfs_deferred_unmount() [1/2]

static void vfs_deferred_unmount ( void *  arg,
int  pending 
)
static

Referenced by vfs_mount_init().

Here is the caller graph for this function:

◆ vfs_deferred_unmount() [2/2]

static void vfs_deferred_unmount ( void *argi  __unused,
int pending  __unused 
)
static

◆ vfs_deleteopt()

void vfs_deleteopt ( struct vfsoptlist *  opts,
const char *  name 
)

Definition at line 225 of file vfs_mount.c.

References name, and vfs_freeopt().

Referenced by vfs_export().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_domount()

static int vfs_domount ( struct thread *  td,
const char *  fstype,
char *  fspath,
uint64_t  fsflags,
struct vfsoptlist **  optlist 
)
static

Definition at line 1477 of file vfs_mount.c.

References free(), malloc(), namei(), NDFREE(), priv_check(), usermount, vfs_byname(), vfs_byname_kld(), vfs_domount_first(), vfs_domount_update(), vfsconf, vn_path_to_global_path(), and vput().

Referenced by vfs_donmount().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_domount_first()

static int vfs_domount_first ( struct thread *  td,
struct vfsconf vfsp,
char *  fspath,
struct vnode *  vp,
uint64_t  fsflags,
struct vfsoptlist **  optlist 
)
static

◆ vfs_domount_update()

static int vfs_domount_update ( struct thread *  td,
struct vnode *  vp,
uint64_t  fsflags,
struct vfsoptlist **  optlist 
)
static

◆ vfs_donmount()

int vfs_donmount ( struct thread *  td,
uint64_t  fsflags,
struct uio *  fsoptions 
)

Definition at line 805 of file vfs_mount.c.

References default_autoro, free(), printf(), vfs_buildopts(), vfs_domount(), vfs_freeopt(), vfs_freeopts(), vfs_getopt(), vfs_getopt_pos(), and vfs_should_downgrade_to_ro_mount().

Referenced by kernel_mount(), and sys_nmount().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_drain_upper_locked()

static void vfs_drain_upper_locked ( struct mount *  mp)
static

Definition at line 599 of file vfs_mount.c.

Referenced by vfs_unregister_for_notification(), and vfs_unregister_upper().

Here is the caller graph for this function:

◆ vfs_equalopts()

static int vfs_equalopts ( const char *  opt1,
const char *  opt2 
)
static

Definition at line 260 of file vfs_mount.c.

References vfs_isopt_ro(), and vfs_isopt_rw().

Referenced by vfs_sanitizeopts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_filteropt()

int vfs_filteropt ( struct vfsoptlist *  opts,
const char **  legal 
)

Definition at line 2323 of file vfs_mount.c.

References printf(), and snprintf().

Here is the call graph for this function:

◆ vfs_flagopt()

int vfs_flagopt ( struct vfsoptlist *  opts,
const char *  name,
uint64_t *  w,
uint64_t  val 
)

Definition at line 2480 of file vfs_mount.c.

References name.

Referenced by kern_jail_set(), msg_prison_set(), sem_prison_set(), and shm_prison_set().

Here is the caller graph for this function:

◆ vfs_freeopt()

static void vfs_freeopt ( struct vfsoptlist *  opts,
struct vfsopt *  opt 
)
static

Definition at line 201 of file vfs_mount.c.

References free().

Referenced by vfs_deleteopt(), vfs_donmount(), vfs_freeopts(), and vfs_sanitizeopts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_freeopts()

void vfs_freeopts ( struct vfsoptlist *  opts)

Definition at line 213 of file vfs_mount.c.

References free(), and vfs_freeopt().

Referenced by kern_jail_get(), kern_jail_set(), vfs_buildopts(), vfs_domount_first(), vfs_domount_update(), vfs_donmount(), vfs_mount_destroy(), and vfs_remount_ro().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_getopt()

int vfs_getopt ( struct vfsoptlist *  opts,
const char *  name,
void **  buf,
int *  len 
)

Definition at line 2381 of file vfs_mount.c.

References buf, and name.

Referenced by kern_jail_get(), kern_jail_set(), vfs_domount_update(), vfs_donmount(), vfs_getopt_size(), vfs_mount_error(), and vfs_opterror().

Here is the caller graph for this function:

◆ vfs_getopt_pos()

int vfs_getopt_pos ( struct vfsoptlist *  opts,
const char *  name 
)

Definition at line 2401 of file vfs_mount.c.

References name.

Referenced by kern_jail_get(), kern_jail_set(), and vfs_donmount().

Here is the caller graph for this function:

◆ vfs_getopt_size()

int vfs_getopt_size ( struct vfsoptlist *  opts,
const char *  name,
off_t *  value 
)

Definition at line 2418 of file vfs_mount.c.

References name, value, and vfs_getopt().

Here is the call graph for this function:

◆ vfs_getopts()

char * vfs_getopts ( struct vfsoptlist *  opts,
const char *  name,
int *  error 
)

Definition at line 2459 of file vfs_mount.c.

References name.

◆ vfs_isopt_ro()

static int vfs_isopt_ro ( const char *  opt)
static

Definition at line 238 of file vfs_mount.c.

Referenced by vfs_equalopts().

Here is the caller graph for this function:

◆ vfs_isopt_rw()

static int vfs_isopt_rw ( const char *  opt)
static

Definition at line 248 of file vfs_mount.c.

Referenced by vfs_equalopts().

Here is the caller graph for this function:

◆ vfs_mergeopts()

static void vfs_mergeopts ( struct vfsoptlist *  toopts,
struct vfsoptlist *  oldopts 
)
static

Definition at line 403 of file vfs_mount.c.

References malloc(), and vfs_sanitizeopts().

Referenced by vfs_domount_update(), and vfs_remount_ro().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_mount_alloc()

struct mount * vfs_mount_alloc ( struct vnode *  vp,
struct vfsconf vfsp,
const char *  fspath,
struct ucred *  cred 
)

Definition at line 665 of file vfs_mount.c.

References crdup(), mount_zone, panic(), and vfs_busy().

Referenced by vfs_domount_first(), and vfs_mountroot_devfs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_mount_destroy()

void vfs_mount_destroy ( struct mount *  mp)

Definition at line 718 of file vfs_mount.c.

References crfree(), mount_zone, panic(), vfs_freeopts(), vn_printf(), vrele(), and wakeup().

Referenced by dounmount(), and vfs_domount_first().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_mount_error()

void vfs_mount_error ( struct mount *  mp,
const char *  fmt,
  ... 
)

Definition at line 2282 of file vfs_mount.c.

References vfs_getopt(), and vsnprintf().

Referenced by vfs_hang_addrlist().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_mount_fetch_counter()

int vfs_mount_fetch_counter ( struct mount *  mp,
enum mount_counter  which 
)

Definition at line 1890 of file vfs_mount.c.

◆ vfs_mount_init()

static void vfs_mount_init ( void *dummy  __unused)
static

Definition at line 183 of file vfs_mount.c.

References deferred_unmount_retry_delay_hz, deferred_unmount_task, hz, mount_fini(), mount_init(), mount_zone, mountlist_mtx, and vfs_deferred_unmount().

Here is the call graph for this function:

◆ vfs_mountedfrom()

void vfs_mountedfrom ( struct mount *  mp,
const char *  from 
)

Definition at line 2633 of file vfs_mount.c.

Referenced by mqfs_mount().

Here is the caller graph for this function:

◆ vfs_op_action_func()

static void vfs_op_action_func ( void *  arg)
static

Definition at line 1785 of file vfs_mount.c.

References vfs_op_barrier_ipi::mp, and smp_rendezvous_cpus_done().

Referenced by vfs_op_barrier_wait().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_op_barrier_wait()

void vfs_op_barrier_wait ( struct mount *  mp)

Definition at line 1813 of file vfs_mount.c.

References all_cpus, vfs_op_barrier_ipi::mp, smp_no_rendezvous_barrier(), smp_rendezvous_cpus_retry(), vfs_op_barrier_ipi::srcra, vfs_op_action_func(), and vfs_op_wait_func().

Referenced by vfs_cache_root_fallback(), and vfs_op_enter().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_op_enter()

void vfs_op_enter ( struct mount *  mp)

Definition at line 1727 of file vfs_mount.c.

References panic(), and vfs_op_barrier_wait().

Referenced by dounmount(), vfs_domount_update(), vfs_remount_ro(), and vfs_write_suspend().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_op_exit()

void vfs_op_exit ( struct mount *  mp)

Definition at line 1771 of file vfs_mount.c.

References vfs_op_exit_locked().

Referenced by vfs_domount_first(), vfs_domount_update(), vfs_mountroot_devfs(), vfs_remount_ro(), and vfs_write_resume().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_op_exit_locked()

void vfs_op_exit_locked ( struct mount *  mp)

Definition at line 1759 of file vfs_mount.c.

References panic().

Referenced by dounmount(), dounmount_cleanup(), vfs_op_exit(), and vfs_write_suspend().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_op_wait_func()

static void vfs_op_wait_func ( void *  arg,
int  cpu 
)
static

Definition at line 1798 of file vfs_mount.c.

References vfs_op_barrier_ipi::mp.

Referenced by vfs_op_barrier_wait().

Here is the caller graph for this function:

◆ vfs_opterror()

void vfs_opterror ( struct vfsoptlist *  opts,
const char *  fmt,
  ... 
)

Definition at line 2299 of file vfs_mount.c.

References vfs_getopt(), and vsnprintf().

Referenced by kern_jail_get(), and kern_jail_set().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_ref()

void vfs_ref ( struct mount *  mp)

Definition at line 527 of file vfs_mount.c.

Referenced by dounmount(), kern_reroot(), kern_unmount(), sys_quotactl(), vfs_getvfs(), vfs_unmountall(), vn_start_write(), and vn_vget_ino_gen().

Here is the caller graph for this function:

◆ vfs_ref_from_vp()

struct mount * vfs_ref_from_vp ( struct vnode *  vp)

Definition at line 496 of file vfs_mount.c.

Referenced by kern_fstatfs(), kern_statfs(), and vop_stdgetwritemount().

Here is the caller graph for this function:

◆ vfs_register_for_notification()

void vfs_register_for_notification ( struct mount *  mp,
struct mount *  ump,
struct mount_upper_node *  upper 
)

Definition at line 589 of file vfs_mount.c.

◆ vfs_register_upper_from_vp()

struct mount * vfs_register_upper_from_vp ( struct vnode *  vp,
struct mount *  ump,
struct mount_upper_node *  upper 
)

Definition at line 556 of file vfs_mount.c.

◆ vfs_rel()

void vfs_rel ( struct mount *  mp)

◆ vfs_remount_ro()

int vfs_remount_ro ( struct mount *  mp)

◆ vfs_sanitizeopts()

static void vfs_sanitizeopts ( struct vfsoptlist *  opts)
static

Definition at line 297 of file vfs_mount.c.

References vfs_equalopts(), and vfs_freeopt().

Referenced by vfs_buildopts(), and vfs_mergeopts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ vfs_scanopt()

int vfs_scanopt ( struct vfsoptlist *  opts,
const char *  name,
const char *  fmt,
  ... 
)

Definition at line 2499 of file vfs_mount.c.

References name, and vsscanf().

Here is the call graph for this function:

◆ vfs_setopt()

int vfs_setopt ( struct vfsoptlist *  opts,
const char *  name,
void *  value,
int  len 
)

Definition at line 2524 of file vfs_mount.c.

References name, and value.

Referenced by kern_jail_get(), msg_prison_get(), sem_prison_get(), and shm_prison_get().

Here is the caller graph for this function:

◆ vfs_setopt_part()

int vfs_setopt_part ( struct vfsoptlist *  opts,
const char *  name,
void *  value,
int  len 
)

Definition at line 2545 of file vfs_mount.c.

References name, and value.

Referenced by kern_jail_get().

Here is the caller graph for this function:

◆ vfs_setopts()

int vfs_setopts ( struct vfsoptlist *  opts,
const char *  name,
const char *  value 
)

Definition at line 2567 of file vfs_mount.c.

References name, and value.

Referenced by kern_jail_get().

Here is the caller graph for this function:

◆ vfs_should_downgrade_to_ro_mount()

static bool vfs_should_downgrade_to_ro_mount ( uint64_t  fsflags,
int  error 
)
static

Definition at line 780 of file vfs_mount.c.

Referenced by vfs_donmount().

Here is the caller graph for this function:

◆ vfs_unregister_for_notification()

void vfs_unregister_for_notification ( struct mount *  mp,
struct mount_upper_node *  upper 
)

Definition at line 614 of file vfs_mount.c.

References vfs_drain_upper_locked().

Here is the call graph for this function:

◆ vfs_unregister_upper()

void vfs_unregister_upper ( struct mount *  mp,
struct mount_upper_node *  upper 
)

Definition at line 628 of file vfs_mount.c.

References vfs_drain_upper_locked(), and wakeup().

Here is the call graph for this function:

Variable Documentation

◆ default_autoro

bool default_autoro = false
static

Definition at line 89 of file vfs_mount.c.

Referenced by vfs_donmount().

◆ deferred_unmount_lock

struct mtx deferred_unmount_lock
static

Definition at line 131 of file vfs_mount.c.

Referenced by deferred_unmount_enqueue(), and vfs_deferred_unmount().

◆ deferred_unmount_retry_delay_hz

int deferred_unmount_retry_delay_hz
static

Definition at line 106 of file vfs_mount.c.

Referenced by vfs_deferred_unmount(), and vfs_mount_init().

◆ deferred_unmount_retry_limit

unsigned int deferred_unmount_retry_limit = 10
static

Definition at line 101 of file vfs_mount.c.

Referenced by dounmount(), and vfs_deferred_unmount().

◆ deferred_unmount_task

struct timeout_task deferred_unmount_task
static

Definition at line 130 of file vfs_mount.c.

Referenced by deferred_unmount_enqueue(), and vfs_mount_init().

◆ deferred_unmount_total_retries

int deferred_unmount_total_retries = 0
static

Definition at line 111 of file vfs_mount.c.

Referenced by vfs_deferred_unmount().

◆ mount_zone

uma_zone_t mount_zone
static

Definition at line 118 of file vfs_mount.c.

Referenced by vfs_mount_alloc(), vfs_mount_destroy(), and vfs_mount_init().

◆ mountlist

◆ mountlist_mtx

◆ optnames

struct mntoptnames optnames[]
static
Initial value:
= {
MNTOPT_NAMES
}

Definition at line 2820 of file vfs_mount.c.

Referenced by mount_devctl_event().

◆ recursive_forced_unmount

bool recursive_forced_unmount = false
static

Definition at line 93 of file vfs_mount.c.

Referenced by dounmount().

◆ usermount

int usermount = 0
static

Definition at line 85 of file vfs_mount.c.

Referenced by kern_unmount(), and vfs_domount().