Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
namespace.c File Reference
#include <linux/syscalls.h>
#include <linux/export.h>
#include <linux/capability.h>
#include <linux/mnt_namespace.h>
#include <linux/namei.h>
#include <linux/security.h>
#include <linux/idr.h>
#include <linux/acct.h>
#include <linux/ramfs.h>
#include <linux/fs_struct.h>
#include <linux/fsnotify.h>
#include <linux/uaccess.h>
#include "pnode.h"
#include "internal.h"

Go to the source code of this file.

Macros

#define HASH_SHIFT   ilog2(PAGE_SIZE / sizeof(struct list_head))
 
#define HASH_SIZE   (1UL << HASH_SHIFT)
 
#define MNT_WRITER_UNDERFLOW_LIMIT   -(1<<16)
 

Functions

 EXPORT_SYMBOL_GPL (fs_kobj)
 
 DEFINE_BRLOCK (vfsmount_lock)
 
void mnt_release_group_id (struct mount *mnt)
 
unsigned int mnt_get_count (struct mount *mnt)
 
int __mnt_is_readonly (struct vfsmount *mnt)
 
 EXPORT_SYMBOL_GPL (__mnt_is_readonly)
 
int __mnt_want_write (struct vfsmount *m)
 
int mnt_want_write (struct vfsmount *m)
 
 EXPORT_SYMBOL_GPL (mnt_want_write)
 
int mnt_clone_write (struct vfsmount *mnt)
 
 EXPORT_SYMBOL_GPL (mnt_clone_write)
 
int __mnt_want_write_file (struct file *file)
 
int mnt_want_write_file (struct file *file)
 
 EXPORT_SYMBOL_GPL (mnt_want_write_file)
 
void __mnt_drop_write (struct vfsmount *mnt)
 
void mnt_drop_write (struct vfsmount *mnt)
 
 EXPORT_SYMBOL_GPL (mnt_drop_write)
 
void __mnt_drop_write_file (struct file *file)
 
void mnt_drop_write_file (struct file *file)
 
 EXPORT_SYMBOL (mnt_drop_write_file)
 
int sb_prepare_remount_readonly (struct super_block *sb)
 
struct mount__lookup_mnt (struct vfsmount *mnt, struct dentry *dentry, int dir)
 
struct vfsmountlookup_mnt (struct path *path)
 
void mnt_set_mountpoint (struct mount *mnt, struct dentry *dentry, struct mount *child_mnt)
 
struct vfsmountvfs_kern_mount (struct file_system_type *type, int flags, const char *name, void *data)
 
 EXPORT_SYMBOL_GPL (vfs_kern_mount)
 
void mntput (struct vfsmount *mnt)
 
 EXPORT_SYMBOL (mntput)
 
struct vfsmountmntget (struct vfsmount *mnt)
 
 EXPORT_SYMBOL (mntget)
 
void mnt_pin (struct vfsmount *mnt)
 
 EXPORT_SYMBOL (mnt_pin)
 
void mnt_unpin (struct vfsmount *m)
 
 EXPORT_SYMBOL (mnt_unpin)
 
int generic_show_options (struct seq_file *m, struct dentry *root)
 
 EXPORT_SYMBOL (generic_show_options)
 
void save_mount_options (struct super_block *sb, char *options)
 
 EXPORT_SYMBOL (save_mount_options)
 
void replace_mount_options (struct super_block *sb, char *options)
 
 EXPORT_SYMBOL (replace_mount_options)
 
int may_umount_tree (struct vfsmount *m)
 
 EXPORT_SYMBOL (may_umount_tree)
 
int may_umount (struct vfsmount *mnt)
 
 EXPORT_SYMBOL (may_umount)
 
void release_mounts (struct list_head *head)
 
void umount_tree (struct mount *mnt, int propagate, struct list_head *kill)
 
 SYSCALL_DEFINE2 (umount, char __user *, name, int, flags)
 
struct mountcopy_tree (struct mount *mnt, struct dentry *dentry, int flag)
 
