static int event;
-static struct list_head *mount_hashtable __read_mostly;
+static struct list_head *mount_hashtable;
static int hash_mask __read_mostly, hash_bits __read_mostly;
-static kmem_cache_t *mnt_cache __read_mostly;
+static kmem_cache_t *mnt_cache;
static struct rw_semaphore namespace_sem;
/* /sys/fs */
.show = show_vfsmnt
};
-static int show_vfsstat(struct seq_file *m, void *v)
-{
- struct vfsmount *mnt = v;
- int err = 0;
-
- /* device */
- if (mnt->mnt_devname) {
- seq_puts(m, "device ");
- mangle(m, mnt->mnt_devname);
- } else
- seq_puts(m, "no device");
-
- /* mount point */
- seq_puts(m, " mounted on ");
- seq_path(m, mnt, mnt->mnt_root, " \t\n\\");
- seq_putc(m, ' ');
-
- /* file system type */
- seq_puts(m, "with fstype ");
- mangle(m, mnt->mnt_sb->s_type->name);
-
- /* optional statistics */
- if (mnt->mnt_sb->s_op->show_stats) {
- seq_putc(m, ' ');
- err = mnt->mnt_sb->s_op->show_stats(m, mnt);
- }
-
- seq_putc(m, '\n');
- return err;
-}
-
-struct seq_operations mountstats_op = {
- .start = m_start,
- .next = m_next,
- .stop = m_stop,
- .show = show_vfsstat,
-};
-
/**
* may_umount_tree - check if a mount tree is busy
* @mnt: root of mount tree
spin_unlock(&vfsmount_lock);
if (actual_refs > minimum_refs)
- return 0;
+ return -EBUSY;
- return 1;
+ return 0;
}
EXPORT_SYMBOL(may_umount_tree);
*/
int may_umount(struct vfsmount *mnt)
{
- int ret = 1;
+ int ret = 0;
spin_lock(&vfsmount_lock);
if (propagate_mount_busy(mnt, 2))
- ret = 0;
+ ret = -EBUSY;
spin_unlock(&vfsmount_lock);
return ret;
}
}
}
-static inline void __umount_list(struct vfsmount *mnt,
- int propagate, struct list_head *kill)
+void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill)
{
struct vfsmount *p;
+ for (p = mnt; p; p = next_mnt(p, mnt)) {
+ list_del(&p->mnt_hash);
+ list_add(&p->mnt_hash, kill);
+ }
+
if (propagate)
propagate_umount(kill);
}
}
-void umount_tree(struct vfsmount *mnt, int propagate, struct list_head *kill)
-{
- struct vfsmount *p;
-
- for (p = mnt; p; p = next_mnt(p, mnt)) {
- list_del(&p->mnt_hash);
- list_add(&p->mnt_hash, kill);
- // p->mnt_namespace = NULL;
- }
- __umount_list(mnt, propagate, kill);
-}
-
-void umount_unused(struct vfsmount *mnt, struct fs_struct *fs)
-{
- struct vfsmount *p;
- LIST_HEAD(kill);
-
- for (p = mnt; p; p = next_mnt(p, mnt)) {
- if (p == fs->rootmnt || p == fs->pwdmnt)
- continue;
- list_del(&p->mnt_list);
- list_add(&p->mnt_list, &kill);
- p->mnt_namespace = NULL;
- }
- __umount_list(mnt, 0, &kill);
-}
-
static int do_umount(struct vfsmount *mnt, int flags)
{
struct super_block *sb = mnt->mnt_sb;
if (flags & MS_NODIRATIME)
mnt_flags |= MNT_NODIRATIME;
- if (vx_ccaps(VXC_SECURE_MOUNT))
+ if (!capable(CAP_SYS_ADMIN))
mnt_flags |= MNT_NODEV;
flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE |
MS_NOATIME | MS_NODIRATIME);
}
}
-EXPORT_SYMBOL_GPL(set_fs_root);
-
/*
* Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values.
* It can block. Requires the big lock held.