aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c50
1 files changed, 44 insertions, 6 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 39c81a8d6316..bf478addb852 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -43,9 +43,9 @@ __cacheline_aligned_in_smp DEFINE_SPINLOCK(vfsmount_lock);
43 43
44static int event; 44static int event;
45 45
46static struct list_head *mount_hashtable; 46static struct list_head *mount_hashtable __read_mostly;
47static int hash_mask __read_mostly, hash_bits __read_mostly; 47static int hash_mask __read_mostly, hash_bits __read_mostly;
48static kmem_cache_t *mnt_cache; 48static kmem_cache_t *mnt_cache __read_mostly;
49static struct rw_semaphore namespace_sem; 49static struct rw_semaphore namespace_sem;
50 50
51/* /sys/fs */ 51/* /sys/fs */
@@ -399,6 +399,44 @@ struct seq_operations mounts_op = {
399 .show = show_vfsmnt 399 .show = show_vfsmnt
400}; 400};
401 401
402static int show_vfsstat(struct seq_file *m, void *v)
403{
404 struct vfsmount *mnt = v;
405 int err = 0;
406
407 /* device */
408 if (mnt->mnt_devname) {
409 seq_puts(m, "device ");
410 mangle(m, mnt->mnt_devname);
411 } else
412 seq_puts(m, "no device");
413
414 /* mount point */
415 seq_puts(m, " mounted on ");
416 seq_path(m, mnt, mnt->mnt_root, " \t\n\\");
417 seq_putc(m, ' ');
418
419 /* file system type */
420 seq_puts(m, "with fstype ");
421 mangle(m, mnt->mnt_sb->s_type->name);
422
423 /* optional statistics */
424 if (mnt->mnt_sb->s_op->show_stats) {
425 seq_putc(m, ' ');
426 err = mnt->mnt_sb->s_op->show_stats(m, mnt);
427 }
428
429 seq_putc(m, '\n');
430 return err;
431}
432
433struct seq_operations mountstats_op = {
434 .start = m_start,
435 .next = m_next,
436 .stop = m_stop,
437 .show = show_vfsstat,
438};
439
402/** 440/**
403 * may_umount_tree - check if a mount tree is busy 441 * may_umount_tree - check if a mount tree is busy
404 * @mnt: root of mount tree 442 * @mnt: root of mount tree
@@ -421,9 +459,9 @@ int may_umount_tree(struct vfsmount *mnt)
421 spin_unlock(&vfsmount_lock); 459 spin_unlock(&vfsmount_lock);
422 460
423 if (actual_refs > minimum_refs) 461 if (actual_refs > minimum_refs)
424 return -EBUSY; 462 return 0;
425 463
426 return 0; 464 return 1;
427} 465}
428 466
429EXPORT_SYMBOL(may_umount_tree); 467EXPORT_SYMBOL(may_umount_tree);
@@ -443,10 +481,10 @@ EXPORT_SYMBOL(may_umount_tree);
443 */ 481 */
444int may_umount(struct vfsmount *mnt) 482int may_umount(struct vfsmount *mnt)
445{ 483{
446 int ret = 0; 484 int ret = 1;
447 spin_lock(&vfsmount_lock); 485 spin_lock(&vfsmount_lock);
448 if (propagate_mount_busy(mnt, 2)) 486 if (propagate_mount_busy(mnt, 2))
449 ret = -EBUSY; 487 ret = 0;
450 spin_unlock(&vfsmount_lock); 488 spin_unlock(&vfsmount_lock);
451 return ret; 489 return ret;
452} 490}