struct vfsmountcollect_mounts (struct path *path)
 
void drop_collected_mounts (struct vfsmount *mnt)
 
int iterate_mounts (int(*f)(struct vfsmount *, void *), void *arg, struct vfsmount *root)
 
int finish_automount (struct vfsmount *m, struct path *path)
 
void mnt_set_expiry (struct vfsmount *mnt, struct list_head *expiry_list)
 
 EXPORT_SYMBOL (mnt_set_expiry)
 
void mark_mounts_for_expiry (struct list_head *mounts)
 
 EXPORT_SYMBOL_GPL (mark_mounts_for_expiry)
 
int copy_mount_options (const void __user *data, unsigned long *where)
 
int copy_mount_string (const void __user *data, char **where)
 
long do_mount (const char *dev_name, const char *dir_name, const char *type_page, unsigned long flags, void *data_page)
 
struct mnt_namespacecopy_mnt_ns (unsigned long flags, struct mnt_namespace *ns, struct fs_struct *new_fs)
 
struct dentrymount_subtree (struct vfsmount *mnt, const char *name)
 
 EXPORT_SYMBOL (mount_subtree)
 
 SYSCALL_DEFINE5 (mount, char __user *, dev_name, char __user *, dir_name, char __user *, type, unsigned long, flags, void __user *, data)
 
bool is_path_reachable (struct mount *mnt, struct dentry *dentry, const struct path *root)
 
int path_is_under (struct path *path1, struct path *path2)
 
 EXPORT_SYMBOL (path_is_under)
 
 SYSCALL_DEFINE2 (pivot_root, const char __user *, new_root, const char __user *, put_old)
 
void __init mnt_init (void)
 
void put_mnt_ns (struct mnt_namespace *ns)
 
struct vfsmountkern_mount_data (struct file_system_type *type, void *data)
 
 EXPORT_SYMBOL_GPL (kern_mount_data)
 
void kern_unmount (struct vfsmount *mnt)
 
 EXPORT_SYMBOL (kern_unmount)
 
bool our_mnt (struct vfsmount *mnt)
 

Variables

struct kobjectfs_kobj
 

Macro Definition Documentation

#define HASH_SHIFT   ilog2(PAGE_SIZE / sizeof(struct list_head))

Definition at line 26 of file namespace.c.

#define HASH_SIZE   (1UL << HASH_SHIFT)

Definition at line 27 of file namespace.c.

#define MNT_WRITER_UNDERFLOW_LIMIT   -(1<<16)

Definition at line 62 of file namespace.c.

Function Documentation

struct mount* __lookup_mnt ( struct vfsmount mnt,
struct dentry dentry,
int  dir 
)
read

Definition at line 553 of file namespace.c.

void __mnt_drop_write ( struct vfsmount mnt)

__mnt_drop_write - give up write access to a mount : the mount on which to give up write access

Tells the low-level filesystem that we are done performing writes to it. Must be matched with __mnt_want_write() call above.

Definition at line 420 of file namespace.c.

void __mnt_drop_write_file ( struct file file)

Definition at line 442 of file namespace.c.

int __mnt_is_readonly ( struct vfsmount mnt)

Definition at line 232 of file namespace.c.

int __mnt_want_write ( struct vfsmount m)

__mnt_want_write - get write access to a mount without freeze protection : the mount on which to take a write

This tells the low-level filesystem that a write is about to be performed to it, and makes sure that writes are allowed (mnt it read-write) before returning success. This operation does not protect against filesystem being frozen. When the write operation is finished, __mnt_drop_write() must be called. This is effectively a refcount.

Definition at line 301 of file namespace.c.

int __mnt_want_write_file ( struct file file)

Definition at line 383 of file namespace.c.

struct vfsmount* collect_mounts ( struct path path)
read

Definition at line 1367 of file namespace.c.

struct mnt_namespace* copy_mnt_ns ( unsigned long  flags,
struct mnt_namespace ns,
struct fs_struct new_fs 
)
read

Definition at line 2341 of file namespace.c.

