#endif
 #define pr_fmt(fmt) KBUILD_MODNAME ":pid:%d:%s: " fmt, current->pid, __func__
 
+extern struct file_system_type autofs_fs_type;
+
 /*
  * Unified info structure.  This is pointed to by both the dentry and
  * inode structures.  Each file in the filesystem has an instance of this
 
 static inline struct autofs_sb_info *autofs_sbi(struct super_block *sb)
 {
-       return sb->s_magic != AUTOFS_SUPER_MAGIC ?
-               NULL : (struct autofs_sb_info *)(sb->s_fs_info);
+       return (struct autofs_sb_info *)(sb->s_fs_info);
 }
 
 static inline struct autofs_info *autofs_dentry_ino(struct dentry *dentry)
 
        return err;
 }
 
-/*
- * Get the autofs super block info struct from the file opened on
- * the autofs mount point.
- */
-static struct autofs_sb_info *autofs_dev_ioctl_sbi(struct file *f)
-{
-       struct autofs_sb_info *sbi = NULL;
-       struct inode *inode;
-
-       if (f) {
-               inode = file_inode(f);
-               sbi = autofs_sbi(inode->i_sb);
-       }
-       return sbi;
-}
-
 /* Return autofs dev ioctl version */
 static int autofs_dev_ioctl_version(struct file *fp,
                                    struct autofs_sb_info *sbi,
        if (cmd != AUTOFS_DEV_IOCTL_VERSION_CMD &&
            cmd != AUTOFS_DEV_IOCTL_OPENMOUNT_CMD &&
            cmd != AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD) {
+               struct super_block *sb;
+
                fp = fget(param->ioctlfd);
                if (!fp) {
                        if (cmd == AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD)
                        goto out;
                }
 
-               sbi = autofs_dev_ioctl_sbi(fp);
-               if (!sbi || sbi->magic != AUTOFS_SBI_MAGIC) {
+               sb = file_inode(fp)->i_sb;
+               if (sb->s_type != &autofs_fs_type) {
                        err = -EINVAL;
                        fput(fp);
                        goto out;
                }
+               sbi = autofs_sbi(sb);
 
                /*
                 * Admin needs to be able to set the mount catatonic in
 
        return mount_nodev(fs_type, flags, data, autofs_fill_super);
 }
 
-static struct file_system_type autofs_fs_type = {
+struct file_system_type autofs_fs_type = {
        .owner          = THIS_MODULE,
        .name           = "autofs",
        .mount          = autofs_mount,