4 * Copyright (C) 1991, 1992 Linus Torvalds
6 * super.c contains code to handle: - mount structures
8 * - filesystem drivers list
10 * - umount 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/module.h>
24 #include <linux/slab.h>
25 #include <linux/acct.h>
26 #include <linux/blkdev.h>
27 #include <linux/quotaops.h>
28 #include <linux/mount.h>
29 #include <linux/security.h>
30 #include <linux/writeback.h> /* for the emergency remount stuff */
31 #include <linux/idr.h>
32 #include <linux/mutex.h>
33 #include <linux/backing-dev.h>
37 LIST_HEAD(super_blocks);
38 DEFINE_SPINLOCK(sb_lock);
41 * alloc_super - create new superblock
42 * @type: filesystem type superblock should belong to
44 * Allocates and initializes a new &struct super_block. alloc_super()
45 * returns a pointer new superblock or %NULL if allocation had failed.
47 static struct super_block *alloc_super(struct file_system_type *type)
49 struct super_block *s = kzalloc(sizeof(struct super_block), GFP_USER);
50 static const struct super_operations default_op;
53 if (security_sb_alloc(s)) {
58 INIT_LIST_HEAD(&s->s_files);
59 INIT_LIST_HEAD(&s->s_instances);
60 INIT_HLIST_HEAD(&s->s_anon);
61 INIT_LIST_HEAD(&s->s_inodes);
62 INIT_LIST_HEAD(&s->s_dentry_lru);
63 init_rwsem(&s->s_umount);
64 mutex_init(&s->s_lock);
65 lockdep_set_class(&s->s_umount, &type->s_umount_key);
67 * The locking rules for s_lock are up to the
68 * filesystem. For example ext3fs has different
69 * lock ordering than usbfs:
71 lockdep_set_class(&s->s_lock, &type->s_lock_key);
73 * sget() can have s_umount recursion.
75 * When it cannot find a suitable sb, it allocates a new
76 * one (this one), and tries again to find a suitable old
79 * In case that succeeds, it will acquire the s_umount
80 * lock of the old one. Since these are clearly distrinct
81 * locks, and this object isn't exposed yet, there's no
84 * Annotate this by putting this lock in a different
87 down_write_nested(&s->s_umount, SINGLE_DEPTH_NESTING);
89 atomic_set(&s->s_active, 1);
90 mutex_init(&s->s_vfs_rename_mutex);
91 lockdep_set_class(&s->s_vfs_rename_mutex, &type->s_vfs_rename_key);
92 mutex_init(&s->s_dquot.dqio_mutex);
93 mutex_init(&s->s_dquot.dqonoff_mutex);
94 init_rwsem(&s->s_dquot.dqptr_sem);
95 init_waitqueue_head(&s->s_wait_unfrozen);
96 s->s_maxbytes = MAX_NON_LFS;
97 s->dq_op = sb_dquot_ops;
98 s->s_qcop = sb_quotactl_ops;
99 s->s_op = &default_op;
100 s->s_time_gran = 1000000000;
107 * destroy_super - frees a superblock
108 * @s: superblock to free
110 * Frees a superblock.
112 static inline void destroy_super(struct super_block *s)
120 /* Superblock refcounting */
123 * Drop a superblock's refcount. The caller must hold sb_lock.
125 void __put_super(struct super_block *sb)
127 if (!--sb->s_count) {
128 list_del_init(&sb->s_list);
134 * put_super - drop a temporary reference to superblock
135 * @sb: superblock in question
137 * Drops a temporary reference, frees superblock if there's no
140 void put_super(struct super_block *sb)
144 spin_unlock(&sb_lock);
149 * deactivate_locked_super - drop an active reference to superblock
150 * @s: superblock to deactivate
152 * Drops an active reference to superblock, converting it into a temprory
153 * one if there is no other active references left. In that case we
154 * tell fs driver to shut it down and drop the temporary reference we
157 * Caller holds exclusive lock on superblock; that lock is released.
159 void deactivate_locked_super(struct super_block *s)
161 struct file_system_type *fs = s->s_type;
162 if (atomic_dec_and_test(&s->s_active)) {
167 up_write(&s->s_umount);
171 EXPORT_SYMBOL(deactivate_locked_super);
174 * deactivate_super - drop an active reference to superblock
175 * @s: superblock to deactivate
177 * Variant of deactivate_locked_super(), except that superblock is *not*
178 * locked by caller. If we are going to drop the final active reference,
179 * lock will be acquired prior to that.
181 void deactivate_super(struct super_block *s)
183 if (!atomic_add_unless(&s->s_active, -1, 1)) {
184 down_write(&s->s_umount);
185 deactivate_locked_super(s);
189 EXPORT_SYMBOL(deactivate_super);
192 * grab_super - acquire an active reference
193 * @s: reference we are trying to make active
195 * Tries to acquire an active reference. grab_super() is used when we
196 * had just found a superblock in super_blocks or fs_type->fs_supers
197 * and want to turn it into a full-blown active reference. grab_super()
198 * is called with sb_lock held and drops it. Returns 1 in case of
199 * success, 0 if we had failed (superblock contents was already dead or
200 * dying when grab_super() had been called).
202 static int grab_super(struct super_block *s) __releases(sb_lock)
204 if (atomic_inc_not_zero(&s->s_active)) {
205 spin_unlock(&sb_lock);
208 /* it's going away */
210 spin_unlock(&sb_lock);
211 /* wait for it to die */
212 down_write(&s->s_umount);
213 up_write(&s->s_umount);
219 * Superblock locking. We really ought to get rid of these two.
221 void lock_super(struct super_block * sb)
224 mutex_lock(&sb->s_lock);
227 void unlock_super(struct super_block * sb)
230 mutex_unlock(&sb->s_lock);
233 EXPORT_SYMBOL(lock_super);
234 EXPORT_SYMBOL(unlock_super);
237 * generic_shutdown_super - common helper for ->kill_sb()
238 * @sb: superblock to kill
240 * generic_shutdown_super() does all fs-independent work on superblock
241 * shutdown. Typical ->kill_sb() should pick all fs-specific objects
242 * that need destruction out of superblock, call generic_shutdown_super()
243 * and release aforementioned objects. Note: dentries and inodes _are_
244 * taken care of and do not need specific handling.
246 * Upon calling this function, the filesystem may no longer alter or
247 * rearrange the set of dentries belonging to this super_block, nor may it
248 * change the attachments of dentries to inodes.
250 void generic_shutdown_super(struct super_block *sb)
252 const struct super_operations *sop = sb->s_op;
256 shrink_dcache_for_umount(sb);
259 sb->s_flags &= ~MS_ACTIVE;
261 /* bad name - it should be evict_inodes() */
262 invalidate_inodes(sb);
267 /* Forget any remaining inodes */
268 if (invalidate_inodes(sb)) {
269 printk("VFS: Busy inodes after unmount of %s. "
270 "Self-destruct in 5 seconds. Have a nice day...\n",
276 /* should be initialized for __put_super_and_need_restart() */
277 list_del_init(&sb->s_instances);
278 spin_unlock(&sb_lock);
279 up_write(&sb->s_umount);
282 EXPORT_SYMBOL(generic_shutdown_super);
285 * sget - find or create a superblock
286 * @type: filesystem type superblock should belong to
287 * @test: comparison callback
288 * @set: setup callback
289 * @data: argument to each of them
291 struct super_block *sget(struct file_system_type *type,
292 int (*test)(struct super_block *,void *),
293 int (*set)(struct super_block *,void *),
296 struct super_block *s = NULL;
297 struct super_block *old;
303 list_for_each_entry(old, &type->fs_supers, s_instances) {
304 if (!test(old, data))
306 if (!grab_super(old))
309 up_write(&s->s_umount);
312 down_write(&old->s_umount);
317 spin_unlock(&sb_lock);
318 s = alloc_super(type);
320 return ERR_PTR(-ENOMEM);
326 spin_unlock(&sb_lock);
327 up_write(&s->s_umount);
332 strlcpy(s->s_id, type->name, sizeof(s->s_id));
333 list_add_tail(&s->s_list, &super_blocks);
334 list_add(&s->s_instances, &type->fs_supers);
335 spin_unlock(&sb_lock);
336 get_filesystem(type);
342 void drop_super(struct super_block *sb)
344 up_read(&sb->s_umount);
348 EXPORT_SYMBOL(drop_super);
351 * sync_supers - helper for periodic superblock writeback
353 * Call the write_super method if present on all dirty superblocks in
354 * the system. This is for the periodic writeback used by most older
355 * filesystems. For data integrity superblock writeback use
356 * sync_filesystems() instead.
358 * Note: check the dirty flag before waiting, so we don't
359 * hold up the sync while mounting a device. (The newly
360 * mounted device won't need syncing.)
362 void sync_supers(void)
364 struct super_block *sb, *n;
367 list_for_each_entry_safe(sb, n, &super_blocks, s_list) {
368 if (list_empty(&sb->s_instances))
370 if (sb->s_op->write_super && sb->s_dirt) {
372 spin_unlock(&sb_lock);
374 down_read(&sb->s_umount);
375 if (sb->s_root && sb->s_dirt)
376 sb->s_op->write_super(sb);
377 up_read(&sb->s_umount);
383 spin_unlock(&sb_lock);
387 * iterate_supers - call function for all active superblocks
388 * @f: function to call
389 * @arg: argument to pass to it
391 * Scans the superblock list and calls given function, passing it
392 * locked superblock and given argument.
394 void iterate_supers(void (*f)(struct super_block *, void *), void *arg)
396 struct super_block *sb, *n;
399 list_for_each_entry_safe(sb, n, &super_blocks, s_list) {
400 if (list_empty(&sb->s_instances))
403 spin_unlock(&sb_lock);
405 down_read(&sb->s_umount);
408 up_read(&sb->s_umount);
413 spin_unlock(&sb_lock);
417 * get_super - get the superblock of a device
418 * @bdev: device to get the superblock for
420 * Scans the superblock list and finds the superblock of the file system
421 * mounted on the device given. %NULL is returned if no match is found.
424 struct super_block *get_super(struct block_device *bdev)
426 struct super_block *sb;
433 list_for_each_entry(sb, &super_blocks, s_list) {
434 if (list_empty(&sb->s_instances))
436 if (sb->s_bdev == bdev) {
438 spin_unlock(&sb_lock);
439 down_read(&sb->s_umount);
443 up_read(&sb->s_umount);
444 /* nope, got unmounted */
450 spin_unlock(&sb_lock);
454 EXPORT_SYMBOL(get_super);
457 * get_active_super - get an active reference to the superblock of a device
458 * @bdev: device to get the superblock for
460 * Scans the superblock list and finds the superblock of the file system
461 * mounted on the device given. Returns the superblock with an active
462 * reference or %NULL if none was found.
464 struct super_block *get_active_super(struct block_device *bdev)
466 struct super_block *sb;
473 list_for_each_entry(sb, &super_blocks, s_list) {
474 if (list_empty(&sb->s_instances))
476 if (sb->s_bdev == bdev) {
477 if (grab_super(sb)) /* drops sb_lock */
483 spin_unlock(&sb_lock);
487 struct super_block *user_get_super(dev_t dev)
489 struct super_block *sb;
493 list_for_each_entry(sb, &super_blocks, s_list) {
494 if (list_empty(&sb->s_instances))
496 if (sb->s_dev == dev) {
498 spin_unlock(&sb_lock);
499 down_read(&sb->s_umount);
503 up_read(&sb->s_umount);
504 /* nope, got unmounted */
510 spin_unlock(&sb_lock);
515 * do_remount_sb - asks filesystem to change mount options.
516 * @sb: superblock in question
517 * @flags: numeric part of options
518 * @data: the rest of options
519 * @force: whether or not to force the change
521 * Alters the mount options of a mounted file system.
523 int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
528 if (sb->s_frozen != SB_UNFROZEN)
532 if (!(flags & MS_RDONLY) && bdev_read_only(sb->s_bdev))
536 if (flags & MS_RDONLY)
538 shrink_dcache_sb(sb);
541 remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY);
543 /* If we are remounting RDONLY and current sb is read/write,
544 make sure there are no rw files opened */
548 else if (!fs_may_remount_ro(sb))
552 if (sb->s_op->remount_fs) {
553 retval = sb->s_op->remount_fs(sb, &flags, data);
557 sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK);
560 * Some filesystems modify their metadata via some other path than the
561 * bdev buffer cache (eg. use a private mapping, or directories in
562 * pagecache, etc). Also file data modifications go via their own
563 * mappings. So If we try to mount readonly then copy the filesystem
564 * from bdev, we could get stale data, so invalidate it to give a best
565 * effort at coherency.
567 if (remount_ro && sb->s_bdev)
568 invalidate_bdev(sb->s_bdev);
572 static void do_emergency_remount(struct work_struct *work)
574 struct super_block *sb, *n;
577 list_for_each_entry_safe(sb, n, &super_blocks, s_list) {
578 if (list_empty(&sb->s_instances))
581 spin_unlock(&sb_lock);
582 down_write(&sb->s_umount);
583 if (sb->s_root && sb->s_bdev && !(sb->s_flags & MS_RDONLY)) {
585 * What lock protects sb->s_flags??
587 do_remount_sb(sb, MS_RDONLY, NULL, 1);
589 up_write(&sb->s_umount);
593 spin_unlock(&sb_lock);
595 printk("Emergency Remount complete\n");
598 void emergency_remount(void)
600 struct work_struct *work;
602 work = kmalloc(sizeof(*work), GFP_ATOMIC);
604 INIT_WORK(work, do_emergency_remount);
610 * Unnamed block devices are dummy devices used by virtual
611 * filesystems which don't use real block-devices. -- jrs
614 static DEFINE_IDA(unnamed_dev_ida);
615 static DEFINE_SPINLOCK(unnamed_dev_lock);/* protects the above */
616 static int unnamed_dev_start = 0; /* don't bother trying below it */
618 int set_anon_super(struct super_block *s, void *data)
624 if (ida_pre_get(&unnamed_dev_ida, GFP_ATOMIC) == 0)
626 spin_lock(&unnamed_dev_lock);
627 error = ida_get_new_above(&unnamed_dev_ida, unnamed_dev_start, &dev);
629 unnamed_dev_start = dev + 1;
630 spin_unlock(&unnamed_dev_lock);
631 if (error == -EAGAIN)
632 /* We raced and lost with another CPU. */
637 if ((dev & MAX_ID_MASK) == (1 << MINORBITS)) {
638 spin_lock(&unnamed_dev_lock);
639 ida_remove(&unnamed_dev_ida, dev);
640 if (unnamed_dev_start > dev)
641 unnamed_dev_start = dev;
642 spin_unlock(&unnamed_dev_lock);
645 s->s_dev = MKDEV(0, dev & MINORMASK);
646 s->s_bdi = &noop_backing_dev_info;
650 EXPORT_SYMBOL(set_anon_super);
652 void kill_anon_super(struct super_block *sb)
654 int slot = MINOR(sb->s_dev);
656 generic_shutdown_super(sb);
657 spin_lock(&unnamed_dev_lock);
658 ida_remove(&unnamed_dev_ida, slot);
659 if (slot < unnamed_dev_start)
660 unnamed_dev_start = slot;
661 spin_unlock(&unnamed_dev_lock);
664 EXPORT_SYMBOL(kill_anon_super);
666 void kill_litter_super(struct super_block *sb)
669 d_genocide(sb->s_root);
673 EXPORT_SYMBOL(kill_litter_super);
675 static int ns_test_super(struct super_block *sb, void *data)
677 return sb->s_fs_info == data;
680 static int ns_set_super(struct super_block *sb, void *data)
682 sb->s_fs_info = data;
683 return set_anon_super(sb, NULL);
686 int get_sb_ns(struct file_system_type *fs_type, int flags, void *data,
687 int (*fill_super)(struct super_block *, void *, int),
688 struct vfsmount *mnt)
690 struct super_block *sb;
692 sb = sget(fs_type, ns_test_super, ns_set_super, data);
699 err = fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
701 deactivate_locked_super(sb);
705 sb->s_flags |= MS_ACTIVE;
708 simple_set_mnt(mnt, sb);
712 EXPORT_SYMBOL(get_sb_ns);
715 static int set_bdev_super(struct super_block *s, void *data)
718 s->s_dev = s->s_bdev->bd_dev;
721 * We set the bdi here to the queue backing, file systems can
722 * overwrite this in ->fill_super()
724 s->s_bdi = &bdev_get_queue(s->s_bdev)->backing_dev_info;
728 static int test_bdev_super(struct super_block *s, void *data)
730 return (void *)s->s_bdev == data;
733 int get_sb_bdev(struct file_system_type *fs_type,
734 int flags, const char *dev_name, void *data,
735 int (*fill_super)(struct super_block *, void *, int),
736 struct vfsmount *mnt)
738 struct block_device *bdev;
739 struct super_block *s;
740 fmode_t mode = FMODE_READ;
743 if (!(flags & MS_RDONLY))
746 bdev = open_bdev_exclusive(dev_name, mode, fs_type);
748 return PTR_ERR(bdev);
751 * once the super is inserted into the list by sget, s_umount
752 * will protect the lockfs code from trying to start a snapshot
753 * while we are mounting
755 mutex_lock(&bdev->bd_fsfreeze_mutex);
756 if (bdev->bd_fsfreeze_count > 0) {
757 mutex_unlock(&bdev->bd_fsfreeze_mutex);
761 s = sget(fs_type, test_bdev_super, set_bdev_super, bdev);
762 mutex_unlock(&bdev->bd_fsfreeze_mutex);
767 if ((flags ^ s->s_flags) & MS_RDONLY) {
768 deactivate_locked_super(s);
773 close_bdev_exclusive(bdev, mode);
775 char b[BDEVNAME_SIZE];
779 strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
780 sb_set_blocksize(s, block_size(bdev));
781 error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
783 deactivate_locked_super(s);
787 s->s_flags |= MS_ACTIVE;
791 simple_set_mnt(mnt, s);
797 close_bdev_exclusive(bdev, mode);
802 EXPORT_SYMBOL(get_sb_bdev);
804 void kill_block_super(struct super_block *sb)
806 struct block_device *bdev = sb->s_bdev;
807 fmode_t mode = sb->s_mode;
809 bdev->bd_super = NULL;
810 generic_shutdown_super(sb);
812 close_bdev_exclusive(bdev, mode);
815 EXPORT_SYMBOL(kill_block_super);
818 int get_sb_nodev(struct file_system_type *fs_type,
819 int flags, void *data,
820 int (*fill_super)(struct super_block *, void *, int),
821 struct vfsmount *mnt)
824 struct super_block *s = sget(fs_type, NULL, set_anon_super, NULL);
831 error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
833 deactivate_locked_super(s);
836 s->s_flags |= MS_ACTIVE;
837 simple_set_mnt(mnt, s);
841 EXPORT_SYMBOL(get_sb_nodev);
843 static int compare_single(struct super_block *s, void *p)
848 int get_sb_single(struct file_system_type *fs_type,
849 int flags, void *data,
850 int (*fill_super)(struct super_block *, void *, int),
851 struct vfsmount *mnt)
853 struct super_block *s;
856 s = sget(fs_type, compare_single, set_anon_super, NULL);
861 error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
863 deactivate_locked_super(s);
866 s->s_flags |= MS_ACTIVE;
868 do_remount_sb(s, flags, data, 0);
870 simple_set_mnt(mnt, s);
874 EXPORT_SYMBOL(get_sb_single);
877 vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void *data)
879 struct vfsmount *mnt;
880 char *secdata = NULL;
884 return ERR_PTR(-ENODEV);
887 mnt = alloc_vfsmnt(name);
891 if (flags & MS_KERNMOUNT)
892 mnt->mnt_flags = MNT_INTERNAL;
894 if (data && !(type->fs_flags & FS_BINARY_MOUNTDATA)) {
895 secdata = alloc_secdata();
899 error = security_sb_copy_data(data, secdata);
901 goto out_free_secdata;
904 error = type->get_sb(type, flags, name, data, mnt);
906 goto out_free_secdata;
907 BUG_ON(!mnt->mnt_sb);
908 WARN_ON(!mnt->mnt_sb->s_bdi);
910 error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata);
915 * filesystems should never set s_maxbytes larger than MAX_LFS_FILESIZE
916 * but s_maxbytes was an unsigned long long for many releases. Throw
917 * this warning for a little while to try and catch filesystems that
918 * violate this rule. This warning should be either removed or
919 * converted to a BUG() in 2.6.34.
921 WARN((mnt->mnt_sb->s_maxbytes < 0), "%s set sb->s_maxbytes to "
922 "negative value (%lld)\n", type->name, mnt->mnt_sb->s_maxbytes);
924 mnt->mnt_mountpoint = mnt->mnt_root;
925 mnt->mnt_parent = mnt;
926 up_write(&mnt->mnt_sb->s_umount);
927 free_secdata(secdata);
931 deactivate_locked_super(mnt->mnt_sb);
933 free_secdata(secdata);
937 return ERR_PTR(error);
940 EXPORT_SYMBOL_GPL(vfs_kern_mount);
943 * freeze_super -- lock the filesystem and force it into a consistent state
944 * @super: the super to lock
946 * Syncs the super to make sure the filesystem is consistent and calls the fs's
947 * freeze_fs. Subsequent calls to this without first thawing the fs will return
950 int freeze_super(struct super_block *sb)
954 atomic_inc(&sb->s_active);
955 down_write(&sb->s_umount);
957 deactivate_locked_super(sb);
961 if (sb->s_flags & MS_RDONLY) {
962 sb->s_frozen = SB_FREEZE_TRANS;
964 up_write(&sb->s_umount);
968 sb->s_frozen = SB_FREEZE_WRITE;
973 sb->s_frozen = SB_FREEZE_TRANS;
976 sync_blockdev(sb->s_bdev);
977 if (sb->s_op->freeze_fs) {
978 ret = sb->s_op->freeze_fs(sb);
981 "VFS:Filesystem freeze failed\n");
982 sb->s_frozen = SB_UNFROZEN;
983 deactivate_locked_super(sb);
987 up_write(&sb->s_umount);
990 EXPORT_SYMBOL(freeze_super);
993 * thaw_super -- unlock filesystem
994 * @sb: the super to thaw
996 * Unlocks the filesystem and marks it writeable again after freeze_super().
998 int thaw_super(struct super_block *sb)
1002 down_write(&sb->s_umount);
1003 if (sb->s_frozen == SB_UNFROZEN) {
1004 up_write(&sb->s_umount);
1008 if (sb->s_flags & MS_RDONLY)
1011 if (sb->s_op->unfreeze_fs) {
1012 error = sb->s_op->unfreeze_fs(sb);
1015 "VFS:Filesystem thaw failed\n");
1016 sb->s_frozen = SB_FREEZE_TRANS;
1017 up_write(&sb->s_umount);
1023 sb->s_frozen = SB_UNFROZEN;
1025 wake_up(&sb->s_wait_unfrozen);
1026 deactivate_locked_super(sb);
1030 EXPORT_SYMBOL(thaw_super);
1032 static struct vfsmount *fs_set_subtype(struct vfsmount *mnt, const char *fstype)
1035 const char *subtype = strchr(fstype, '.');
1044 mnt->mnt_sb->s_subtype = kstrdup(subtype, GFP_KERNEL);
1046 if (!mnt->mnt_sb->s_subtype)
1052 return ERR_PTR(err);
1056 do_kern_mount(const char *fstype, int flags, const char *name, void *data)
1058 struct file_system_type *type = get_fs_type(fstype);
1059 struct vfsmount *mnt;
1061 return ERR_PTR(-ENODEV);
1062 mnt = vfs_kern_mount(type, flags, name, data);
1063 if (!IS_ERR(mnt) && (type->fs_flags & FS_HAS_SUBTYPE) &&
1064 !mnt->mnt_sb->s_subtype)
1065 mnt = fs_set_subtype(mnt, fstype);
1066 put_filesystem(type);
1069 EXPORT_SYMBOL_GPL(do_kern_mount);
1071 struct vfsmount *kern_mount_data(struct file_system_type *type, void *data)
1073 return vfs_kern_mount(type, MS_KERNMOUNT, type->name, data);
1076 EXPORT_SYMBOL_GPL(kern_mount_data);