int copy_mount_options ( const void __user data,
unsigned long where 
)

Definition at line 2130 of file namespace.c.

int copy_mount_string ( const void __user data,
char **  where 
)

Definition at line 2163 of file namespace.c.

struct mount* copy_tree ( struct mount mnt,
struct dentry dentry,
int  flag 
)
read

Definition at line 1311 of file namespace.c.

DEFINE_BRLOCK ( vfsmount_lock  )
long do_mount ( const char dev_name,
const char dir_name,
const char type_page,
unsigned long  flags,
void data_page 
)

Definition at line 2194 of file namespace.c.

void drop_collected_mounts ( struct vfsmount mnt)

Definition at line 1379 of file namespace.c.

EXPORT_SYMBOL ( mnt_drop_write_file  )
EXPORT_SYMBOL ( mntput  )
EXPORT_SYMBOL ( mntget  )
EXPORT_SYMBOL ( mnt_pin  )
EXPORT_SYMBOL ( mnt_unpin  )
EXPORT_SYMBOL ( generic_show_options  )
EXPORT_SYMBOL ( save_mount_options  )
EXPORT_SYMBOL ( replace_mount_options  )
EXPORT_SYMBOL ( may_umount_tree  )
EXPORT_SYMBOL ( may_umount  )
EXPORT_SYMBOL ( mnt_set_expiry  )
EXPORT_SYMBOL ( mount_subtree  )
EXPORT_SYMBOL ( path_is_under  )
EXPORT_SYMBOL ( kern_unmount  )
EXPORT_SYMBOL_GPL ( fs_kobj  )
EXPORT_SYMBOL_GPL ( __mnt_is_readonly  )
EXPORT_SYMBOL_GPL ( mnt_want_write  )
EXPORT_SYMBOL_GPL ( mnt_clone_write  )
EXPORT_SYMBOL_GPL ( mnt_want_write_file  )
EXPORT_SYMBOL_GPL ( mnt_drop_write  )
EXPORT_SYMBOL_GPL ( vfs_kern_mount  )
EXPORT_SYMBOL_GPL ( mark_mounts_for_expiry  )
EXPORT_SYMBOL_GPL ( kern_mount_data  )
int finish_automount ( struct vfsmount m,
struct path path 
)

Definition at line 1943 of file namespace.c.

int generic_show_options ( struct seq_file m,
struct dentry root 
)

Definition at line 947 of file namespace.c.

bool is_path_reachable ( struct mount mnt,
struct dentry dentry,
const struct path root 
)

Definition at line 2452 of file namespace.c.

int iterate_mounts ( int(*)(struct vfsmount *, void *)  f,
void arg,
struct vfsmount root 
)

Definition at line 1390 of file namespace.c.

struct vfsmount* kern_mount_data ( struct file_system_type type,
void data 
)
read

Definition at line 2653 of file namespace.c.

void kern_unmount ( struct vfsmount mnt)

Definition at line 2668 of file namespace.c.

struct vfsmount* lookup_mnt ( struct path path)
read

Definition at line 590 of file namespace.c.

void mark_mounts_for_expiry ( struct list_head mounts)

Definition at line 1997 of file namespace.c.

int may_umount ( struct vfsmount mnt)

may_umount - check if a mount point is busy : root of mount

This is called to check if a mount point has any open files, pwds, chroots or sub mounts. If the mount has sub mounts this will return busy regardless of whether the sub mounts are busy.

Doesn't take quota and stuff into account. IOW, in some cases it will give false negatives. The main reason why it's here is that we need a non-destructive way to look for easily umountable filesystems.

Definition at line 1077 of file namespace.c.

int may_umount_tree ( struct vfsmount m)

may_umount_tree - check if a mount tree is busy : root of mount tree

This is called to check if a tree of mounts has any open files, pwds, chroots or sub mounts that are busy.

Definition at line 1040 of file namespace.c.

int mnt_clone_write ( struct vfsmount mnt)

mnt_clone_write - get write access to a mount : the mount on which to take a write

