This should fix Nick's problem with relative link targets,
authorIon Badulescu <ib42@cs.columbia.edu>
Tue, 26 Aug 2003 14:17:26 +0000 (14:17 +0000)
committerIon Badulescu <ib42@cs.columbia.edu>
Tue, 26 Aug 2003 14:17:26 +0000 (14:17 +0000)
as well as a problem with nfsl that I discovered myself.

* NEWS: updated

* conf/autofs/autofs_linux.h (AUTOFS_LINK_FS_FLAGS): remove
FS_ON_AUTOFS
(AUTOFS_LINKX_FS_FLAGS): ditto

* conf/autofs/autofs_solaris_v1.h (AUTOFS_LINK_FS_FLAGS): remove
FS_ON_AUTOFS
(AUTOFS_LINKX_FS_FLAGS): ditto

* conf/autofs/autofs_solaris_v2_v3.h (AUTOFS_LINK_FS_FLAGS): remove
FS_ON_AUTOFS
(AUTOFS_LINKX_FS_FLAGS): ditto

* amd/amfs_generic.c (amfs_lookup_one_mntfs): don't modify the
original opt_fs, instead store the new mount point for autofs in a
temporary variable and pass it around. Fixes a problem with the
link side of nfsl.

ChangeLog
NEWS
amd/amfs_generic.c
conf/autofs/autofs_linux.h
conf/autofs/autofs_solaris_v1.h
conf/autofs/autofs_solaris_v2_v3.h

index 2f5b2bd1210ca71e11b7f3e4710ae151b9ed9cf1..cce765dc69c23b49353399255ccffc36e1932a67 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2003-08-26  Ion Badulescu  <ionut@buggy.badula.org>
+
+       * NEWS: updated
+
+       * conf/autofs/autofs_linux.h (AUTOFS_LINK_FS_FLAGS): remove
+       FS_ON_AUTOFS
+       (AUTOFS_LINKX_FS_FLAGS): ditto
+
+       * conf/autofs/autofs_solaris_v1.h (AUTOFS_LINK_FS_FLAGS): remove
+       FS_ON_AUTOFS
+       (AUTOFS_LINKX_FS_FLAGS): ditto
+
+       * conf/autofs/autofs_solaris_v2_v3.h (AUTOFS_LINK_FS_FLAGS): remove
+       FS_ON_AUTOFS
+       (AUTOFS_LINKX_FS_FLAGS): ditto
+
+       * amd/amfs_generic.c (amfs_lookup_one_mntfs): don't modify the
+       original opt_fs, instead store the new mount point for autofs in a
+       temporary variable and pass it around. Fixes a problem with the
+       link side of nfsl.
+
 2003-08-25  Ion Badulescu  <ionut@moisil.badula.org>
 
        * NEWS: updated
diff --git a/NEWS b/NEWS
index 8193a8c9cec5c4eff1eb8c90596bfdfeacb56399..fdee8e1580a009c671df124054bc90a9d6ff3c34 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,8 +4,10 @@
   proper waiting channels
 
 - bugs fixed:
+       * link mounts with relative targets weren't working on autofs
+       * the link side of the nfsl filesystem wasn't working on autofs
        * umount code was accidentally turning all symlinks into directories
-       during attempted umounts, causing stale filehandles
+         during attempted umounts, causing stale filehandles
        * various minor build fixes for "impossible" configurations
        * prevent ldap code from dereferencing a null pointer
 
index 321d8d4a9792791124b935ec26c56c8a89caab96..04e9efa9951171c014845172ffbb199f6c1d21a0 100644 (file)
@@ -37,7 +37,7 @@
  * SUCH DAMAGE.
  *
  *
- * $Id: amfs_generic.c,v 1.15 2003/08/25 23:49:47 ib42 Exp $
+ * $Id: amfs_generic.c,v 1.16 2003/08/26 14:17:27 ib42 Exp $
  *
  */
 
@@ -257,6 +257,7 @@ amfs_lookup_one_mntfs(am_node *new_mp, mntfs *mf, char *ivec,
   am_opts *fs_opts;
   mntfs *new_mf;
   char *link_dir;
+  char *mp_dir = 0;
 #ifdef HAVE_FS_AUTOFS
   int on_autofs = 1;
 #endif /* HAVE_FS_AUTOFS */
@@ -272,34 +273,33 @@ amfs_lookup_one_mntfs(am_node *new_mp, mntfs *mf, char *ivec,
     if (fs_opts->opt_sublink) {
       on_autofs = 0;
       if (fs_opts->opt_sublink[0] == '/') {
-       XFREE(fs_opts->opt_fs);
-       fs_opts->opt_fs = strdup(new_mp->am_path);
+       mp_dir = new_mp->am_path;
       } else {
        /*
         * For a relative sublink we need to use a hack with autofs:
         * mount the filesystem on the original opt_fs (which is NOT an
         * autofs mountpoint) and symlink (or lofs-mount) to it from
-        * the autofs dir.
-        *
-        * In other words, we make no changes here.
+        * the autofs mountpoint.
         */
+       mp_dir = fs_opts->opt_fs;
       }
     } else {
       if (p->autofs_fs_flags & FS_ON_AUTOFS) {
-       XFREE(fs_opts->opt_fs);
-       fs_opts->opt_fs = strdup(new_mp->am_path);
+       mp_dir = new_mp->am_path;
       } else {
+       mp_dir = fs_opts->opt_fs;
        on_autofs = 0;
       }
     }
-  }
+  } else
 #endif /* HAVE_FS_AUTOFS */
