initial commit with v2.6.9
[linux-2.6.9-moxart.git] / fs / super.c
blob6f8960dbef680786f41b0df4d426616fcd5086bb
1 /*
2 * linux/fs/super.c
4 * Copyright (C) 1991, 1992 Linus Torvalds
6 * super.c contains code to handle: - mount structures
7 * - super-block tables
8 * - filesystem drivers list
9 * - mount system call
10 * - umount system call
11 * - ustat system call
13 * GK 2/5/95 - Changed to support mounting the root fs via NFS
15 * Added kerneld support: Jacques Gelinas and Bjorn Ekwall
16 * Added change_root: Werner Almesberger & Hans Lermen, Feb '96
17 * Added options to /proc/mounts:
18 * Torbjörn Lindh (torbjorn.lindh@gopta.se), April 14, 1996.
19 * Added devfs support: Richard Gooch <rgooch@atnf.csiro.au>, 13-JAN-1998
20 * Heavily rewritten for 'one fs - one tree' dcache architecture. AV, Mar 2000
23 #include <linux/config.h>
24 #include <linux/module.h>
25 #include <linux/slab.h>
26 #include <linux/init.h>
27 #include <linux/smp_lock.h>
28 #include <linux/acct.h>
29 #include <linux/blkdev.h>
30 #include <linux/quotaops.h>
31 #include <linux/namei.h>
32 #include <linux/buffer_head.h> /* for fsync_super() */
33 #include <linux/mount.h>
34 #include <linux/security.h>
35 #include <linux/vfs.h>
36 #include <linux/writeback.h> /* for the emergency remount stuff */
37 #include <linux/idr.h>
38 #include <asm/uaccess.h>
41 void get_filesystem(struct file_system_type *fs);
42 void put_filesystem(struct file_system_type *fs);
43 struct file_system_type *get_fs_type(const char *name);
45 LIST_HEAD(super_blocks);
46 spinlock_t sb_lock = SPIN_LOCK_UNLOCKED;
48 /**
49 * alloc_super - create new superblock
51 * Allocates and initializes a new &struct super_block. alloc_super()
52 * returns a pointer new superblock or %NULL if allocation had failed.
54 static struct super_block *alloc_super(void)
56 struct super_block *s = kmalloc(sizeof(struct super_block), GFP_USER);
57 static struct super_operations default_op;
59 if (s) {
60 memset(s, 0, sizeof(struct super_block));
61 if (security_sb_alloc(s)) {
62 kfree(s);
63 s = NULL;
64 goto out;
66 INIT_LIST_HEAD(&s->s_dirty);
67 INIT_LIST_HEAD(&s->s_io);
68 INIT_LIST_HEAD(&s->s_files);
69 INIT_LIST_HEAD(&s->s_instances);
70 INIT_HLIST_HEAD(&s->s_anon);
71 init_rwsem(&s->s_umount);
72 sema_init(&s->s_lock, 1);
73 down_write(&s->s_umount);
74 s->s_count = S_BIAS;
75 atomic_set(&s->s_active, 1);
76 sema_init(&s->s_vfs_rename_sem,1);
77 sema_init(&s->s_dquot.dqio_sem, 1);
78 sema_init(&s->s_dquot.dqonoff_sem, 1);
79 init_rwsem(&s->s_dquot.dqptr_sem);
80 init_waitqueue_head(&s->s_wait_unfrozen);
81 s->s_maxbytes = MAX_NON_LFS;
82 s->dq_op = sb_dquot_ops;
83 s->s_qcop = sb_quotactl_ops;
84 s->s_op = &default_op;
86 out:
87 return s;
90 /**
91 * destroy_super - frees a superblock
92 * @s: superblock to free
94 * Frees a superblock.
96 static inline void destroy_super(struct super_block *s)
98 security_sb_free(s);
99 kfree(s);
102 /* Superblock refcounting */
105 * Drop a superblock's refcount. Returns non-zero if the superblock was
106 * destroyed. The caller must hold sb_lock.
108 int __put_super(struct super_block *sb)
110 int ret = 0;
112 if (!--sb->s_count) {
113 destroy_super(sb);
114 ret = 1;
116 return ret;
120 * Drop a superblock's refcount.
121 * Returns non-zero if the superblock is about to be destroyed and
122 * at least is already removed from super_blocks list, so if we are
123 * making a loop through super blocks then we need to restart.
124 * The caller must hold sb_lock.
126 int __put_super_and_need_restart(struct super_block *sb)
128 /* check for race with generic_shutdown_super() */
129 if (list_empty(&sb->s_list)) {
130 /* super block is removed, need to restart... */
131 __put_super(sb);
132 return 1;
134 /* can't be the last, since s_list is still in use */
135 sb->s_count--;
136 BUG_ON(sb->s_count == 0);
137 return 0;
141 * put_super - drop a temporary reference to superblock
142 * @s: superblock in question
144 * Drops a temporary reference, frees superblock if there's no
145 * references left.
147 static void put_super(struct super_block *sb)
149 spin_lock(&sb_lock);
150 __put_super(sb);
151 spin_unlock(&sb_lock);
156 * deactivate_super - drop an active reference to superblock
157 * @s: superblock to deactivate
159 * Drops an active reference to superblock, acquiring a temprory one if
160 * there is no active references left. In that case we lock superblock,
161 * tell fs driver to shut it down and drop the temporary reference we
162 * had just acquired.
164 void deactivate_super(struct super_block *s)
166 struct file_system_type *fs = s->s_type;
167 if (atomic_dec_and_lock(&s->s_active, &sb_lock)) {
168 s->s_count -= S_BIAS-1;
169 spin_unlock(&sb_lock);
170 down_write(&s->s_umount);
171 fs->kill_sb(s);
172 put_filesystem(fs);
173 put_super(s);
177 EXPORT_SYMBOL(deactivate_super);
180 * grab_super - acquire an active reference
181 * @s: reference we are trying to make active
183 * Tries to acquire an active reference. grab_super() is used when we
184 * had just found a superblock in super_blocks or fs_type->fs_supers
185 * and want to turn it into a full-blown active reference. grab_super()
186 * is called with sb_lock held and drops it. Returns 1 in case of
187 * success, 0 if we had failed (superblock contents was already dead or
188 * dying when grab_super() had been called).
190 static int grab_super(struct super_block *s)
192 s->s_count++;
193 spin_unlock(&sb_lock);
194 down_write(&s->s_umount);
195 if (s->s_root) {
196 spin_lock(&sb_lock);
197 if (s->s_count > S_BIAS) {
198 atomic_inc(&s->s_active);
199 s->s_count--;
200 spin_unlock(&sb_lock);
201 return 1;
203 spin_unlock(&sb_lock);
205 up_write(&s->s_umount);
206 put_super(s);
207 yield();
208 return 0;
212 * generic_shutdown_super - common helper for ->kill_sb()
213 * @sb: superblock to kill
215 * generic_shutdown_super() does all fs-independent work on superblock
216 * shutdown. Typical ->kill_sb() should pick all fs-specific objects
217 * that need destruction out of superblock, call generic_shutdown_super()
218 * and release aforementioned objects. Note: dentries and inodes _are_
219 * taken care of and do not need specific handling.
221 void generic_shutdown_super(struct super_block *sb)
223 struct dentry *root = sb->s_root;
224 struct super_operations *sop = sb->s_op;
226 if (root) {
227 sb->s_root = NULL;
228 shrink_dcache_parent(root);
229 shrink_dcache_anon(&sb->s_anon);
230 dput(root);
231 fsync_super(sb);
232 lock_super(sb);
233 lock_kernel();
234 sb->s_flags &= ~MS_ACTIVE;
235 /* bad name - it should be evict_inodes() */
236 invalidate_inodes(sb);
238 if (sop->write_super && sb->s_dirt)
239 sop->write_super(sb);
240 if (sop->put_super)
241 sop->put_super(sb);
243 /* Forget any remaining inodes */
244 if (invalidate_inodes(sb)) {
245 printk("VFS: Busy inodes after unmount. "
246 "Self-destruct in 5 seconds. Have a nice day...\n");
249 unlock_kernel();
250 unlock_super(sb);
252 spin_lock(&sb_lock);
253 /* should be initialized for __put_super_and_need_restart() */
254 list_del_init(&sb->s_list);
255 list_del(&sb->s_instances);
256 spin_unlock(&sb_lock);
257 up_write(&sb->s_umount);
260 EXPORT_SYMBOL(generic_shutdown_super);
263 * sget - find or create a superblock
264 * @type: filesystem type superblock should belong to
265 * @test: comparison callback
266 * @set: setup callback
267 * @data: argument to each of them
269 struct super_block *sget(struct file_system_type *type,
270 int (*test)(struct super_block *,void *),
271 int (*set)(struct super_block *,void *),
272 void *data)
274 struct super_block *s = NULL;
275 struct list_head *p;
276 int err;
278 retry:
279 spin_lock(&sb_lock);
280 if (test) list_for_each(p, &type->fs_supers) {
281 struct super_block *old;
282 old = list_entry(p, struct super_block, s_instances);
283 if (!test(old, data))
284 continue;
285 if (!grab_super(old))
286 goto retry;
287 if (s)
288 destroy_super(s);
289 return old;
291 if (!s) {
292 spin_unlock(&sb_lock);
293 s = alloc_super();
294 if (!s)
295 return ERR_PTR(-ENOMEM);
296 goto retry;
299 err = set(s, data);
300 if (err) {
301 spin_unlock(&sb_lock);
302 destroy_super(s);
303 return ERR_PTR(err);
305 s->s_type = type;
306 strlcpy(s->s_id, type->name, sizeof(s->s_id));
307 list_add_tail(&s->s_list, &super_blocks);
308 list_add(&s->s_instances, &type->fs_supers);
309 spin_unlock(&sb_lock);
310 get_filesystem(type);
311 return s;
314 EXPORT_SYMBOL(sget);
316 void drop_super(struct super_block *sb)
318 up_read(&sb->s_umount);
319 put_super(sb);
322 EXPORT_SYMBOL(drop_super);
324 static inline void write_super(struct super_block *sb)
326 lock_super(sb);
327 if (sb->s_root && sb->s_dirt)
328 if (sb->s_op->write_super)
329 sb->s_op->write_super(sb);
330 unlock_super(sb);
334 * Note: check the dirty flag before waiting, so we don't
335 * hold up the sync while mounting a device. (The newly
336 * mounted device won't need syncing.)
338 void sync_supers(void)
340 struct super_block * sb;
341 restart:
342 spin_lock(&sb_lock);
343 sb = sb_entry(super_blocks.next);
344 while (sb != sb_entry(&super_blocks))
345 if (sb->s_dirt) {
346 sb->s_count++;
347 spin_unlock(&sb_lock);
348 down_read(&sb->s_umount);
349 write_super(sb);
350 drop_super(sb);
351 goto restart;
352 } else
353 sb = sb_entry(sb->s_list.next);
354 spin_unlock(&sb_lock);
358 * Call the ->sync_fs super_op against all filesytems which are r/w and
359 * which implement it.
361 * This operation is careful to avoid the livelock which could easily happen
362 * if two or more filesystems are being continuously dirtied. s_need_sync_fs
363 * is used only here. We set it against all filesystems and then clear it as
364 * we sync them. So redirtied filesystems are skipped.
366 * But if process A is currently running sync_filesytems and then process B
367 * calls sync_filesystems as well, process B will set all the s_need_sync_fs
368 * flags again, which will cause process A to resync everything. Fix that with
369 * a local mutex.
371 * (Fabian) Avoid sync_fs with clean fs & wait mode 0
373 void sync_filesystems(int wait)
375 struct super_block *sb;
376 static DECLARE_MUTEX(mutex);
378 down(&mutex); /* Could be down_interruptible */
379 spin_lock(&sb_lock);
380 for (sb = sb_entry(super_blocks.next); sb != sb_entry(&super_blocks);
381 sb = sb_entry(sb->s_list.next)) {
382 if (!sb->s_op->sync_fs)
383 continue;
384 if (sb->s_flags & MS_RDONLY)
385 continue;
386 sb->s_need_sync_fs = 1;
388 spin_unlock(&sb_lock);
390 restart:
391 spin_lock(&sb_lock);
392 for (sb = sb_entry(super_blocks.next); sb != sb_entry(&super_blocks);
393 sb = sb_entry(sb->s_list.next)) {
394 if (!sb->s_need_sync_fs)
395 continue;
396 sb->s_need_sync_fs = 0;
397 if (sb->s_flags & MS_RDONLY)
398 continue; /* hm. Was remounted r/o meanwhile */
399 sb->s_count++;
400 spin_unlock(&sb_lock);
401 down_read(&sb->s_umount);
402 if (sb->s_root && (wait || sb->s_dirt))
403 sb->s_op->sync_fs(sb, wait);
404 drop_super(sb);
405 goto restart;
407 spin_unlock(&sb_lock);
408 up(&mutex);
412 * get_super - get the superblock of a device
413 * @bdev: device to get the superblock for
415 * Scans the superblock list and finds the superblock of the file system
416 * mounted on the device given. %NULL is returned if no match is found.
419 struct super_block * get_super(struct block_device *bdev)
421 struct list_head *p;
422 if (!bdev)
423 return NULL;
424 rescan:
425 spin_lock(&sb_lock);
426 list_for_each(p, &super_blocks) {
427 struct super_block *s = sb_entry(p);
428 if (s->s_bdev == bdev) {
429 s->s_count++;
430 spin_unlock(&sb_lock);
431 down_read(&s->s_umount);
432 if (s->s_root)
433 return s;
434 drop_super(s);
435 goto rescan;
438 spin_unlock(&sb_lock);
439 return NULL;
442 EXPORT_SYMBOL(get_super);
444 struct super_block * user_get_super(dev_t dev)
446 struct list_head *p;
448 rescan:
449 spin_lock(&sb_lock);
450 list_for_each(p, &super_blocks) {
451 struct super_block *s = sb_entry(p);
452 if (s->s_dev == dev) {
453 s->s_count++;
454 spin_unlock(&sb_lock);
455 down_read(&s->s_umount);
456 if (s->s_root)
457 return s;
458 drop_super(s);
459 goto rescan;
462 spin_unlock(&sb_lock);
463 return NULL;
466 EXPORT_SYMBOL(user_get_super);
468 asmlinkage long sys_ustat(unsigned dev, struct ustat __user * ubuf)
470 struct super_block *s;
471 struct ustat tmp;
472 struct kstatfs sbuf;
473 int err = -EINVAL;
475 s = user_get_super(new_decode_dev(dev));
476 if (s == NULL)
477 goto out;
478 err = vfs_statfs(s, &sbuf);
479 drop_super(s);
480 if (err)
481 goto out;
483 memset(&tmp,0,sizeof(struct ustat));
484 tmp.f_tfree = sbuf.f_bfree;
485 tmp.f_tinode = sbuf.f_ffree;
487 err = copy_to_user(ubuf,&tmp,sizeof(struct ustat)) ? -EFAULT : 0;
488 out:
489 return err;
493 * mark_files_ro
494 * @sb: superblock in question
496 * All files are marked read/only. We don't care about pending
497 * delete files so this should be used in 'force' mode only
500 static void mark_files_ro(struct super_block *sb)
502 struct file *f;
504 file_list_lock();
505 list_for_each_entry(f, &sb->s_files, f_list) {
506 if (S_ISREG(f->f_dentry->d_inode->i_mode) && file_count(f))
507 f->f_mode &= ~FMODE_WRITE;
509 file_list_unlock();
513 * do_remount_sb - asks filesystem to change mount options.
514 * @sb: superblock in question
515 * @flags: numeric part of options
516 * @data: the rest of options
517 * @force: whether or not to force the change
519 * Alters the mount options of a mounted file system.
521 int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
523 int retval;
525 if (!(flags & MS_RDONLY) && bdev_read_only(sb->s_bdev))
526 return -EACCES;
527 if (flags & MS_RDONLY)
528 acct_auto_close(sb);
529 shrink_dcache_sb(sb);
530 fsync_super(sb);
532 /* If we are remounting RDONLY and current sb is read/write,
533 make sure there are no rw files opened */
534 if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY)) {
535 if (force)
536 mark_files_ro(sb);
537 else if (!fs_may_remount_ro(sb))
538 return -EBUSY;
541 if (sb->s_op->remount_fs) {
542 lock_super(sb);
543 retval = sb->s_op->remount_fs(sb, &flags, data);
544 unlock_super(sb);
545 if (retval)
546 return retval;
548 sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK);
549 return 0;
552 static void do_emergency_remount(unsigned long foo)
554 struct super_block *sb;
556 spin_lock(&sb_lock);
557 list_for_each_entry(sb, &super_blocks, s_list) {
558 sb->s_count++;
559 spin_unlock(&sb_lock);
560 down_read(&sb->s_umount);
561 if (sb->s_root && sb->s_bdev && !(sb->s_flags & MS_RDONLY)) {
563 * ->remount_fs needs lock_kernel().
565 * What lock protects sb->s_flags??
567 lock_kernel();
568 do_remount_sb(sb, MS_RDONLY, NULL, 1);
569 unlock_kernel();
571 drop_super(sb);
572 spin_lock(&sb_lock);
574 spin_unlock(&sb_lock);
575 printk("Emergency Remount complete\n");
578 void emergency_remount(void)
580 pdflush_operation(do_emergency_remount, 0);
584 * Unnamed block devices are dummy devices used by virtual
585 * filesystems which don't use real block-devices. -- jrs
588 static struct idr unnamed_dev_idr;
589 static spinlock_t unnamed_dev_lock = SPIN_LOCK_UNLOCKED;/* protects the above */
591 int set_anon_super(struct super_block *s, void *data)
593 int dev;
594 int error;
596 retry:
597 if (idr_pre_get(&unnamed_dev_idr, GFP_ATOMIC) == 0)
598 return -ENOMEM;
599 spin_lock(&unnamed_dev_lock);
600 error = idr_get_new(&unnamed_dev_idr, NULL, &dev);
601 spin_unlock(&unnamed_dev_lock);
602 if (error == -EAGAIN)
603 /* We raced and lost with another CPU. */
604 goto retry;
605 else if (error)
606 return -EAGAIN;
608 if ((dev & MAX_ID_MASK) == (1 << MINORBITS)) {
609 spin_lock(&unnamed_dev_lock);
610 idr_remove(&unnamed_dev_idr, dev);
611 spin_unlock(&unnamed_dev_lock);
612 return -EMFILE;
614 s->s_dev = MKDEV(0, dev & MINORMASK);
615 return 0;
618 EXPORT_SYMBOL(set_anon_super);
620 void kill_anon_super(struct super_block *sb)
622 int slot = MINOR(sb->s_dev);
624 generic_shutdown_super(sb);
625 spin_lock(&unnamed_dev_lock);
626 idr_remove(&unnamed_dev_idr, slot);
627 spin_unlock(&unnamed_dev_lock);
630 EXPORT_SYMBOL(kill_anon_super);
632 void __init unnamed_dev_init(void)
634 idr_init(&unnamed_dev_idr);
637 void kill_litter_super(struct super_block *sb)
639 if (sb->s_root)
640 d_genocide(sb->s_root);
641 kill_anon_super(sb);
644 EXPORT_SYMBOL(kill_litter_super);
646 static int set_bdev_super(struct super_block *s, void *data)
648 s->s_bdev = data;
649 s->s_dev = s->s_bdev->bd_dev;
650 return 0;
653 static int test_bdev_super(struct super_block *s, void *data)
655 return (void *)s->s_bdev == data;
658 struct super_block *get_sb_bdev(struct file_system_type *fs_type,
659 int flags, const char *dev_name, void *data,
660 int (*fill_super)(struct super_block *, void *, int))
662 struct block_device *bdev;
663 struct super_block *s;
664 int error = 0;
666 bdev = open_bdev_excl(dev_name, flags, fs_type);
667 if (IS_ERR(bdev))
668 return (struct super_block *)bdev;
671 * once the super is inserted into the list by sget, s_umount
672 * will protect the lockfs code from trying to start a snapshot
673 * while we are mounting
675 down(&bdev->bd_mount_sem);
676 s = sget(fs_type, test_bdev_super, set_bdev_super, bdev);
677 up(&bdev->bd_mount_sem);
678 if (IS_ERR(s))
679 goto out;
681 if (s->s_root) {
682 if ((flags ^ s->s_flags) & MS_RDONLY) {
683 up_write(&s->s_umount);
684 deactivate_super(s);
685 s = ERR_PTR(-EBUSY);
687 goto out;
688 } else {
689 char b[BDEVNAME_SIZE];
691 s->s_flags = flags;
692 strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
693 s->s_old_blocksize = block_size(bdev);
694 sb_set_blocksize(s, s->s_old_blocksize);
695 error = fill_super(s, data, flags & MS_VERBOSE ? 1 : 0);
696 if (error) {
697 up_write(&s->s_umount);
698 deactivate_super(s);
699 s = ERR_PTR(error);
700 } else
701 s->s_flags |= MS_ACTIVE;
704 return s;
706 out:
707 close_bdev_excl(bdev);
708 return s;
711 EXPORT_SYMBOL(get_sb_bdev);
713 void kill_block_super(struct super_block *sb)
715 struct block_device *bdev = sb->s_bdev;
716 generic_shutdown_super(sb);
717 set_blocksize(bdev, sb->s_old_blocksize);
718 close_bdev_excl(bdev);
721 EXPORT_SYMBOL(kill_block_super);
723 struct super_block *get_sb_nodev(struct file_system_type *fs_type,
724 int flags, void *data,
725 int (*fill_super)(struct super_block *, void *, int))
727 int error;
728 struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL);
730 if (IS_ERR(s))
731 return s;
733 s->s_flags = flags;
735 error = fill_super(s, data, flags & MS_VERBOSE ? 1 : 0);
736 if (error) {
737 up_write(&s->s_umount);
738 deactivate_super(s);
739 return ERR_PTR(error);
741 s->s_flags |= MS_ACTIVE;
742 return s;
745 EXPORT_SYMBOL(get_sb_nodev);
747 static int compare_single(struct super_block *s, void *p)
749 return 1;
752 struct super_block *get_sb_single(struct file_system_type *fs_type,
753 int flags, void *data,
754 int (*fill_super)(struct super_block *, void *, int))
756 struct super_block *s;
757 int error;
759 s = sget(fs_type, compare_single, set_anon_super, NULL);
760 if (IS_ERR(s))
761 return s;
762 if (!s->s_root) {
763 s->s_flags = flags;
764 error = fill_super(s, data, flags & MS_VERBOSE ? 1 : 0);
765 if (error) {
766 up_write(&s->s_umount);
767 deactivate_super(s);
768 return ERR_PTR(error);
770 s->s_flags |= MS_ACTIVE;
772 do_remount_sb(s, flags, data, 0);
773 return s;
776 EXPORT_SYMBOL(get_sb_single);
778 struct vfsmount *
779 do_kern_mount(const char *fstype, int flags, const char *name, void *data)
781 struct file_system_type *type = get_fs_type(fstype);
782 struct super_block *sb = ERR_PTR(-ENOMEM);
783 struct vfsmount *mnt;
784 int error;
785 char *secdata = NULL;
787 if (!type)
788 return ERR_PTR(-ENODEV);
790 mnt = alloc_vfsmnt(name);
791 if (!mnt)
792 goto out;
794 if (data) {
795 secdata = alloc_secdata();
796 if (!secdata) {
797 sb = ERR_PTR(-ENOMEM);
798 goto out_mnt;
801 error = security_sb_copy_data(type, data, secdata);
802 if (error) {
803 sb = ERR_PTR(error);
804 goto out_free_secdata;
808 sb = type->get_sb(type, flags, name, data);
809 if (IS_ERR(sb))
810 goto out_free_secdata;
811 error = security_sb_kern_mount(sb, secdata);
812 if (error)
813 goto out_sb;
814 mnt->mnt_sb = sb;
815 mnt->mnt_root = dget(sb->s_root);
816 mnt->mnt_mountpoint = sb->s_root;
817 mnt->mnt_parent = mnt;
818 mnt->mnt_namespace = current->namespace;
819 up_write(&sb->s_umount);
820 put_filesystem(type);
821 return mnt;
822 out_sb:
823 up_write(&sb->s_umount);
824 deactivate_super(sb);
825 sb = ERR_PTR(error);
826 out_free_secdata:
827 free_secdata(secdata);
828 out_mnt:
829 free_vfsmnt(mnt);
830 out:
831 put_filesystem(type);
832 return (struct vfsmount *)sb;
835 EXPORT_SYMBOL_GPL(do_kern_mount);
837 struct vfsmount *kern_mount(struct file_system_type *type)
839 return do_kern_mount(type->name, 0, type->name, NULL);
842 EXPORT_SYMBOL(kern_mount);