This is effectively like mnt_want_write, except it must only be used to take an extra write reference on a mountpoint that we already know has a write reference on it. This allows some optimisation.

After finished, mnt_drop_write must be called as usual to drop the reference.

Definition at line 364 of file namespace.c.

void mnt_drop_write ( struct vfsmount mnt)

mnt_drop_write - give up write access to a mount : the mount on which to give up write access

Tells the low-level filesystem that we are done performing writes to it and also allows filesystem to be frozen again. Must be matched with mnt_want_write() call above.

Definition at line 435 of file namespace.c.

void mnt_drop_write_file ( struct file file)

Definition at line 447 of file namespace.c.

unsigned int mnt_get_count ( struct mount mnt)

Definition at line 145 of file namespace.c.

void __init mnt_init ( void  )

Definition at line 2605 of file namespace.c.

void mnt_pin ( struct vfsmount mnt)

Definition at line 916 of file namespace.c.

void mnt_release_group_id ( struct mount mnt)

Definition at line 119 of file namespace.c.

void mnt_set_expiry ( struct vfsmount mnt,
struct list_head expiry_list 
)

mnt_set_expiry - Put a mount on an expiration list : The mount to list. : The list to add the mount to.

Definition at line 1980 of file namespace.c.

void mnt_set_mountpoint ( struct mount mnt,
struct dentry dentry,
struct mount child_mnt 
)

Definition at line 671 of file namespace.c.

void mnt_unpin ( struct vfsmount m)

Definition at line 924 of file namespace.c.

int mnt_want_write ( struct vfsmount m)

mnt_want_write - get write access to a mount : the mount on which to take a write

This tells the low-level filesystem that a write is about to be performed to it, and makes sure that writes are allowed (mount is read-write, filesystem is not frozen) before returning success. When the write operation is finished, mnt_drop_write() must be called. This is effectively a refcount.

Definition at line 340 of file namespace.c.

int mnt_want_write_file ( struct file file)

Definition at line 400 of file namespace.c.

struct vfsmount* mntget ( struct vfsmount mnt)
read

Definition at line 908 of file namespace.c.

void mntput ( struct vfsmount mnt)

Definition at line 896 of file namespace.c.

struct dentry* mount_subtree ( struct vfsmount mnt,
const char name 
)
read

Definition at line 2376 of file namespace.c.

bool our_mnt ( struct vfsmount mnt)

Definition at line 2680 of file namespace.c.

int path_is_under ( struct path path1,
struct path path2 
)

Definition at line 2462 of file namespace.c.

void put_mnt_ns ( struct mnt_namespace ns)

Definition at line 2638 of file namespace.c.

void release_mounts ( struct list_head head)

Definition at line 1091 of file namespace.c.

void replace_mount_options ( struct super_block sb,
char options 
)

Definition at line 984 of file namespace.c.

void save_mount_options ( struct super_block sb,
char options 
)

Definition at line 977 of file namespace.c.

int sb_prepare_remount_readonly ( struct super_block sb)

Definition at line 502 of file namespace.c.

SYSCALL_DEFINE2 ( umount  ,
char __user ,
name  ,
int  ,
flags   
)

Definition at line 1245 of file namespace.c.

SYSCALL_DEFINE2 ( pivot_root  ,
const char __user ,
new_root  ,
const char __user ,
put_old   
)

Definition at line 2497 of file namespace.c.

SYSCALL_DEFINE5 ( mount  ,
char __user ,
dev_name  ,
char __user ,
dir_name  ,
char __user ,
type  ,
unsigned  long,
flags  ,
void __user ,
data   
)

Definition at line 2406 of file namespace.c.

void umount_tree ( struct mount mnt,
int  propagate,
struct list_head kill 
)

Definition at line 1119 of file namespace.c.

struct vfsmount* vfs_kern_mount ( struct file_system_type type,
int  flags,
const char name,
void data 
)
read

Definition at line 744 of file namespace.c.

Variable Documentation

struct kobject* fs_kobj

Definition at line 41 of file namespace.c.