return err;
 }
 
-static struct vfsmount *fs_set_subtype(struct vfsmount *mnt, const char *fstype)
-{
-       int err;
-       const char *subtype = strchr(fstype, '.');
-       if (subtype) {
-               subtype++;
-               err = -EINVAL;
-               if (!subtype[0])
-                       goto err;
-       } else
-               subtype = "";
-
-       mnt->mnt_sb->s_subtype = kstrdup(subtype, GFP_KERNEL);
-       err = -ENOMEM;
-       if (!mnt->mnt_sb->s_subtype)
-               goto err;
-       return mnt;
-
- err:
-       mntput(mnt);
-       return ERR_PTR(err);
-}
-
 /*
  * add a mount into a namespace's mount tree
  */
 {
        struct file_system_type *type;
        struct vfsmount *mnt;
-       int err;
+       struct fs_context *fc;
+       const char *subtype = NULL;
+       int err = 0;
 
        if (!fstype)
                return -EINVAL;
        if (!type)
                return -ENODEV;
 
-       mnt = vfs_kern_mount(type, sb_flags, name, data);
-       if (!IS_ERR(mnt) && (type->fs_flags & FS_HAS_SUBTYPE) &&
-           !mnt->mnt_sb->s_subtype)
-               mnt = fs_set_subtype(mnt, fstype);
+       if (type->fs_flags & FS_HAS_SUBTYPE) {
+               subtype = strchr(fstype, '.');
+               if (subtype) {
+                       subtype++;
+                       if (!*subtype) {
+                               put_filesystem(type);
+                               return -EINVAL;
+                       }
+               } else {
+                       subtype = "";
+               }
+       }
 
+       fc = fs_context_for_mount(type, sb_flags);
        put_filesystem(type);
-       if (IS_ERR(mnt))
-               return PTR_ERR(mnt);
+       if (IS_ERR(fc))
+               return PTR_ERR(fc);
+
+       if (subtype) {
+               fc->subtype = kstrdup(subtype, GFP_KERNEL);
+               if (!fc->subtype)
+                       err = -ENOMEM;
+       }
+       if (!err && name) {
+               fc->source = kstrdup(name, GFP_KERNEL);
+               if (!fc->source)
+                       err = -ENOMEM;
+       }
+       if (!err)
+               err = parse_monolithic_mount_data(fc, data);
+       if (!err)
+               err = vfs_get_tree(fc);
+       if (err)
+               goto out;
+
+       up_write(&fc->root->d_sb->s_umount);
+       mnt = vfs_create_mount(fc);
+       if (IS_ERR(mnt)) {
+               err = PTR_ERR(mnt);
+               goto out;
+       }
 
        if (mount_too_revealing(mnt, &mnt_flags)) {
                mntput(mnt);
-               return -EPERM;
+               err = -EPERM;
+               goto out;
        }
 
        err = do_add_mount(real_mount(mnt), path, mnt_flags);
        if (err)
                mntput(mnt);
+out:
+       put_fs_context(fc);
        return err;
 }