From a2225d931f75ddd3c39f4d0d195fad99dfd68671 Mon Sep 17 00:00:00 2001
From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Mon, 11 Jun 2018 08:22:34 -0700
Subject: [PATCH] autofs: remove left-over autofs4 stubs

There's no need to retain the fs/autofs4 directory for backward
compatibility.

Adding an AUTOFS4_FS fragment to the autofs Kconfig and a module alias
for autofs4 is sufficient for almost all cases. Not keeping fs/autofs4
remnants will prevent "insmod <path>/autofs4/autofs4.ko" from working
but this shouldn't be used in automation scripts rather than
modprobe(8).

There were some comments about things to look out for with the module
rename in the fs/autofs4/Kconfig that is removed by this patch, see the
commit patch if you are interested.

One potential problem with this change is that when the
fs/autofs/Kconfig fragment for AUTOFS4_FS is removed any AUTOFS4_FS
entries will be removed from the kernel config, resulting in no autofs
file system being built if there is no AUTOFS_FS entry also.

This would have also happened if the fs/autofs4 remnants had remained
and is most likely to be a problem with automated builds.

Please check your build configurations before the removal which will
occur after the next couple of kernel releases.

Acked-by: Ian Kent <raven@themaw.net>
[ With edits and commit message from Ian Kent ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---
 fs/Kconfig          |  1 -
 fs/Makefile         |  1 -
 fs/autofs/Kconfig   | 11 +++++++++++
 fs/autofs/init.c    |  1 +
 fs/autofs4/Kconfig  | 46 ---------------------------------------------
 fs/autofs4/Makefile |  9 ---------
 6 files changed, 12 insertions(+), 57 deletions(-)
 delete mode 100644 fs/autofs4/Kconfig
 delete mode 100644 fs/autofs4/Makefile

diff --git a/fs/Kconfig b/fs/Kconfig
index ab2d96d1abee3..ac474a61be379 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -110,7 +110,6 @@ source "fs/notify/Kconfig"
 source "fs/quota/Kconfig"
 
 source "fs/autofs/Kconfig"
-source "fs/autofs4/Kconfig"
 source "fs/fuse/Kconfig"
 source "fs/overlayfs/Kconfig"
 
diff --git a/fs/Makefile b/fs/Makefile
index 2e005525cc191..293733f61594b 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -103,7 +103,6 @@ obj-$(CONFIG_ROMFS_FS)		+= romfs/
 obj-$(CONFIG_QNX4FS_FS)		+= qnx4/
 obj-$(CONFIG_QNX6FS_FS)		+= qnx6/
 obj-$(CONFIG_AUTOFS_FS)		+= autofs/
-obj-$(CONFIG_AUTOFS4_FS)	+= autofs4/
 obj-$(CONFIG_ADFS_FS)		+= adfs/
 obj-$(CONFIG_FUSE_FS)		+= fuse/
 obj-$(CONFIG_OVERLAY_FS)	+= overlayfs/
diff --git a/fs/autofs/Kconfig b/fs/autofs/Kconfig
index 6a2064eb3b272..55c3930a907b3 100644
--- a/fs/autofs/Kconfig
+++ b/fs/autofs/Kconfig
@@ -1,3 +1,14 @@
+config AUTOFS4_FS
+	tristate "Old Kconfig name for Kernel automounter support"
+	select AUTOFS_FS
+	help
+	   This name exists for people to just automatically pick up the
+	   new name of the autofs Kconfig option. All it does is select
+	   thenew new option name.
+
+	   It will go away in a release or two as people have
+	   transitioned to just plain AUTOFS_FS.
+
 config AUTOFS_FS
 	tristate "Kernel automounter support (supports v3, v4 and v5)"
 	default n
diff --git a/fs/autofs/init.c b/fs/autofs/init.c
index 16fb61315843d..cc9447e1903f7 100644
--- a/fs/autofs/init.c
+++ b/fs/autofs/init.c
@@ -23,6 +23,7 @@ static struct file_system_type autofs_fs_type = {
 	.kill_sb	= autofs_kill_sb,
 };
 MODULE_ALIAS_FS("autofs");
+MODULE_ALIAS("autofs4");
 
 static int __init init_autofs_fs(void)
 {
diff --git a/fs/autofs4/Kconfig b/fs/autofs4/Kconfig
deleted file mode 100644
index 99fda4d6da25a..0000000000000
--- a/fs/autofs4/Kconfig
+++ /dev/null
@@ -1,46 +0,0 @@
-config AUTOFS4_FS
-	tristate "Kernel automounter version 4 support (also supports v3 and v5)"
-	default n
-	depends on AUTOFS_FS = n
-	help
-	  The automounter is a tool to automatically mount remote file systems
-	  on demand. This implementation is partially kernel-based to reduce
-	  overhead in the already-mounted case; this is unlike the BSD
-	  automounter (amd), which is a pure user space daemon.
-
-	  To use the automounter you need the user-space tools from
-	  <https://www.kernel.org/pub/linux/daemons/autofs/>; you also want
-	  to answer Y to "NFS file system support", below.
-
-	  This module is in the process of being renamed from autofs4 to
-	  autofs. Since autofs is now the only module that provides the
-	  autofs file system the module is not version 4 specific.
-
-	  The autofs4 module is now built from the source located in
-	  fs/autofs. The autofs4 directory and its configuration entry
-	  will be removed two kernel versions from the inclusion of this
-	  change.
-
-	  Changes that will need to be made should be limited to:
-	  - source include statments should be changed from autofs_fs4.h to
-	    autofs_fs.h since these two header files have been merged.
-	  - user space scripts that manually load autofs4.ko should be
-	    changed to load autofs.ko. But since the module directory name
-	    and the module name are the same as the file system name there
-	    is no need to manually load module.
-	  - any "alias autofs autofs4" will need to be removed.
-	  - due to the autofs4 module directory name not being the same as
-	    its file system name autoloading didn't work properly. Because
-	    of this kernel configurations would often build the module into
-	    the kernel. This may have resulted in selinux policies that will
-	    prevent the autofs module from autoloading and will need to be
-	    updated.
-
-	  Please configure AUTOFS_FS instead of AUTOFS4_FS from now on.
-
-	  NOTE: Since the modules autofs and autofs4 use the same file system
-		type name of "autofs" only one can be built. The "depends"
-		above will result in AUTOFS4_FS not appearing in .config for
-		any setting of AUTOFS_FS other than n and AUTOFS4_FS will
-		appear under the AUTOFS_FS entry otherwise which is intended
-		to draw attention to the module rename change.
diff --git a/fs/autofs4/Makefile b/fs/autofs4/Makefile
deleted file mode 100644
index 417dd726d9ef6..0000000000000
--- a/fs/autofs4/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# Makefile for the linux autofs-filesystem routines.
-#
-
-obj-$(CONFIG_AUTOFS4_FS) += autofs4.o
-
-autofs4-objs := ../autofs/init.o ../autofs/inode.o ../autofs/root.o \
-	../autofs/symlink.o ../autofs/waitq.o ../autofs/expire.o \
-	../autofs/dev-ioctl.o
-- 
GitLab