+    mp_dir = fs_opts->opt_fs;
 
   /*
    * Find or allocate a filesystem for this node.
    */
   new_mf = find_mntfs(p, fs_opts,
-                     fs_opts->opt_fs,
+                     mp_dir,
                      fs_opts->fs_mtab,
                      def_opts,
                      fs_opts->opt_opts,
@@ -330,8 +330,7 @@ amfs_lookup_one_mntfs(am_node *new_mp, mntfs *mf, char *ivec,
 
   link_dir = new_mf->mf_fo->opt_sublink;
   if (link_dir && link_dir[0] && link_dir[0] != '/') {
-    link_dir = str3cat((char *) 0,
-                      new_mf->mf_fo->opt_fs, "/", link_dir);
+    link_dir = str3cat((char *) 0, mp_dir, "/", link_dir);
     normalize_slash(link_dir);
     XFREE(new_mf->mf_fo->opt_sublink);
     new_mf->mf_fo->opt_sublink = link_dir;
@@ -699,7 +698,7 @@ amfs_bgmount(struct continuation *cp)
 
     if (mf->mf_fo->fs_mtab) {
       plog(XLOG_MAP, "Trying mount of %s on %s fstype %s mount_type %s",
-          mf->mf_fo->fs_mtab, mf->mf_fo->opt_fs, p->fs_type,
+          mf->mf_fo->fs_mtab, mf->mf_mount, p->fs_type,
           mp->am_flags & AMF_AUTOFS ? "autofs" : "non-autofs");
     }
 
index c05e82dfd92558ecaa6426231acded1b45635ea3..75bd0416923606a9429897a9e89c1cf24f40ab01 100644 (file)
@@ -40,8 +40,8 @@ union autofs_packet_union {
 #define AUTOFS_ERROR_FS_FLAGS  (FS_DISCARD)
 #define AUTOFS_HOST_FS_FLAGS   (FS_MKMNT | FS_BACKGROUND | FS_AMQINFO)
 #define AUTOFS_INHERIT_FS_FLAGS        (FS_DISCARD)
-#define AUTOFS_LINK_FS_FLAGS   (FS_MBACKGROUND | FS_ON_AUTOFS)
-#define AUTOFS_LINKX_FS_FLAGS  (FS_MBACKGROUND | FS_ON_AUTOFS)
+#define AUTOFS_LINK_FS_FLAGS   (FS_MBACKGROUND)
+#define AUTOFS_LINKX_FS_FLAGS  (FS_MBACKGROUND)
 #define AUTOFS_NFSL_FS_FLAGS   (FS_BACKGROUND | FS_AMQINFO | FS_ON_AUTOFS)
 #define AUTOFS_NFSX_FS_FLAGS   (/* FS_UBACKGROUND| */ FS_AMQINFO | FS_ON_AUTOFS)
 #define AUTOFS_PROGRAM_FS_FLAGS        (FS_BACKGROUND | FS_AMQINFO)
index 7d1f626a570e9b83042a676597354370821704a5..1a534ca9bbad0384488c8e2555e9022e6d1542b3 100644 (file)
@@ -28,8 +28,8 @@ static inline char *autofs_strdup_space_hack(char *s)
 #define AUTOFS_ERROR_FS_FLAGS  (FS_DISCARD)
 #define AUTOFS_HOST_FS_FLAGS   (FS_MKMNT | FS_BACKGROUND | FS_AMQINFO)
 #define AUTOFS_INHERIT_FS_FLAGS        (FS_DISCARD)
-#define AUTOFS_LINK_FS_FLAGS   (FS_MBACKGROUND | FS_ON_AUTOFS)
-#define AUTOFS_LINKX_FS_FLAGS  (FS_MBACKGROUND | FS_ON_AUTOFS)
+#define AUTOFS_LINK_FS_FLAGS   (FS_MBACKGROUND)
+#define AUTOFS_LINKX_FS_FLAGS  (FS_MBACKGROUND)
 #define AUTOFS_NFSL_FS_FLAGS   (FS_BACKGROUND | FS_AMQINFO | FS_ON_AUTOFS)
 #define AUTOFS_NFSX_FS_FLAGS   (/* FS_UBACKGROUND| */ FS_AMQINFO | FS_ON_AUTOFS)
 #define AUTOFS_PROGRAM_FS_FLAGS        (FS_MKMNT | FS_BACKGROUND | FS_AMQINFO)
index 6c709a1413eccc3e7abc291de9864139c5312100..8cbb20fe1f40d6929e5acf388a84f13210b7cc7a 100644 (file)
@@ -6,8 +6,8 @@ typedef struct autofs_args autofs_fh_t;
 #define AUTOFS_ERROR_FS_FLAGS  (FS_DISCARD)
 #define AUTOFS_HOST_FS_FLAGS   (FS_MKMNT | FS_BACKGROUND | FS_AMQINFO)
 #define AUTOFS_INHERIT_FS_FLAGS        (FS_DISCARD)
-#define AUTOFS_LINK_FS_FLAGS   (FS_MBACKGROUND | FS_ON_AUTOFS)
-#define AUTOFS_LINKX_FS_FLAGS  (FS_MBACKGROUND | FS_ON_AUTOFS)
+#define AUTOFS_LINK_FS_FLAGS   (FS_MBACKGROUND)
+#define AUTOFS_LINKX_FS_FLAGS  (FS_MBACKGROUND)
 #define AUTOFS_NFSL_FS_FLAGS   (FS_BACKGROUND | FS_AMQINFO | FS_ON_AUTOFS)
 #define AUTOFS_NFSX_FS_FLAGS   (/* FS_UBACKGROUND| */ FS_AMQINFO | FS_ON_AUTOFS)
 #define AUTOFS_PROGRAM_FS_FLAGS        (FS_BACKGROUND | FS_AMQINFO)