[PATCH] fix for autofs4 stomping on autofs v3

From: Jeremy Fitzhardinge (jeremy@goop.org)
Date: Mon Jan 31 2000 - 01:43:07 EST


Hi,

There was a problem where the autofs v3 kernel code was using the same
AUTOFS_PROTO_VERSION as the v4 code, which confused autofs v3 user-mode code.

The basic problem is that linux/auto_fs.h doesn't describe just one interface
version, but several (two in this case). Similarly, the user-mode code doesn't
talk "the" protocol version its header file happens to have in it, but the
particular version it implements (ie, its independent of the header file it
includes).

The quick fix is to rearrange the #defines so that everything gets the info it
needs. The better fix is to make the protocol version a particular party is
talking distinct from the particular header file it includes.

The patch below is the quick fix, and is not too far off the proper fix (except
I didn't want to modify the original autofs source at all).

        J


--- 2.3/Documentation/Configure.help Sat Jan 29 14:47:15 2000
+++ linux/Documentation/Configure.help Sun Jan 30 11:34:15 2000
@@ -8735,6 +8735,30 @@
   If you are not a part of a fairly large, distributed network, you
   probably do not need an automounter, and can say N here.
 
+ If you want to use the newer version of autofs with more features,
+ say N here and select automounter v4.
+
+Kernel automounter v4 support
+CONFIG_AUTOFS4_FS
+ The automounter is a tool to automatically mount remote filesystems
+ 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
+ ftp://ftp.kernel.org/pub/linux/daemons/autofs/testing-v4 ; you also
+ want to answer Y to "NFS filesystem support", below.
+
+ If you want to compile this as a module ( = code which can be
+ inserted in and removed from the running kernel whenever you want),
+ say M here and read Documentation/modules.txt. The module will be
+ called autofs4.o. You will need to add "alias autofs autofs4" to
+ your modules configuration file.
+
+ If you are not a part of a fairly large, distributed network or don't
+ have a laptop which needs to dynamically reconfigure to the local
+ network, you probably do not need an automounter, and can say N here.
+
 EFS filesystem support (read only) (EXPERIMENTAL)
 CONFIG_EFS_FS
   EFS is an older filesystem used for non-ISO9660 CDROMs and hard disk
--- 2.3/include/linux/auto_fs.h Sat Jan 29 14:47:43 2000
+++ linux/include/linux/auto_fs.h Sun Jan 30 22:24:56 2000
@@ -20,8 +20,14 @@
 #include <linux/ioctl.h>
 #include <asm/types.h>
 
+/* This header file describes a range of autofs interface versions;
+ the new implementation ("autofs4") supports them all, but the old
+ implementation only supports v3. */
 #define AUTOFS_MIN_PROTO_VERSION 3 /* Min version we support */
-#define AUTOFS_PROTO_VERSION 4 /* Current version */
+#define AUTOFS_MAX_PROTO_VERSION 4 /* Max (current) version */
+
+/* Backwards compat for autofs v3; it just implements a version */
+#define AUTOFS_PROTO_VERSION 3 /* v3 version */
 
 /*
  * Architectures where both 32- and 64-bit binaries can be executed
diff -X ../diffexcl -Nur 2.3/fs/autofs4/inode.c abulafia-2.3/fs/autofs4/inode.c
--- 2.3/fs/autofs4/inode.c Sat Jan 29 14:47:39 2000
+++ linux/fs/autofs4/inode.c Sun Jan 30 22:08:01 2000
@@ -140,7 +140,7 @@
         *gid = current->gid;
         *pgrp = current->pgrp;
 
- *minproto = *maxproto = AUTOFS_PROTO_VERSION;
+ *minproto = *maxproto = AUTOFS_MAX_PROTO_VERSION;
 
         *pipefd = -1;
 
@@ -278,15 +278,15 @@
 
         /* Couldn't this be tested earlier? */
         if (maxproto < AUTOFS_MIN_PROTO_VERSION ||
- minproto > AUTOFS_PROTO_VERSION) {
+ minproto > AUTOFS_MAX_PROTO_VERSION) {
                 printk("autofs: kernel does not match daemon version "
                        "daemon (%d, %d) kernel (%d, %d)\n",
                         minproto, maxproto,
- AUTOFS_MIN_PROTO_VERSION, AUTOFS_PROTO_VERSION);
+ AUTOFS_MIN_PROTO_VERSION, AUTOFS_MAX_PROTO_VERSION);
                 goto fail_dput;
         }
 
- sbi->version = maxproto > AUTOFS_PROTO_VERSION ? AUTOFS_PROTO_VERSION : maxpro
to;
+ sbi->version = maxproto > AUTOFS_MAX_PROTO_VERSION ? AUTOFS_MAX_PROTO_VERSION
: maxproto;
 
         DPRINTK(("autofs: pipe fd = %d, pgrp = %u\n", pipefd, sbi->oz_pgrp));
         pipe = fget(pipefd);

End of MIME message

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Jan 31 2000 - 21:00:27 EST