- remove now unused patch files (bz1020242).

This commit is contained in:
Ian Kent 2013-10-21 12:42:47 +08:00
parent b5e106a9d4
commit 476673d828
158 changed files with 4 additions and 17217 deletions

View File

@ -1,393 +0,0 @@
autofs-5.0.5 - dir map-type patch v2
From: Masatake YAMATO <yamato@redhat.com>
This is the second post of "dir map-type" patch.
Changes since last post:
- Don't use auto. as prefix for included map.
Use .autofs suffix instead. Suggested by Steve Linn.
- Use scandir instead of using opendir/readdir/closedir.
What is dir map-type?
`dir' map-type is for including files under a directory into master
map.
`file' map-type can be used for including a file with + notation like:
+/etc/auto.mine
in auto.master. However, for specifying a new file to be included you
have to edit auto.master file. Editing is also needed when you want to
remove the included file. When you have to do this with your shell
script you may have to use sed or awk.
`dir' map-type permits you adding new master map entries with cp
command and removing the entries with rm command. `dir' map-type is
inspired from /etc/httpd/conf.d and /etc/modprobe.d.
`dir' map-type can be used for included files under a directory
(e.g. /etc/auto.master.d) with + notation like:
+dir:/etc/auto.master.d
in auto.master. With this notation /etc/auto.master.d/*.autofs files
are included except a file which name is started with ".". With the
name of the file you can control whether a file under the directory is
included or not: the file which name ends with ".autofs" is included.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
---
CHANGELOG | 1
autofs.spec | 2
daemon/lookup.c | 3 -
man/auto.master.5.in | 10 ++
modules/Makefile | 6 +
modules/lookup_dir.c | 219 ++++++++++++++++++++++++++++++++++++++++++++++++++
samples/auto.master | 4 +
7 files changed, 240 insertions(+), 5 deletions(-)
create mode 100644 modules/lookup_dir.c
diff --git a/CHANGELOG b/CHANGELOG
index 7e86c84..5b988d4 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -8,6 +8,7 @@
- fix LDAP result leaks on error paths.
- code analysis fixes part 1.
- fix not bind mounting local filesystem.
+- add "dir" map-type.
28/06/2011 autofs-5.0.6
-----------------------
diff --git a/autofs.spec b/autofs.spec
index 91d4f8b..82edd1e 100644
--- a/autofs.spec
+++ b/autofs.spec
@@ -67,6 +67,7 @@ mkdir -p -m755 $RPM_BUILD_ROOT%{_sbindir}
mkdir -p -m755 $RPM_BUILD_ROOT%{_libdir}/autofs
mkdir -p -m755 $RPM_BUILD_ROOT%{_mandir}/{man5,man8}
mkdir -p -m755 $RPM_BUILD_ROOT/etc/sysconfig
+mkdir -p -m755 $RPM_BUILD_ROOT/etc/auto.master.d
make install mandir=%{_mandir} initdir=/etc/rc.d/init.d INSTALLROOT=$RPM_BUILD_ROOT
make -C redhat
@@ -104,6 +105,7 @@ fi
%dir %{_libdir}/autofs
%{_libdir}/autofs/*
%{_mandir}/*/*
+%dir /etc/auto.master.d
%changelog
* Tue Jun 3 2011 Ian Kent <raven@themaw.net>
diff --git a/daemon/lookup.c b/daemon/lookup.c
index 958d8cc..098588c 100644
--- a/daemon/lookup.c
+++ b/daemon/lookup.c
@@ -176,7 +176,8 @@ int lookup_nss_read_master(struct master *master, time_t age)
!strncmp(name, "nis:", 4) ||
!strncmp(name, "nisplus:", 8) ||
!strncmp(name, "ldap:", 5) ||
- !strncmp(name, "ldaps:", 6)) {
+ !strncmp(name, "ldaps:", 6) ||
+ !strncmp(name, "dir:", 4)) {
strncpy(source, name, tmp - name);
/*
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
index de692d2..fff9943 100644
--- a/man/auto.master.5.in
+++ b/man/auto.master.5.in
@@ -107,6 +107,14 @@ appropriate certificate must be configured in the LDAP client.
.B multi
This map type allows the specification of multiple maps separated
by "--". These maps are searched in order to resolve key lookups.
+.TP
+.B dir
+This map type can be used at
+.BR +
+master map including notation. The contents of files under given directory are included
+to the master map. The name of file to be included must be ended with ".autofs". A file
+will be ignored if its name is not ended with the suffix. In addition a dot file, a file
+which name is started with "." is also ignored.
.RE
.TP
\fBformat\fP
@@ -118,7 +126,7 @@ left unspecified, it defaults to \fBsun\fP for all map types except
.TP
\fBmap\fP
Name of the map to use. This is an absolute UNIX pathname
-for maps of types \fBfile\fP or \fBprogram\fP, and the name of a database
+for maps of types \fBfile\fP, \fBdir\fP, or \fBprogram\fP, and the name of a database
in the case for maps of type \fByp\fP, \fBnisplus\fP, or \fBhesiod\fP or
the \fBdn\fP of an LDAP entry for maps of type \fBldap\fP.
.TP
diff --git a/modules/Makefile b/modules/Makefile
index a35c0a5..6090127 100644
--- a/modules/Makefile
+++ b/modules/Makefile
@@ -5,14 +5,14 @@
-include ../Makefile.conf
include ../Makefile.rules
-SRCS := lookup_yp.c lookup_file.c lookup_program.c lookup_userhome.c \
- lookup_multi.c lookup_hosts.c \
+SRCS := lookup_yp.c lookup_file.c lookup_program.c lookup_userhome.c \
+ lookup_multi.c lookup_hosts.c lookup_dir.c \
parse_sun.c \
mount_generic.c mount_nfs.c mount_afs.c mount_autofs.c \
mount_changer.c mount_bind.c
MODS := lookup_yp.so lookup_file.so lookup_program.so lookup_userhome.so \
- lookup_multi.so lookup_hosts.so \
+ lookup_multi.so lookup_hosts.so lookup_dir.so \
parse_sun.so \
mount_generic.so mount_nfs.so mount_afs.so mount_autofs.so \
mount_changer.so mount_bind.so
diff --git a/modules/lookup_dir.c b/modules/lookup_dir.c
new file mode 100644
index 0000000..658cc29
--- /dev/null
+++ b/modules/lookup_dir.c
@@ -0,0 +1,219 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * lookup_dir.c - module for including master files in a directory.
+ *
+ * Copyright 2011 Red Hat, Inc. All rights reserved.
+ * Copyright 2011 Masatake YAMATO <yamato@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge MA 02139,
+ * USA; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * ----------------------------------------------------------------------- */
+
+#include <stdio.h>
+#include <malloc.h>
+#include <pwd.h>
+#include <string.h>
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+
+
+#define MODULE_LOOKUP
+#include "automount.h"
+#include "nsswitch.h"
+
+#define MODPREFIX "lookup(dir): "
+
+#define MAX_INCLUDE_DEPTH 16
+
+#define AUTOFS_DIR_EXT ".autofs"
+#define AUTOFS_DIR_EXTSIZ (sizeof(AUTOFS_DIR_EXT) - 1)
+
+struct lookup_context {
+ const char *mapname;
+};
+
+int lookup_version = AUTOFS_LOOKUP_VERSION; /* Required by protocol */
+
+
+int lookup_init(const char *mapfmt, int argc, const char *const *argv, void **context)
+{
+ struct lookup_context *ctxt;
+ char buf[MAX_ERR_BUF];
+ struct stat st;
+
+ *context = NULL;
+ ctxt = malloc(sizeof(struct lookup_context));
+ if (!ctxt) {
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
+ logerr(MODPREFIX "malloc: %s", estr);
+ return 1;
+ }
+
+ if (argc < 1) {
+ free(ctxt);
+ logerr(MODPREFIX "No map name");
+ return 1;
+ }
+
+ ctxt->mapname = argv[0];
+
+ if (ctxt->mapname[0] != '/') {
+ free(ctxt);
+ logmsg(MODPREFIX
+ "dir map %s is not an absolute pathname", argv[0]);
+ return 1;
+ }
+
+ if (access(ctxt->mapname, R_OK)) {
+ free(ctxt);
+ warn(LOGOPT_NONE, MODPREFIX
+ "dir map %s missing or not readable", argv[0]);
+ return 1;
+ }
+
+ if (stat(ctxt->mapname, &st)) {
+ free(ctxt);
+ warn(LOGOPT_NONE, MODPREFIX
+ "dir map %s, could not stat", argv[0]);
+ return 1;
+ }
+
+ if ( (!S_ISDIR(st.st_mode)) && (!S_ISLNK(st.st_mode)) ) {
+ free(ctxt);
+ warn(LOGOPT_NONE, MODPREFIX
+ "dir map %s, is not a directory", argv[0]);
+ }
+
+ *context = ctxt;
+ return 0;
+}
+
+static int acceptable_dirent_p(const struct dirent *e)
+{
+ size_t namesz;
+
+
+ if (!(e->d_type == DT_REG || e->d_type == DT_LNK))
+ return 0;
+
+ namesz = strlen(e->d_name);
+ if (!namesz)
+ return 0;
+
+ if (e->d_name[0] == '.')
+ return 0;
+
+ if (namesz < AUTOFS_DIR_EXTSIZ + 1 ||
+ strcmp(e->d_name + (namesz - AUTOFS_DIR_EXTSIZ),
+ AUTOFS_DIR_EXT))
+ return 0;
+
+ return 1;
+}
+
+
+static int include_file(struct master *master, time_t age, struct lookup_context* ctxt, struct dirent *e)
+{
+ unsigned int logopt = master->logopt;
+ char included_path[PATH_MAX + 1];
+ int included_path_len;
+ char *save_name;
+ int status;
+
+ included_path_len = snprintf(included_path,
+ PATH_MAX + 1,
+ "%s/%s",
+ ctxt->mapname,
+ e->d_name);
+ if (included_path_len > PATH_MAX)
+ return NSS_STATUS_NOTFOUND;
+
+ save_name = master->name;
+ master->name = included_path;
+
+ master->depth++;
+ debug(logopt, MODPREFIX "include: %s", master->name);
+ status = lookup_nss_read_master(master, age);
+ if (!status) {
+ warn(logopt,
+ MODPREFIX
+ "failed to read included master map %s",
+ master->name);
+ }
+ master->depth--;
+
+ master->name = save_name;
+ return NSS_STATUS_SUCCESS;
+}
+
+
+int lookup_read_master(struct master *master, time_t age, void *context)
+{
+ int n, i;
+ struct dirent **namelist = NULL;
+ struct lookup_context *ctxt = (struct lookup_context *) context;
+ unsigned int logopt = master->logopt;
+ char buf[MAX_ERR_BUF];
+
+
+ if (master->depth > MAX_INCLUDE_DEPTH) {
+ error(logopt, MODPREFIX
+ "maximum include depth exceeded %s", master->name);
+ return NSS_STATUS_UNAVAIL;
+ }
+
+ debug(logopt, MODPREFIX "scandir: %s", ctxt->mapname);
+ n = scandir(ctxt->mapname, &namelist, acceptable_dirent_p, versionsort);
+ if (n < 0) {
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
+
+ error(logopt,
+ MODPREFIX "could not scan master map dir %s: %s",
+ ctxt->mapname,
+ estr);
+ return NSS_STATUS_UNAVAIL;
+ }
+
+ for (i = 0; i < n; i++) {
+ struct dirent *e = namelist[i];
+
+ include_file(master, age, ctxt, e);
+ free(e);
+ }
+ free(namelist);
+
+ return NSS_STATUS_SUCCESS;
+}
+
+int lookup_read_map(struct autofs_point *ap, time_t age, void *context)
+{
+ ap->entry->current = NULL;
+ master_source_current_signal(ap->entry);
+ return NSS_STATUS_UNKNOWN;
+}
+
+int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *context)
+{
+ ap->entry->current = NULL;
+ master_source_current_signal(ap->entry);
+ return NSS_STATUS_UNKNOWN;
+}
+
+int lookup_done(void *context)
+{
+ struct lookup_context *ctxt = (struct lookup_context *) context;
+
+ free(ctxt);
+ return 0;
+}
diff --git a/samples/auto.master b/samples/auto.master
index 9fe5609..72f086c 100644
--- a/samples/auto.master
+++ b/samples/auto.master
@@ -12,6 +12,10 @@
#
/net -hosts
#
+# Include /etc/auto.master.d/*.autofs
+#
++dir:/etc/auto.master.d
+#
# Include central master map if it can be found using
# nsswitch sources.
#

View File

@ -1,334 +0,0 @@
autofs-5.0.6 - add disable move mount configure option
From: Ian Kent <ikent@redhat.com>
With the introduction of systemd the root filesystem is now usually
marked as shared instead of private as part of the systemd sandbox
functionality. As a consequence moving a mount from one mount point
to another is not allowed.
To resolve this a configure option (--disable-move-mount) to disable
autofs preparing mount tree and then moving it into place has been
added. The move mount use in autofs was needed for a small set of
automount types with older kernels (prior to 2.6.39). So to disable
the use of move mount it's necessary to use a recent kernel.
---
CHANGELOG | 1 +
autofs.spec | 2 +-
configure | 18 ++++++++++++++++++
configure.in | 10 ++++++++++
daemon/automount.c | 11 +++++++++++
include/config.h.in | 3 +++
modules/mount_nfs.c | 5 -----
modules/parse_sun.c | 40 +++++++++++++++++++++++++++++++++++-----
8 files changed, 79 insertions(+), 11 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 304b6a2..c682f94 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -12,6 +12,7 @@
- fix wait for master source mutex.
- fix submount shutdown race.
- fix fix map source check in file lookup.
+- add disable move mount configure option.
28/06/2011 autofs-5.0.6
-----------------------
diff --git a/autofs.spec b/autofs.spec
index 82edd1e..510ef76 100644
--- a/autofs.spec
+++ b/autofs.spec
@@ -57,7 +57,7 @@ inkludera n
echo %{version}-%{release} > .version
%build
-CFLAGS="$RPM_OPT_FLAGS -Wall" ./configure --libdir=%{_libdir} --disable-mount-locking --enable-ignore-busy --with-libtirpc
+CFLAGS="$RPM_OPT_FLAGS -Wall" ./configure --libdir=%{_libdir} --disable-mount-locking --enable-ignore-busy --with-libtirpc --disable-mount-move
CFLAGS="$RPM_OPT_FLAGS -Wall" make initdir=/etc/rc.d/init.d DONTSTRIP=1
%install
diff --git a/configure b/configure
index b5a3608..76b6d86 100755
--- a/configure
+++ b/configure
@@ -704,6 +704,7 @@ with_openldap
with_sasl
enable_ext_env
enable_mount_locking
+enable_mount_move
enable_forced_shutdown
enable_ignore_busy
'
@@ -1326,6 +1327,7 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-ext-env disable search in environment for substitution variable
--disable-mount-locking disable use of locking when spawning mount command
+ --disable-mount-move disable use of mount move when when preparing tree of mounts
--enable-force-shutdown enable USR1 signal to force unlink umount of any
busy mounts during shutdown
--enable-ignore-busy enable exit without umounting busy mounts during
@@ -5349,6 +5351,22 @@ $as_echo "#define ENABLE_MOUNT_LOCKING 1" >>confdefs.h
fi
#
+# Disable use of mount move
+#
+# Check whether --enable-mount-move was given.
+if test "${enable_mount_move+set}" = set; then :
+ enableval=$enable_mount_move;
+else
+ enableval=yes
+fi
+
+if test x$enable_mount_move = xyes -o x$enableval = xyes; then
+
+$as_echo "#define ENABLE_MOUNT_MOVE 1" >>confdefs.h
+
+fi
+
+#
# Enable forced shutdown on USR1 signal (unlink umounts all mounts).
#
# Check whether --enable-forced-shutdown was given.
diff --git a/configure.in b/configure.in
index 46de65a..d3e4e54 100644
--- a/configure.in
+++ b/configure.in
@@ -324,6 +324,16 @@ if test x$enable_mount_locking = xyes -o x$enableval = xyes; then
fi
#
+# Disable use of mount move
+#
+AC_ARG_ENABLE(mount-move,
+[ --disable-mount-move disable use of mount move when when preparing tree of mounts],,
+ enableval=yes)
+if test x$enable_mount_move = xyes -o x$enableval = xyes; then
+ AC_DEFINE(ENABLE_MOUNT_MOVE, 1, [Disable use of mount move when preparing tree of mounts])
+fi
+
+#
# Enable forced shutdown on USR1 signal (unlink umounts all mounts).
#
AC_ARG_ENABLE(forced-shutdown,
diff --git a/daemon/automount.c b/daemon/automount.c
index 4f3151f..6bb5aa8 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -1743,9 +1743,20 @@ static void show_build_info(void)
count = 22;
#endif
+#ifndef ENABLE_MOUNT_MOVE
+ printf("DISABLE_MOUNT_MOVE ");
+ count = count + 19;
+#endif
+
#ifdef ENABLE_FORCED_SHUTDOWN
printf("ENABLE_FORCED_SHUTDOWN ");
count = count + 23;
+
+ if (count > 60) {
+ printf("\n ");
+ count = 0;
+ }
+
#endif
#ifdef ENABLE_IGNORE_BUSY_MOUNTS
diff --git a/include/config.h.in b/include/config.h.in
index 4a3a990..97a8d2d 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -12,6 +12,9 @@
/* Disable use of locking when spawning mount command */
#undef ENABLE_MOUNT_LOCKING
+/* Disable use of mount move when preparing tree of mounts */
+#undef ENABLE_MOUNT_MOVE
+
/* define if you have E2FSCK */
#undef HAVE_E2FSCK
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
index 8b567d2..7eab728 100644
--- a/modules/mount_nfs.c
+++ b/modules/mount_nfs.c
@@ -163,11 +163,6 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
if (root[len - 1] == '/') {
len = snprintf(fullpath, len, "%s", root);
} else if (*name == '/') {
- /*
- * Direct or offset mount, name is absolute path so
- * don't use root (but with move mount changes root
- * is now the same as name).
- */
len = sprintf(fullpath, "%s", root);
} else {
len = sprintf(fullpath, "%s/%s", root, name);
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
index 021850d..13b8af8 100644
--- a/modules/parse_sun.c
+++ b/modules/parse_sun.c
@@ -1028,6 +1028,7 @@ static int parse_mapent(const char *ent, char *g_options, char **options, char *
return (p - ent);
}
+#ifdef ENABLE_MOUNT_MOVE
static int move_mount(struct autofs_point *ap,
const char *mm_tmp_root, const char *mm_root,
unsigned int move)
@@ -1063,6 +1064,7 @@ static int move_mount(struct autofs_point *ap,
return 1;
}
+#endif
static void cleanup_multi_root(struct autofs_point *ap, const char *root,
const char *path, unsigned int move)
@@ -1145,6 +1147,7 @@ static void cleanup_multi_triggers(struct autofs_point *ap,
return;
}
+#ifdef ENABLE_MOUNT_MOVE
static int check_fstype_autofs_option(const char *options)
{
char *tok, *tokbuf;
@@ -1171,24 +1174,27 @@ static int check_fstype_autofs_option(const char *options)
return found;
}
+#endif
static int mount_subtree(struct autofs_point *ap, struct mapent *me,
const char *name, char *loc, char *options, void *ctxt)
{
struct mapent *mm;
struct mapent *ro;
- char t_dir[] = "/tmp/autoXXXXXX";
- char *mnt_tmp_root, *mm_root, *mm_base, *mm_key;
+ char *mm_root, *mm_base, *mm_key;
const char *mnt_root, *target;
unsigned int mm_root_len, mnt_root_len;
int start, ret = 0, rv;
- unsigned int move;
+ unsigned int move = MOUNT_MOVE_NONE;
+#ifdef ENABLE_MOUNT_MOVE
+ char t_dir[] = "/tmp/autoXXXXXX";
+ char *mnt_tmp_root = NULL;
+#endif
rv = 0;
mm = me->multi;
mm_key = mm->key;
- move = MOUNT_MOVE_NONE;
if (*mm_key == '/') {
mm_root = mm_key;
@@ -1202,7 +1208,10 @@ static int mount_subtree(struct autofs_point *ap, struct mapent *me,
}
mm_root_len = strlen(mm_root);
- mnt_tmp_root = NULL;
+#ifndef ENABLE_MOUNT_MOVE
+ mnt_root = mm_root;
+ mnt_root_len = mm_root_len;
+#else
if (ap->flags & MOUNT_FLAG_REMOUNT) {
mnt_root = mm_root;
mnt_root_len = mm_root_len;
@@ -1213,6 +1222,7 @@ static int mount_subtree(struct autofs_point *ap, struct mapent *me,
mnt_root_len = strlen(mnt_root);
mnt_tmp_root = (char *) mnt_root;
}
+#endif
if (me == me->multi) {
/* name = NULL */
@@ -1238,11 +1248,13 @@ static int mount_subtree(struct autofs_point *ap, struct mapent *me,
}
ro_len = strlen(ro_loc);
+#ifdef ENABLE_MOUNT_MOVE
if (!(ap->flags & MOUNT_FLAG_REMOUNT)) {
move = MOUNT_MOVE_OTHER;
if (check_fstype_autofs_option(myoptions))
move = MOUNT_MOVE_AUTOFS;
}
+#endif
tmp = alloca(mnt_root_len + 1);
strcpy(tmp, mnt_root);
@@ -1266,7 +1278,9 @@ static int mount_subtree(struct autofs_point *ap, struct mapent *me,
goto error_out;
}
} else if (rv <= 0) {
+#ifdef ENABLE_MOUNT_MOVE
move = MOUNT_MOVE_NONE;
+#endif
ret = mount_multi_triggers(ap, me, mm_root, start, mm_base);
if (ret == -1) {
error(ap->logopt, MODPREFIX
@@ -1279,11 +1293,21 @@ static int mount_subtree(struct autofs_point *ap, struct mapent *me,
int loclen = strlen(loc);
int namelen = strlen(name);
+#ifndef ENABLE_MOUNT_MOVE
+ /*
+ * When using move mount to mount offsets or direct mounts
+ * the base of the tree can be the base of the temporary
+ * mount point it needs to be the full path when not moving
+ * the mount after construction.
+ */
+ mnt_root = name;
+#else
if (!(ap->flags & MOUNT_FLAG_REMOUNT)) {
move = MOUNT_MOVE_OTHER;
if (check_fstype_autofs_option(options))
move = MOUNT_MOVE_AUTOFS;
}
+#endif
/* name = mm_root + mm_base */
/* destination = mm_root + mm_base = name */
@@ -1303,7 +1327,9 @@ static int mount_subtree(struct autofs_point *ap, struct mapent *me,
} else if (rv < 0) {
char *mm_root_base = alloca(strlen(mm_root) + strlen(mm_base) + 1);
+#ifdef ENABLE_MOUNT_MOVE
move = MOUNT_MOVE_NONE;
+#endif
strcpy(mm_root_base, mm_root);
strcat(mm_root_base, mm_base);
@@ -1318,6 +1344,7 @@ static int mount_subtree(struct autofs_point *ap, struct mapent *me,
}
}
+#ifdef ENABLE_MOUNT_MOVE
if (!move_mount(ap, mnt_root, target, move)) {
cleanup_multi_triggers(ap, me, mnt_root, start, mm_base);
cleanup_multi_root(ap, mnt_root, mm_root, move);
@@ -1326,6 +1353,7 @@ static int mount_subtree(struct autofs_point *ap, struct mapent *me,
if (mnt_tmp_root)
rmdir(mnt_tmp_root);
+#endif
/* Mount for base of tree failed */
if (rv > 0)
@@ -1341,8 +1369,10 @@ static int mount_subtree(struct autofs_point *ap, struct mapent *me,
return rv;
error_out:
+#ifdef ENABLE_MOUNT_MOVE
if (mnt_tmp_root)
rmdir(mnt_tmp_root);
+#endif
return 1;
}

View File

@ -1,323 +0,0 @@
autofs-5.0.6 - add function to check mount.nfs version
From: Ian Kent <ikent@redhat.com>
Add a function to check if the mount.nfs version is greater than or
equal to a given version.
---
CHANGELOG | 1
configure | 62 +++++++++++++++++++++
configure.in | 1
include/config.h.in | 6 ++
include/mounts.h | 7 ++
lib/mounts.c | 147 ++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 224 insertions(+)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -25,6 +25,7 @@
- teach automount about sss source.
- ignore duplicate exports in auto.net.
- add kernel verion check function.
+- add function to check mount.nfs version.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/configure
+++ autofs-5.0.6/configure
@@ -645,6 +645,8 @@ HAVE_E2FSCK
E2FSCK
HAVE_UMOUNT
UMOUNT
+HAVE_MOUNT_NFS
+MOUNT_NFS
HAVE_MOUNT
MOUNT
DMALLOCLIB
@@ -3248,6 +3250,66 @@ else
HAVE_MOUNT=0
fi
+for ac_prog in mount.nfs
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_MOUNT_NFS+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $MOUNT_NFS in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_MOUNT_NFS="$MOUNT_NFS" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $searchpath
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_MOUNT_NFS="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+MOUNT_NFS=$ac_cv_path_MOUNT_NFS
+if test -n "$MOUNT_NFS"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MOUNT_NFS" >&5
+$as_echo "$MOUNT_NFS" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$MOUNT_NFS" && break
+done
+test -n "$MOUNT_NFS" || MOUNT_NFS="/sbin/mount.nfs "
+
+if test -n "$MOUNT_NFS"; then
+
+$as_echo "#define HAVE_MOUNT_NFS 1" >>confdefs.h
+
+
+cat >>confdefs.h <<_ACEOF
+#define PATH_MOUNT_NFS "$MOUNT_NFS"
+_ACEOF
+
+ HAVE_MOUNT_NFS=1
+else
+ HAVE_MOUNT_NFS=0
+fi
+
for ac_prog in umount
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
--- autofs-5.0.6.orig/configure.in
+++ autofs-5.0.6/configure.in
@@ -137,6 +137,7 @@ AC_SUBST(DMALLOCLIB)
# Programs needed for various system functions or modules
#
AF_PATH_INCLUDE(MOUNT, mount, /bin/mount, $searchpath)
+AF_PATH_INCLUDE(MOUNT_NFS, mount.nfs, /sbin/mount.nfs , $searchpath)
AF_PATH_INCLUDE(UMOUNT, umount, /bin/umount, $searchpath)
AF_PATH_INCLUDE(E2FSCK, fsck.ext2 e2fsck, , $searchpath)
AF_PATH_INCLUDE(E3FSCK, fsck.ext3 e3fsck, , $searchpath)
--- autofs-5.0.6.orig/include/config.h.in
+++ autofs-5.0.6/include/config.h.in
@@ -45,6 +45,9 @@
/* define if you have MOUNT */
#undef HAVE_MOUNT
+/* define if you have MOUNT_NFS */
+#undef HAVE_MOUNT_NFS
+
/* define if the mount command supports the -s option */
#undef HAVE_SLOPPY_MOUNT
@@ -111,6 +114,9 @@
/* define if you have MOUNT */
#undef PATH_MOUNT
+/* define if you have MOUNT_NFS */
+#undef PATH_MOUNT_NFS
+
/* define if you have RANLIB */
#undef PATH_RANLIB
--- autofs-5.0.6.orig/include/mounts.h
+++ autofs-5.0.6/include/mounts.h
@@ -89,6 +89,13 @@ static inline unsigned int linux_version
return KERNEL_VERSION(p, q, r);
}
+struct nfs_mount_vers {
+ unsigned int major;
+ unsigned int minor;
+ unsigned int fix;
+};
+int check_nfs_mount_version(struct nfs_mount_vers *, struct nfs_mount_vers *);
+
unsigned int query_kproto_ver(void);
unsigned int get_kver_major(void);
unsigned int get_kver_minor(void);
--- autofs-5.0.6.orig/lib/mounts.c
+++ autofs-5.0.6/lib/mounts.c
@@ -19,6 +19,8 @@
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
+#include <sys/wait.h>
+#include <ctype.h>
#include <stdio.h>
#include <dirent.h>
#include <sys/vfs.h>
@@ -30,6 +32,8 @@
#define MAX_OPTIONS_LEN 80
#define MAX_MNT_NAME_LEN 30
+#define EBUFSIZ 1024
+
const unsigned int t_indirect = AUTOFS_TYPE_INDIRECT;
const unsigned int t_direct = AUTOFS_TYPE_DIRECT;
const unsigned int t_offset = AUTOFS_TYPE_OFFSET;
@@ -131,6 +135,149 @@ unsigned int get_kver_minor(void)
return kver.minor;
}
+#ifdef HAVE_MOUNT_NFS
+static int extract_version(char *start, struct nfs_mount_vers *vers)
+{
+ char *s_ver = strchr(start, ' ');
+ while (*s_ver && !isdigit(*s_ver)) {
+ s_ver++;
+ if (!*s_ver)
+ return 0;
+ break;
+ }
+ vers->major = atoi(strtok(s_ver, "."));
+ vers->minor = (unsigned int) atoi(strtok(NULL, "."));
+ vers->fix = (unsigned int) atoi(strtok(NULL, "."));
+ return 1;
+}
+
+int check_nfs_mount_version(struct nfs_mount_vers *vers,
+ struct nfs_mount_vers *check)
+{
+ pid_t f;
+ int ret, status, pipefd[2];
+ char errbuf[EBUFSIZ + 1], *p, *sp;
+ int errp, errn;
+ sigset_t allsigs, tmpsig, oldsig;
+ char *s_ver;
+ int cancel_state;
+
+ if (pipe(pipefd))
+ return -1;
+
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cancel_state);
+
+ sigfillset(&allsigs);
+ pthread_sigmask(SIG_BLOCK, &allsigs, &oldsig);
+
+ f = fork();
+ if (f == 0) {
+ reset_signals();
+ close(pipefd[0]);
+ dup2(pipefd[1], STDOUT_FILENO);
+ dup2(pipefd[1], STDERR_FILENO);
+ close(pipefd[1]);
+
+ execl(PATH_MOUNT_NFS, PATH_MOUNT_NFS, "-V", (char *) NULL);
+ _exit(255); /* execv() failed */
+ }
+
+ ret = 0;
+
+ tmpsig = oldsig;
+
+ sigaddset(&tmpsig, SIGCHLD);
+ pthread_sigmask(SIG_SETMASK, &tmpsig, NULL);
+
+ close(pipefd[1]);
+
+ if (f < 0) {
+ close(pipefd[0]);
+ pthread_sigmask(SIG_SETMASK, &oldsig, NULL);
+ pthread_setcancelstate(cancel_state, NULL);
+ return -1;
+ }
+
+ errp = 0;
+ do {
+ while (1) {
+ errn = read(pipefd[0], errbuf + errp, EBUFSIZ - errp);
+ if (errn == -1 && errno == EINTR)
+ continue;
+ break;
+ }
+
+ if (errn > 0) {
+ errp += errn;
+
+ sp = errbuf;
+ while (errp && (p = memchr(sp, '\n', errp))) {
+ *p++ = '\0';
+ errp -= (p - sp);
+ sp = p;
+ }
+
+ if (errp && sp != errbuf)
+ memmove(errbuf, sp, errp);
+
+ if (errp >= EBUFSIZ) {
+ /* Line too long, split */
+ errbuf[errp] = '\0';
+ if ((s_ver = strstr(errbuf, "nfs-utils"))) {
+ if (extract_version(s_ver, vers))
+ ret = 1;
+ }
+ errp = 0;
+ }
+
+ if ((s_ver = strstr(errbuf, "nfs-utils"))) {
+ if (extract_version(s_ver, vers))
+ ret = 1;
+ }
+ }
+ } while (errn > 0);
+
+ close(pipefd[0]);
+
+ if (errp > 0) {
+ /* End of file without \n */
+ errbuf[errp] = '\0';
+ if ((s_ver = strstr(errbuf, "nfs-utils"))) {
+ if (extract_version(s_ver, vers))
+ ret = 1;
+ }
+ }
+
+ if (ret) {
+ if (vers->major == check->major &&
+ vers->minor == check->minor &&
+ vers->fix == check->fix)
+ ;
+ else {
+ if (vers->major < check->major)
+ ret = 0;
+ else if (vers->minor < check->minor)
+ ret = 0;
+ else if (vers->fix < check->fix)
+ ret = 0;
+ }
+ }
+
+ if (waitpid(f, &status, 0) != f) ;
+
+ pthread_sigmask(SIG_SETMASK, &oldsig, NULL);
+ pthread_setcancelstate(cancel_state, NULL);
+
+ return ret;
+}
+#else
+int check_nfs_mount_version(struct nfs_mount_vers *vers,
+ struct nfs_mount_vers *check)
+{
+ return 0;
+}
+#endif
+
/*
* Make common autofs mount options string
*/

View File

@ -1,84 +0,0 @@
autofs-5.0.6 - add function to delete offset cache entry
From: Ian Kent <ikent@redhat.com>
Currently only the entire expanded list of offset cache entries may be
removed from the cache. In order to be able to update already expanded
multi map offset entries we need to be able to delete them.
---
include/automount.h | 1 +
lib/cache.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/include/automount.h b/include/automount.h
index e1246e3..40c1975 100644
--- a/include/automount.h
+++ b/include/automount.h
@@ -192,6 +192,7 @@ int cache_add_offset(struct mapent_cache *mc, const char *mkey, const char *key,
int cache_set_parents(struct mapent *mm);
int cache_update(struct mapent_cache *mc, struct map_source *ms, const char *key, const char *mapent, time_t age);
int cache_delete(struct mapent_cache *mc, const char *key);
+int cache_delete_offset(struct mapent_cache *mc, const char *key);
void cache_multi_readlock(struct mapent *me);
void cache_multi_writelock(struct mapent *me);
void cache_multi_unlock(struct mapent *me);
diff --git a/lib/cache.c b/lib/cache.c
index 3464e7d..1489273 100644
--- a/lib/cache.c
+++ b/lib/cache.c
@@ -771,6 +771,53 @@ int cache_update(struct mapent_cache *mc, struct map_source *ms, const char *key
return ret;
}
+/* cache_multi_lock of the multi mount owner must be held by caller */
+int cache_delete_offset(struct mapent_cache *mc, const char *key)
+{
+ u_int32_t hashval = hash(key, mc->size);
+ struct mapent *me = NULL, *pred;
+ int status;
+
+ me = mc->hash[hashval];
+ if (!me)
+ return CHE_FAIL;
+
+ if (strcmp(key, me->key) == 0) {
+ if (me->multi && me->multi == me)
+ return CHE_FAIL;
+ mc->hash[hashval] = me->next;
+ goto delete;
+ }
+
+ while (me->next != NULL) {
+ pred = me;
+ me = me->next;
+ if (strcmp(key, me->key) == 0) {
+ if (me->multi && me->multi == me)
+ return CHE_FAIL;
+ pred->next = me->next;
+ goto delete;
+ }
+ }
+
+ return CHE_FAIL;
+
+delete:
+ status = pthread_rwlock_destroy(&me->multi_rwlock);
+ if (status)
+ fatal(status);
+ list_del(&me->multi_list);
+ ino_index_lock(mc);
+ list_del(&me->ino_index);
+ ino_index_unlock(mc);
+ free(me->key);
+ if (me->mapent)
+ free(me->mapent);
+ free(me);
+
+ return CHE_OK;
+}
+
/* cache must be write locked by caller */
int cache_delete(struct mapent_cache *mc, const char *key)
{

View File

@ -1,498 +0,0 @@
autofs-5.0.6 - add hup signal handling to hosts map
From: Ian Kent <ikent@redhat.com>
Add HUP signal handling to the internal hosts lookup module.
---
CHANGELOG | 1
daemon/direct.c | 4 -
include/mounts.h | 1
lib/mounts.c | 162 ++++++++++++++++++++++++++++++++++++++++++++++++-
man/auto.master.5.in | 5 +
man/autofs.5 | 8 +-
modules/lookup_hosts.c | 97 ++++++++++++++++++++++++-----
modules/parse_sun.c | 9 ++
8 files changed, 262 insertions(+), 25 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -57,6 +57,7 @@
- fix offset mount point directory removal.
- fix remount of multi mount.
- fix devce ioctl alloc path check.
+- add hup signal handling to hosts map.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/daemon/direct.c
+++ autofs-5.0.6/daemon/direct.c
@@ -654,7 +654,9 @@ int mount_autofs_offset(struct autofs_po
ret = try_remount(ap, me, t_offset);
if (ret == 1)
return MOUNT_OFFSET_OK;
- return MOUNT_OFFSET_FAIL;
+ /* Offset mount not found, fall thru and try to mount it */
+ if (!(ret == -1 && errno == ENOENT))
+ return MOUNT_OFFSET_FAIL;
} else {
/*
if (is_mounted(_PROC_MOUNTS, me->key, MNTS_AUTOFS)) {
--- autofs-5.0.6.orig/include/mounts.h
+++ autofs-5.0.6/include/mounts.h
@@ -112,5 +112,6 @@ int try_remount(struct autofs_point *, s
int umount_ent(struct autofs_point *, const char *);
int mount_multi_triggers(struct autofs_point *, struct mapent *, const char *, unsigned int, const char *);
int umount_multi_triggers(struct autofs_point *, struct mapent *, char *, const char *);
+int clean_stale_multi_triggers(struct autofs_point *, struct mapent *, char *, const char *);
#endif
--- autofs-5.0.6.orig/lib/mounts.c
+++ autofs-5.0.6/lib/mounts.c
@@ -1436,6 +1436,7 @@ static int remount_active_mount(struct a
/* Re-reading the map, set timeout and return */
if (ap->state == ST_READMAP) {
+ debug(ap->logopt, "already mounted, update timeout");
ops->timeout(ap->logopt, fd, timeout);
ops->close(ap->logopt, fd);
return REMOUNT_READ_MAP;
@@ -1550,7 +1551,9 @@ int try_remount(struct autofs_point *ap,
* record that in the mount point struct. Otherwise we're
* re-reading the map.
*/
- if (ret == REMOUNT_SUCCESS || ret == REMOUNT_READ_MAP) {
+ if (ret == REMOUNT_READ_MAP)
+ return 1;
+ else if (ret == REMOUNT_SUCCESS) {
if (fd != -1) {
if (type == t_indirect)
ap->ioctlfd = fd;
@@ -1781,5 +1784,162 @@ int umount_multi_triggers(struct autofs_
}
return left;
+}
+
+int clean_stale_multi_triggers(struct autofs_point *ap,
+ struct mapent *me, char *top, const char *base)
+{
+ char *root;
+ char mm_top[PATH_MAX + 1];
+ char path[PATH_MAX + 1];
+ char buf[MAX_ERR_BUF];
+ char *offset;
+ struct mapent *oe;
+ struct list_head *mm_root, *pos;
+ const char o_root[] = "/";
+ const char *mm_base;
+ int left, start;
+ time_t age;
+
+ if (top)
+ root = top;
+ else {
+ if (!strchr(me->multi->key, '/'))
+ /* Indirect multi-mount root */
+ /* sprintf okay - if it's mounted, it's
+ * PATH_MAX or less bytes */
+ sprintf(mm_top, "%s/%s", ap->path, me->multi->key);
+ else
+ strcpy(mm_top, me->multi->key);
+ root = mm_top;
+ }
+
+ left = 0;
+ start = strlen(root);
+
+ mm_root = &me->multi->multi_list;
+
+ if (!base)
+ mm_base = o_root;
+ else
+ mm_base = base;
+
+ pos = NULL;
+ offset = path;
+ age = me->multi->age;
+
+ while ((offset = cache_get_offset(mm_base, offset, start, mm_root, &pos))) {
+ char *oe_base;
+ char *key;
+ int ret;
+
+ oe = cache_lookup_offset(mm_base, offset, start, &me->multi_list);
+ /* root offset is a special case */
+ if (!oe || !oe->mapent || (strlen(oe->key) - start) == 1)
+ continue;
+
+ /* Check for and umount stale subtree offsets */
+ oe_base = oe->key + strlen(root);
+ ret = clean_stale_multi_triggers(ap, oe, root, oe_base);
+ left =+ ret;
+ if (ret)
+ continue;
+
+ if (oe->age == age)
+ continue;
+
+ /*
+ * If an offset that has an active mount has been removed
+ * from the multi-mount we don't want to attempt to trigger
+ * mounts for it. Obviously this is because it has been
+ * removed, but less obvious is the potential strange
+ * behaviour that can result if we do try and mount it
+ * again after it's been expired. For example, if an NFS
+ * file system is no longer exported and is later umounted
+ * it can be mounted again without any error message but
+ * shows as an empty directory. That's going to confuse
+ * people for sure.
+ *
+ * If the mount cannot be umounted (the process is now
+ * using a stale mount) the offset needs to be invalidated
+ * so no further mounts will be attempted but the offset
+ * cache entry must remain so expires can continue to
+ * attempt to umount it. If the mount can be umounted and
+ * the offset is removed, at least for NFS we will get
+ * ESTALE errors when attempting list the directory.
+ */
+ if (oe->ioctlfd != -1 ||
+ is_mounted(_PROC_MOUNTS, oe->key, MNTS_REAL)) {
+ if (umount_ent(ap, oe->key)) {
+ debug(ap->logopt,
+ "offset %s has active mount, invalidate",
+ oe->key);
+ if (oe->mapent) {
+ free(oe->mapent);
+ oe->mapent = NULL;
+ }
+ left++;
+ continue;
+ }
+ }
+
+ key = strdup(oe->key);
+ if (!key) {
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
+ error(ap->logopt, "malloc: %s", estr);
+ left++;
+ continue;
+ }
+
+ debug(ap->logopt, "umount offset %s", oe->key);
+
+ if (umount_autofs_offset(ap, oe)) {
+ warn(ap->logopt, "failed to umount offset %s", key);
+ left++;
+ } else {
+ struct stat st;
+
+ /* Mount point not ours to delete ? */
+ if (!(oe->flags & MOUNT_FLAG_DIR_CREATED)) {
+ debug(ap->logopt, "delete offset key %s", key);
+ if (cache_delete_offset(oe->mc, key) == CHE_FAIL)
+ error(ap->logopt,
+ "failed to delete offset key %s", key);
+ free(key);
+ continue;
+ }
+
+ /*
+ * An error due to partial directory removal is
+ * ok so only try and remount the offset if the
+ * actual mount point still exists.
+ */
+ ret = rmdir_path(ap, oe->key, ap->dev);
+ if (ret == -1 && !stat(oe->key, &st)) {
+ ret = do_mount_autofs_offset(ap, oe, root, offset);
+ if (ret) {
+ left++;
+ free(key);
+ continue;
+ }
+ /*
+ * Fall through if the trigger can't be mounted
+ * again, since there is no offset there can't
+ * be any mount requests so remove the map
+ * entry from the cache. There's now a dead
+ * offset mount, but what else can we do ....
+ */
+ }
+
+ debug(ap->logopt, "delete offset key %s", key);
+
+ if (cache_delete_offset(oe->mc, key) == CHE_FAIL)
+ error(ap->logopt,
+ "failed to delete offset key %s", key);
+ }
+ free(key);
+ }
+
+ return left;
}
--- autofs-5.0.6.orig/man/auto.master.5.in
+++ autofs-5.0.6/man/auto.master.5.in
@@ -220,7 +220,10 @@ set default log level "none", "verbose"
.SH BUILTIN MAP -hosts
If "-hosts" is given as the map then accessing a key under the mount point
which corresponds to a hostname will allow access to the exports of that
-host.
+host. The hosts map cannot be dynamically updated and requires a HUP signal
+to be sent to the daemon for it to check hosts for an update. Due to possible
+hierarchic dependencies within a mount tree, it might not be completely
+updated during the HUP signal processing.
.P
For example, with an entry in the master map of
.nh
--- autofs-5.0.6.orig/man/autofs.5
+++ autofs-5.0.6/man/autofs.5
@@ -13,10 +13,10 @@ These maps describe how file systems bel
map format; if another map format is specified (e.g. \fBhesiod\fP),
this documentation does not apply.
-Indirect maps can be changed on the fly and the automouter will recognize
-those changes on the next operation it performs on that map. Direct maps
-require a HUP signal be sent to the daemon to refresh their contents as does
-the master map.
+Indirect maps, except for the internal hosts map, can be changed on the fly
+and the automouter will recognize those changes on the next operation it
+performs on that map. Direct maps require a HUP signal be sent to the
+daemon to refresh their contents as does the master map.
.SH "FORMAT"
This is a description of the text file format. Other methods of specifying
these files may exist. All empty lines or lines beginning with # are
--- autofs-5.0.6.orig/modules/lookup_hosts.c
+++ autofs-5.0.6/modules/lookup_hosts.c
@@ -80,10 +80,11 @@ int lookup_read_master(struct master *ma
static char *get_exports(struct autofs_point *ap, const char *host)
{
- char *mapent = NULL;
+ char buf[MAX_ERR_BUF];
+ char *mapent;
exports exp;
- debug(ap->logopt, MODPREFIX "fetchng export list for %s", name);
+ debug(ap->logopt, MODPREFIX "fetchng export list for %s", host);
exp = rpc_get_exports(host, 10, 0, RPC_CLOSE_NOLINGER);
@@ -92,20 +93,20 @@ static char *get_exports(struct autofs_p
if (mapent) {
int len = strlen(mapent) + 1;
- len += strlen(name) + 2*(strlen(exp->ex_dir) + 2) + 3;
+ len += strlen(host) + 2*(strlen(exp->ex_dir) + 2) + 3;
mapent = realloc(mapent, len);
if (!mapent) {
char *estr;
estr = strerror_r(errno, buf, MAX_ERR_BUF);
error(ap->logopt, MODPREFIX "malloc: %s", estr);
rpc_exports_free(exp);
- return NSS_STATUS_UNAVAIL;
+ return NULL;
}
strcat(mapent, " \"");
strcat(mapent, exp->ex_dir);
strcat(mapent, "\"");
} else {
- int len = 2*(strlen(exp->ex_dir) + 2) + strlen(name) + 3;
+ int len = 2*(strlen(exp->ex_dir) + 2) + strlen(host) + 3;
mapent = malloc(len);
if (!mapent) {
@@ -113,14 +114,14 @@ static char *get_exports(struct autofs_p
estr = strerror_r(errno, buf, MAX_ERR_BUF);
error(ap->logopt, MODPREFIX "malloc: %s", estr);
rpc_exports_free(exp);
- return NSS_STATUS_UNAVAIL;
+ return NULL;
}
strcpy(mapent, "\"");
strcat(mapent, exp->ex_dir);
strcat(mapent, "\"");
}
strcat(mapent, " \"");
- strcat(mapent, name);
+ strcat(mapent, host);
strcat(mapent, ":");
strcat(mapent, exp->ex_dir);
strcat(mapent, "\"");
@@ -130,14 +131,14 @@ static char *get_exports(struct autofs_p
rpc_exports_free(exp);
if (!mapent)
- error(ap->logopt, "exports lookup failed for %s", name);
+ error(ap->logopt, MODPREFIX "exports lookup failed for %s", host);
return mapent;
}
-static int do_parse_mount(struct autofs_point *ap,
+static int do_parse_mount(struct autofs_point *ap, struct map_source *source,
const char *name, int name_len, char *mapent,
- void *context)
+ struct lookup_context *ctxt)
{
int ret;
@@ -166,8 +167,68 @@ static int do_parse_mount(struct autofs_
return NSS_STATUS_SUCCESS;
}
+static int update_hosts_mounts(struct autofs_point *ap,
+ struct map_source *source, time_t age,
+ struct lookup_context *ctxt)
+{
+ struct mapent_cache *mc;
+ struct mapent *me;
+ char *mapent;
+ int ret;
+
+ mc = source->mc;
+
+ pthread_cleanup_push(cache_lock_cleanup, mc);
+ cache_writelock(mc);
+ me = cache_lookup_first(mc);
+ while (me) {
+ /* Hosts map entry not yet expanded or already expired */
+ if (!me->multi)
+ goto next;
+
+ debug(ap->logopt, MODPREFIX "get list of exports for %s", me->key);
+
+ mapent = get_exports(ap, me->key);
+ if (mapent) {
+ cache_update(mc, source, me->key, mapent, age);
+ free(mapent);
+ }
+next:
+ me = cache_lookup_next(mc, me);
+ }
+ pthread_cleanup_pop(1);
+
+ pthread_cleanup_push(cache_lock_cleanup, mc);
+ cache_readlock(mc);
+ me = cache_lookup_first(mc);
+ while (me) {
+ /*
+ * Hosts map entry not yet expanded, already expired
+ * or not the base of the tree
+ */
+ if (!me->multi || me->multi != me)
+ goto cont;
+
+ debug(ap->logopt, MODPREFIX
+ "attempt to update exports for exports for %s", me->key);
+
+ master_source_current_wait(ap->entry);
+ ap->entry->current = source;
+ ap->flags |= MOUNT_FLAG_REMOUNT;
+ ret = ctxt->parse->parse_mount(ap, me->key, strlen(me->key),
+ me->mapent, ctxt->parse->context);
+ ap->flags &= ~MOUNT_FLAG_REMOUNT;
+cont:
+ me = cache_lookup_next(mc, me);
+ }
+ pthread_cleanup_pop(1);
+
+ return NSS_STATUS_SUCCESS;
+}
+
int lookup_read_map(struct autofs_point *ap, time_t age, void *context)
{
+ struct lookup_context *ctxt = (struct lookup_context *) context;
struct map_source *source;
struct mapent_cache *mc;
struct hostent *host;
@@ -177,18 +238,23 @@ int lookup_read_map(struct autofs_point
ap->entry->current = NULL;
master_source_current_signal(ap->entry);
+ mc = source->mc;
+
+ debug(ap->logopt, MODPREFIX "read hosts map");
+
/*
* If we don't need to create directories then there's no use
* reading the map. We always need to read the whole map for
* direct mounts in order to mount the triggers.
*/
if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT) {
- debug(ap->logopt, "map read not needed, so not done");
+ debug(ap->logopt, MODPREFIX
+ "map not browsable, update existing host entries only");
+ update_hosts_mounts(ap, source, age, ctxt);
+ source->age = age;
return NSS_STATUS_SUCCESS;
}
- mc = source->mc;
-
status = pthread_mutex_lock(&hostent_mutex);
if (status) {
error(ap->logopt, MODPREFIX "failed to lock hostent mutex");
@@ -209,6 +275,7 @@ int lookup_read_map(struct autofs_point
if (status)
error(ap->logopt, MODPREFIX "failed to unlock hostent mutex");
+ update_hosts_mounts(ap, source, age, ctxt);
source->age = age;
return NSS_STATUS_SUCCESS;
@@ -220,11 +287,9 @@ int lookup_mount(struct autofs_point *ap
struct map_source *source;
struct mapent_cache *mc;
struct mapent *me;
- char buf[MAX_ERR_BUF];
char *mapent = NULL;
int mapent_len;
time_t now = time(NULL);
- exports exp;
int ret;
source = ap->entry->current;
@@ -320,7 +385,7 @@ done:
cache_unlock(mc);
}
- ret = do_parse_mount(ap, name, name_len, mapent, ctxt->parse->context);
+ ret = do_parse_mount(ap, source, name, name_len, mapent, ctxt);
free(mapent);
--- autofs-5.0.6.orig/modules/parse_sun.c
+++ autofs-5.0.6/modules/parse_sun.c
@@ -1355,7 +1355,7 @@ int parse_mount(struct autofs_point *ap,
if (check_is_multi(p)) {
char *m_root = NULL;
int m_root_len;
- time_t age = time(NULL);
+ time_t age;
int l;
/* If name starts with "/" it's a direct mount */
@@ -1399,6 +1399,8 @@ int parse_mount(struct autofs_point *ap,
return 1;
}
+ age = me->age;
+
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state);
cache_multi_writelock(me);
/* It's a multi-mount; deal with it */
@@ -1472,8 +1474,11 @@ int parse_mount(struct autofs_point *ap,
/*
* We've got the ordered list of multi-mount entries so go
- * through and set the parent entry of each
+ * through and remove any stale entries if this is the top
+ * of the multi-mount and set the parent entry of each.
*/
+ if (me == me->multi)
+ clean_stale_multi_triggers(ap, me, NULL, NULL);
cache_set_parents(me);
rv = mount_subtree(ap, me, name, NULL, options, ctxt);

View File

@ -1,55 +0,0 @@
autofs-5.0.6 - add kernel verion check function
From: Ian Kent <ikent@redhat.com>
Add a function to check kernel version.
---
CHANGELOG | 1 +
include/mounts.h | 17 +++++++++++++++++
2 files changed, 18 insertions(+)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -24,6 +24,7 @@
- add sss lookup module.
- teach automount about sss source.
- ignore duplicate exports in auto.net.
+- add kernel verion check function.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/include/mounts.h
+++ autofs-5.0.6/include/mounts.h
@@ -16,6 +16,9 @@
#ifndef MOUNTS_H
#define MOUNTS_H
+#include <linux/version.h>
+#include <sys/utsname.h>
+
#ifndef AUTOFS_TYPE_ANY
#define AUTOFS_TYPE_ANY 0x0000
#endif
@@ -72,6 +75,20 @@ struct mnt_list {
struct list_head ordered;
};
+static inline unsigned int linux_version_code(void)
+{
+ struct utsname my_utsname;
+ unsigned int p, q, r;
+
+ if (uname(&my_utsname))
+ return 0;
+
+ p = (unsigned int)atoi(strtok(my_utsname.release, "."));
+ q = (unsigned int)atoi(strtok(NULL, "."));
+ r = (unsigned int)atoi(strtok(NULL, "."));
+ return KERNEL_VERSION(p, q, r);
+}
+
unsigned int query_kproto_ver(void);
unsigned int get_kver_major(void);
unsigned int get_kver_minor(void);

View File

@ -1,145 +0,0 @@
autofs-5.0.5 - add piddir to configure
From: Ian Kent <ikent@redhat.com>
In order to accomodate possible changes or different pid file
locations add directory selection for pid file directory to
configure. Also update the fifo directory and flag file directory
configure checks.
---
CHANGELOG | 1 +
Makefile.conf.in | 3 +++
aclocal.m4 | 20 ++++++++++++++++++--
configure | 4 ++--
redhat/Makefile | 1 +
redhat/autofs.init.in | 4 ++--
samples/Makefile | 2 +-
7 files changed, 28 insertions(+), 7 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -16,6 +16,7 @@
- fix ipv6 name lookup check.
- fix ipv6 rpc calls.
- fix ipv6 configure check.
+- add piddir to configure.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/Makefile.conf.in
+++ autofs-5.0.6/Makefile.conf.in
@@ -79,6 +79,9 @@ autofsconfdir = @confdir@
# Location for autofs maps
autofsmapdir = @mapdir@
+# Localtion of pid files
+autofspiddir = @piddir@
+
# Location for autofs fifos
autofsfifodir = @fifodir@
--- autofs-5.0.6.orig/aclocal.m4
+++ autofs-5.0.6/aclocal.m4
@@ -121,13 +121,29 @@ AC_DEFUN(AF_MAP_D,
fi])
dnl --------------------------------------------------------------------------
+dnl AF_PID_D
+dnl
+dnl Check the location of the pid file directory.
+dnl --------------------------------------------------------------------------
+AC_DEFUN(AF_PID_D,
+[if test -z "$piddir"; then
+ for pid_d in /run /var/run /tmp; do
+ if test -z "$piddir"; then
+ if test -d "$pid_d"; then
+ piddir="$pid_d"
+ fi
+ fi
+ done
+fi])
+
+dnl --------------------------------------------------------------------------
dnl AF_FIFO_D
dnl
dnl Check the location of the autofs fifos directory
dnl --------------------------------------------------------------------------
AC_DEFUN(AF_FIFO_D,
[if test -z "$fifodir"; then
- for fifo_d in /var/run /tmp; do
+ for fifo_d in /run /var/run /tmp; do
if test -z "$fifodir"; then
if test -d "$fifo_d"; then
fifodir="$fifo_d"
@@ -143,7 +159,7 @@ dnl Check the location of the autofs fla
dnl --------------------------------------------------------------------------
AC_DEFUN(AF_FLAG_D,
[if test -z "$flagdir"; then
- for flag_d in /var/run /tmp; do
+ for flag_d in /run /var/run /tmp; do
if test -z "$flagdir"; then
if test -d "$flag_d"; then
flagdir="$flag_d"
--- autofs-5.0.6.orig/configure
+++ autofs-5.0.6/configure
@@ -2184,7 +2184,7 @@ $as_echo "$mapdir" >&6; }
# The user can specify --with-fifodir=PATH to specify where autofs fifos go
#
if test -z "$fifodir"; then
- for fifo_d in /var/run /tmp; do
+ for fifo_d in /run /var/run /tmp; do
if test -z "$fifodir"; then
if test -d "$fifo_d"; then
fifodir="$fifo_d"
@@ -2214,7 +2214,7 @@ $as_echo "$fifodir" >&6; }
# The user can specify --with-flagdir=PATH to specify where autofs flag file goes
#
if test -z "$flagdir"; then
- for flag_d in /var/run /tmp; do
+ for flag_d in /run /var/run /tmp; do
if test -z "$flagdir"; then
if test -d "$flag_d"; then
flagdir="$flag_d"
--- autofs-5.0.6.orig/redhat/Makefile
+++ autofs-5.0.6/redhat/Makefile
@@ -8,6 +8,7 @@ autofs.init: autofs.init.in
sed -e "s|@@sbindir@@|$(sbindir)|g" \
-e "s|@@autofslibdir@@|$(autofslibdir)|g" \
-e "s|@@autofsconfdir@@|$(autofsconfdir)|g" \
+ -e "s|@@autofspiddir@@|$(autofspiddir)|g" \
-e "s|@@initdir@@|$(initdir)|g" < autofs.init.in > autofs.init
autofs.sysconfig: autofs.sysconfig.in
--- autofs-5.0.6.orig/redhat/autofs.init.in
+++ autofs-5.0.6/redhat/autofs.init.in
@@ -86,7 +86,7 @@ function start() {
fi
echo -n $"Starting $prog: "
- $prog $OPTIONS --pid-file /var/run/autofs.pid
+ $prog $OPTIONS --pid-file @@autofspiddir@@/autofs.pid
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
success "$prog startup"
@@ -171,7 +171,7 @@ case "$1" in
stop
;;
status)
- status -p /var/run/autofs.pid -l autofs $prog
+ status -p @@autofspiddir@@/autofs.pid -l autofs $prog
;;
restart|force-reload)
restart
--- autofs-5.0.6.orig/samples/Makefile
+++ autofs-5.0.6/samples/Makefile
@@ -21,7 +21,7 @@ dirs:
install -d -m 755 $(INSTALLROOT)$(autofsmapdir)
install -d -m 755 $(INSTALLROOT)$(autofsconfdir)
install -d -m 755 $(INSTALLROOT)$(autofslibdir)
- install -d -m 755 $(INSTALLROOT)/var/run/autofs
+ install -d -m 755 $(INSTALLROOT)$(autofspiddir)
.PHONY: autofs.init
autofs.init:

File diff suppressed because it is too large Load Diff

View File

@ -1,388 +0,0 @@
autofs-5.0.5 - add systemd unit support
From: Ian Kent <ikent@redhat.com>
Add a systemd unit file and attempt to integrating it into our
install.
---
CHANGELOG | 1
Makefile.conf.in | 2 +
aclocal.m4 | 28 ++++++++++++++++++++++
autofs.spec | 58 +++++++++++++++++++++++++++++++++++++++++-----
configure | 47 +++++++++++++++++++++++++++++++++++++
configure.in | 9 +++++++
redhat/Makefile | 10 ++++++-
samples/Makefile | 23 +++++++++++++-----
samples/autofs.service.in | 12 +++++++++
9 files changed, 176 insertions(+), 14 deletions(-)
create mode 100644 samples/autofs.service.in
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -17,6 +17,7 @@
- fix ipv6 rpc calls.
- fix ipv6 configure check.
- add piddir to configure.
+- add systemd unit support.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/Makefile.conf.in
+++ autofs-5.0.6/Makefile.conf.in
@@ -98,3 +98,5 @@ mandir = @mandir@
# Location for init.d files
initdir = @initdir@
+# Location of systemd unit files
+systemddir = @systemddir@
--- autofs-5.0.6.orig/aclocal.m4
+++ autofs-5.0.6/aclocal.m4
@@ -199,6 +199,34 @@ fi], [AC_MSG_RESULT(no)])
])
dnl --------------------------------------------------------------------------
+dnl AF_WITH_SYSTEMD
+dnl
+dnl Check the location of the systemd unit files directory
+dnl --------------------------------------------------------------------------
+AC_DEFUN([AF_WITH_SYSTEMD],
+[AC_ARG_WITH(systemd,
+[ --with-systemd install systemd unit file if systemd unit directory
+ is found on system],
+[if test "$withval" = yes; then
+ if test -z "$systemddir"; then
+ AC_MSG_CHECKING([location of the systemd unit files directory])
+ for systemd_d in /lib/systemd/system; do
+ if test -z "$systemddir"; then
+ if test -d "$systemd_d"; then
+ systemddir="$systemd_d"
+ fi
+ fi
+ done
+ fi
+ if test -n "$systemddir"; then
+ AC_MSG_RESULT($systemddir)
+ else
+ AC_MSG_RESULT(not found)
+ fi
+fi])
+])
+
+dnl --------------------------------------------------------------------------
dnl AF_CHECK_LIBXML
dnl
dnl Check for lib xml
--- autofs-5.0.6.orig/autofs.spec
+++ autofs-5.0.6/autofs.spec
@@ -8,6 +8,10 @@
%define _lib lib64
%endif
+# Use --without systemd in your rpmbuild command or force values to 0 to
+# disable them.
+%define with_systemd %{?_without_systemd: 0} %{?!_without_systemd: 1}
+
Summary: A tool from automatically mounting and umounting filesystems.
Name: autofs
%define version 5.0.6
@@ -18,9 +22,18 @@ License: GPL
Group: System Environment/Daemons
Source: ftp://ftp.kernel.org/pub/linux/daemons/autofs/v4/autofs-%{version}.tar.gz
Buildroot: %{_tmppath}/%{name}-tmp
+%if %{with_systemd}
+BuildRequires: systemd-units
+%endif
BuildPrereq: autoconf, hesiod-devel, openldap-devel, bison, flex, cyrus-sasl-devel
Prereq: chkconfig
Requires: /bin/bash mktemp sed textutils sh-utils grep /bin/ps
+%if %{with_systemd}
+Requires(post): systemd-sysv
+Requires(post): systemd-units
+Requires(preun): systemd-units
+Requires(postun): systemd-units
+%endif
Obsoletes: autofs-ldap
Summary(de): autofs daemon
Summary(fr): démon autofs
@@ -55,14 +68,22 @@ inkludera nätfilsystem, CD-ROM, floppydi
%prep
%setup -q
echo %{version}-%{release} > .version
+%if %{with_systemd}
+ %define _unitdir %{?_unitdir:/lib/systemd/system}
+ %define systemd_configure_arg --with-systemd
+%endif
%build
-CFLAGS="$RPM_OPT_FLAGS -Wall" ./configure --libdir=%{_libdir} --disable-mount-locking --enable-ignore-busy --with-libtirpc --disable-mount-move
+CFLAGS="$RPM_OPT_FLAGS -Wall" ./configure --libdir=%{_libdir} --disable-mount-locking --enable-ignore-busy --with-libtirpc --disable-mount-move %{?systemd_configure_arg:}
CFLAGS="$RPM_OPT_FLAGS -Wall" make initdir=/etc/rc.d/init.d DONTSTRIP=1
%install
rm -rf $RPM_BUILD_ROOT
+%if %{with_systemd}
+install -d -m 755 $RPM_BUILD_ROOT%{_unitdir}
+%else
mkdir -p -m755 $RPM_BUILD_ROOT/etc/rc.d/init.d
+%endif
mkdir -p -m755 $RPM_BUILD_ROOT%{_sbindir}
mkdir -p -m755 $RPM_BUILD_ROOT%{_libdir}/autofs
mkdir -p -m755 $RPM_BUILD_ROOT%{_mandir}/{man5,man8}
@@ -70,31 +91,56 @@ mkdir -p -m755 $RPM_BUILD_ROOT/etc/sysco
mkdir -p -m755 $RPM_BUILD_ROOT/etc/auto.master.d
make install mandir=%{_mandir} initdir=/etc/rc.d/init.d INSTALLROOT=$RPM_BUILD_ROOT
+echo make -C redhat
make -C redhat
+%if %{with_systemd}
+install -m 644 redhat/autofs.service $RPM_BUILD_ROOT%{_unitdir}/autofs.service
+%else
install -m 755 redhat/autofs.init $RPM_BUILD_ROOT/etc/rc.d/init.d/autofs
+%endif
install -m 644 redhat/autofs.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/autofs
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
%post
+%if %{with_systemd}
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+%else
chkconfig --add autofs
-
-%postun
-if [ $1 -ge 1 ] ; then
- /sbin/service autofs condrestart > /dev/null 2>&1 || :
-fi
+%endif
%preun
if [ "$1" = 0 ] ; then
+%if %{with_systemd}
+ /bin/systemctl --no-reload disable autofs.service > /dev/null 2>&1 || :
+ /bin/systemctl stop autofs.service > /dev/null 2>&1 || :
+%else
/sbin/service autofs stop > /dev/null 2>&1 || :
/sbin/chkconfig --del autofs
+%endif
fi
+%postun
+%if %{with_systemd}
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+ /bin/systemctl try-restart autofs.service >/dev/null 2>&1 || :
+fi
+%else
+if [ $1 -ge 1 ] ; then
+ /sbin/service autofs condrestart > /dev/null 2>&1 || :
+fi
+%endif
+
%files
%defattr(-,root,root)
%doc CREDITS CHANGELOG INSTALL COPY* README* samples/ldap* samples/autofs.schema samples/autofs_ldap_auth.conf
+%if %{with_systemd}
+%{_unitdir}/autofs.service
+%else
%config /etc/rc.d/init.d/autofs
+%endif
%config(noreplace) /etc/auto.master
%config(noreplace,missingok) /etc/auto.misc
%config(noreplace,missingok) /etc/auto.net
--- autofs-5.0.6.orig/configure
+++ autofs-5.0.6/configure
@@ -650,6 +650,8 @@ flagdir
fifodir
mapdir
confdir
+systemddir
+piddir
initdir
target_alias
host_alias
@@ -693,6 +695,7 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
with_path
+with_systemd
with_confdir
with_mapdir
with_fifodir
@@ -1337,6 +1340,8 @@ Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-path=PATH look in PATH for binaries needed by the automounter
+ --with-systemd install systemd unit file if systemd unit directory
+ is found on system
--with-confdir=DIR use DIR for autofs configuration files
--with-mapdir=PATH look in PATH for mount maps used by the automounter
--with-fifodir=PATH use PATH as the directory for fifos used by the automounter
@@ -2119,6 +2124,48 @@ $as_echo "$initdir" >&6; }
done
fi
+if test -z "$piddir"; then
+ for pid_d in /run /var/run /tmp; do
+ if test -z "$piddir"; then
+ if test -d "$pid_d"; then
+ piddir="$pid_d"
+ fi
+ fi
+ done
+fi
+
+
+#
+# Check for systemd unit files direectory exists if unit file installation
+# is requested
+#
+
+# Check whether --with-systemd was given.
+if test "${with_systemd+set}" = set; then :
+ withval=$with_systemd; if test "$withval" = yes; then
+ if test -z "$systemddir"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking location of the systemd unit files directory" >&5
+$as_echo_n "checking location of the systemd unit files directory... " >&6; }
+ for systemd_d in /lib/systemd/system; do
+ if test -z "$systemddir"; then
+ if test -d "$systemd_d"; then
+ systemddir="$systemd_d"
+ fi
+ fi
+ done
+ fi
+ if test -n "$systemddir"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $systemddir" >&5
+$as_echo "$systemddir" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+ fi
+fi
+fi
+
+
+
#
# Location of system config script directory?
--- autofs-5.0.6.orig/configure.in
+++ autofs-5.0.6/configure.in
@@ -43,6 +43,15 @@ AF_LINUX_PROCFS()
#
AF_INIT_D()
AC_SUBST(initdir)
+AF_PID_D()
+AC_SUBST(piddir)
+
+#
+# Check for systemd unit files direectory exists if unit file installation
+# is requested
+#
+AF_WITH_SYSTEMD()
+AC_SUBST(systemddir)
#
# Location of system config script directory?
--- autofs-5.0.6.orig/redhat/Makefile
+++ autofs-5.0.6/redhat/Makefile
@@ -2,7 +2,7 @@
-include ../Makefile.conf
include ../Makefile.rules
-all: autofs.init autofs.sysconfig
+all: autofs.init autofs.sysconfig autofs.service
autofs.init: autofs.init.in
sed -e "s|@@sbindir@@|$(sbindir)|g" \
@@ -15,6 +15,12 @@ autofs.sysconfig: autofs.sysconfig.in
sed -e "s|@@autofsmapdir@@|$(autofsmapdir)|g" \
< autofs.sysconfig.in > autofs.sysconfig
+autofs.service: ../samples/autofs.service.in
+ sed -e "s|@@sbindir@@|$(sbindir)|g" \
+ -e "s|@@autofsconfdir@@|$(autofsconfdir)|g" \
+ -e "s|@@autofspiddir@@|$(autofspiddir)|g" \
+ < ../samples/autofs.service.in > autofs.service
+
clean:
- rm -f autofs.init autofs.sysconfig
+ rm -f autofs.init autofs.sysconfig autofs.service
--- autofs-5.0.6.orig/samples/Makefile
+++ autofs-5.0.6/samples/Makefile
@@ -4,7 +4,7 @@ include ../Makefile.rules
SAMPLES = auto.master auto.misc auto.net auto.smb
-all: rc.autofs autofs.conf.default
+all: rc.autofs autofs.conf.default autofs.service
rc.autofs: rc.autofs.in
sed -e "s|@@sbindir@@|$(sbindir)|g" \
@@ -16,6 +16,12 @@ autofs.conf.default: autofs.conf.default
sed -e "s|@@autofsmapdir@@|$(autofsmapdir)|g" \
< autofs.conf.default.in > autofs.conf.default
+autofs.service: autofs.service.in
+ sed -e "s|@@sbindir@@|$(sbindir)|g" \
+ -e "s|@@autofsconfdir@@|$(autofsconfdir)|g" \
+ -e "s|@@autofspiddir@@|$(autofspiddir)|g" \
+ < autofs.service.in > autofs.service
+
.PHONY: dirs
dirs:
install -d -m 755 $(INSTALLROOT)$(autofsmapdir)
@@ -26,13 +32,18 @@ dirs:
.PHONY: autofs.init
autofs.init:
@echo
-ifneq ($(initdir),)
+ifneq ($(systemddir),)
+ install -d -m 755 $(INSTALLROOT)$(systemddir)
+ install autofs.service -m 644 $(INSTALLROOT)$(systemddir)/autofs.service
+else
+ ifneq ($(initdir),)
install -d -m 755 $(INSTALLROOT)$(initdir)
install rc.autofs -m 755 $(INSTALLROOT)$(initdir)/autofs
-else
+ else
if test -d $(INSTALLROOT)/etc/rc.d ; then \
install -c rc.autofs -m 755 $(INSTALLROOT)/etc/rc.d ; \
fi
+ endif
endif
CONFIG = $(shell test -e $(INSTALLROOT)$(autofsconfdir)/autofs.orig || echo "-b --suffix=.orig")
@@ -173,10 +184,10 @@ auto.smb:
fi ; \
fi
-install: rc.autofs autofs.conf.default dirs autofs.init autofs.conf \
- autofs_ldap_auth.conf $(SAMPLES)
+install: rc.autofs autofs.conf.default dirs autofs.init autofs.service \
+ autofs.conf autofs_ldap_auth.conf $(SAMPLES)
@echo
clean:
- rm -f *.o *.s rc.autofs autofs.conf.default
+ rm -f *.o *.s rc.autofs autofs.conf.default autofs.service
--- /dev/null
+++ autofs-5.0.6/samples/autofs.service.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=Automounts filesystems on demand
+After=network.target ypbind.service
+
+[Service]
+Type=forking
+PIDFile=@@autofspiddir@@/autofs.pid
+EnvironmentFile=-@@autofsconfdir@@/autofs
+ExecStart=@@sbindir@@/automount ${OPTIONS} --pid-file @@autofspiddir@@/autofs.pid
+
+[Install]
+WantedBy=multi-user.target

View File

@ -1,38 +0,0 @@
autofs-5.0.6 - allow MOUNT_WAIT to override probe
From: Ian Kent <ikent@redhat.com>
Allow the use of MOUNT_WAIT to override the probe of singleton
map entries. This can allow for quicker fails to hosts that are
not reachable.
---
CHANGELOG | 1 +
modules/replicated.c | 3 +++
2 files changed, 4 insertions(+)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -34,6 +34,7 @@
- fix function to check mount.nfs version.
- fix typo in libtirpc file name.
- fix rework error return handling in rpc code.
+- allow MOUNT_WAIT to override probe.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/modules/replicated.c
+++ autofs-5.0.6/modules/replicated.c
@@ -953,8 +953,11 @@ int prune_host_list(unsigned logopt, str
* are not available so check the kernel version and mount.nfs
* version and probe singleton mounts if the kernel version is
* greater than 2.6.22 and mount.nfs version is greater than 1.1.1.
+ * But also allow the MOUNT_WAIT configuration parameter to override
+ * the probing.
*/
if (nfs_mount_uses_string_options &&
+ defaults_get_mount_wait() == -1 &&
(kern_vers = linux_version_code()) > KERNEL_VERSION(2, 6, 22)) {
if (!this)
return 1;

View File

@ -1,104 +0,0 @@
autofs-5.0.6 - allow update of multi mount offset entries
From: Ian Kent <ikent@redhat.com>
Currently multi mount offsets can only be added or all offsets owned by
an entry deleted at once. In order to be able to update multi mount map
entries we need to be able to update offset entries of an already expanded
multi map cache entry.
---
include/automount.h | 2 +-
lib/cache.c | 4 ++--
modules/parse_sun.c | 20 ++++++++++----------
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/include/automount.h b/include/automount.h
index 40c1975..561fcc2 100644
--- a/include/automount.h
+++ b/include/automount.h
@@ -188,7 +188,7 @@ struct mapent *cache_lookup_distinct(struct mapent_cache *mc, const char *key);
struct mapent *cache_lookup_offset(const char *prefix, const char *offset, int start, struct list_head *head);
struct mapent *cache_partial_match(struct mapent_cache *mc, const char *prefix);
int cache_add(struct mapent_cache *mc, struct map_source *ms, const char *key, const char *mapent, time_t age);
-int cache_add_offset(struct mapent_cache *mc, const char *mkey, const char *key, const char *mapent, time_t age);
+int cache_update_offset(struct mapent_cache *mc, const char *mkey, const char *key, const char *mapent, time_t age);
int cache_set_parents(struct mapent *mm);
int cache_update(struct mapent_cache *mc, struct map_source *ms, const char *key, const char *mapent, time_t age);
int cache_delete(struct mapent_cache *mc, const char *key);
diff --git a/lib/cache.c b/lib/cache.c
index 1489273..9179ad5 100644
--- a/lib/cache.c
+++ b/lib/cache.c
@@ -647,7 +647,7 @@ static void cache_add_ordered_offset(struct mapent *me, struct list_head *head)
}
/* cache must be write locked by caller */
-int cache_add_offset(struct mapent_cache *mc, const char *mkey, const char *key, const char *mapent, time_t age)
+int cache_update_offset(struct mapent_cache *mc, const char *mkey, const char *key, const char *mapent, time_t age)
{
unsigned logopt = mc->ap ? mc->ap->logopt : master_get_logopt();
struct mapent *me, *owner;
@@ -659,7 +659,7 @@ int cache_add_offset(struct mapent_cache *mc, const char *mkey, const char *key,
me = cache_lookup_distinct(mc, key);
if (me && me->age == age) {
- if (me != owner)
+ if (me->multi != owner)
return CHE_DUPLICATE;
}
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
index c4decbc..5be7345 100644
--- a/modules/parse_sun.c
+++ b/modules/parse_sun.c
@@ -781,10 +781,10 @@ static int check_is_multi(const char *mapent)
}
static int
-add_offset_entry(struct autofs_point *ap, const char *name,
- const char *m_root, int m_root_len,
- const char *path, const char *myoptions, const char *loc,
- time_t age)
+update_offset_entry(struct autofs_point *ap, const char *name,
+ const char *m_root, int m_root_len,
+ const char *path, const char *myoptions, const char *loc,
+ time_t age)
{
struct map_source *source;
struct mapent_cache *mc;
@@ -838,17 +838,17 @@ add_offset_entry(struct autofs_point *ap, const char *name,
} else
strcpy(m_mapent, loc);
- ret = cache_add_offset(mc, name, m_key, m_mapent, age);
+ ret = cache_update_offset(mc, name, m_key, m_mapent, age);
if (ret == CHE_DUPLICATE)
warn(ap->logopt, MODPREFIX
"syntax error or duplicate offset %s -> %s", path, loc);
else if (ret == CHE_FAIL)
debug(ap->logopt, MODPREFIX
- "failed to add multi-mount offset %s -> %s", path, m_mapent);
+ "failed to update multi-mount offset %s -> %s", path, m_mapent);
else {
ret = CHE_OK;
debug(ap->logopt, MODPREFIX
- "added multi-mount offset %s -> %s", path, m_mapent);
+ "updated multi-mount offset %s -> %s", path, m_mapent);
}
return ret;
@@ -1448,9 +1448,9 @@ int parse_mount(struct autofs_point *ap, const char *name,
master_source_current_wait(ap->entry);
ap->entry->current = source;
- status = add_offset_entry(ap, name,
- m_root, m_root_len,
- path, myoptions, loc, age);
+ status = update_offset_entry(ap, name,
+ m_root, m_root_len,
+ path, myoptions, loc, age);
if (status != CHE_OK) {
warn(ap->logopt, MODPREFIX "error adding multi-mount");

View File

@ -1,166 +0,0 @@
autofs-5.0.6 - catch EHOSTUNREACH and bail out early
From: Ian Kent <raven@themaw.net>
Now that the lower layers of the rpc code has been reworked
to propogate error returns up to the top level code we can
catch the EHOSTUNREACH return and stop the probe since the
host isn't responding.
Also, since UDP is a broadcast protocol we don't get the
EHOSTUNREACH and always have to wait, so change the probe
order to try TCP first. Using UDP first was originally
done to reduce reserved port usage but autofs probing uses
higher numbered ports now so this shouldn't introduce
problem even for older implementations.
---
CHANGELOG | 1
include/replicated.h | 3 ++
modules/replicated.c | 55 +++++++++++++++++++++++++++++++++++++--------------
3 files changed, 44 insertions(+), 15 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -28,6 +28,7 @@
- add function to check mount.nfs version.
- reinstate singleton mount probe.
- rework error return handling in rpc code.
+- catch EHOSTUNREACH and bail out early.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/include/replicated.h
+++ autofs-5.0.6/include/replicated.h
@@ -48,6 +48,9 @@
#define TCP_SELECTED_MASK 0x00FF
#define UDP_SELECTED_MASK 0xFF00
+#define IS_ERR(supported) (0x8000 & supported)
+#define ERR(supported) (IS_ERR(supported) ? (~supported + 1) : supported)
+
#define RPC_TIMEOUT 5
struct host {
--- autofs-5.0.6.orig/modules/replicated.c
+++ autofs-5.0.6/modules/replicated.c
@@ -563,7 +563,9 @@ static unsigned int get_nfs_info(unsigne
status = rpc_udp_getclient(rpc_info, NFS_PROGRAM, NFS4_VERSION);
else
status = rpc_tcp_getclient(rpc_info, NFS_PROGRAM, NFS4_VERSION);
- if (!status) {
+ if (status == -EHOSTUNREACH)
+ return (unsigned int) status;
+ else if (!status) {
gettimeofday(&start, &tz);
status = rpc_ping_proto(rpc_info);
gettimeofday(&end, &tz);
@@ -589,7 +591,10 @@ v3_ver:
status = rpc_portmap_getclient(pm_info,
host->name, host->addr, host->addr_len,
proto, RPC_CLOSE_DEFAULT);
- if (status)
+ if (status == -EHOSTUNREACH) {
+ supported = status;
+ goto done_ver;
+ } else if (status)
goto done_ver;
}
@@ -602,16 +607,23 @@ v3_ver:
} else {
parms.pm_prot = rpc_info->proto->p_proto;
parms.pm_vers = NFS3_VERSION;
- rpc_info->port = rpc_portmap_getport(pm_info, &parms);
- if (rpc_info->port < 0)
+ status = rpc_portmap_getport(pm_info, &parms);
+ if (status == -EHOSTUNREACH) {
+ supported = status;
+ goto done_ver;
+ } else if (status < 0)
goto v2_ver;
+ rpc_info->port = status;
}
if (rpc_info->proto->p_proto == IPPROTO_UDP)
status = rpc_udp_getclient(rpc_info, NFS_PROGRAM, NFS3_VERSION);
else
status = rpc_tcp_getclient(rpc_info, NFS_PROGRAM, NFS3_VERSION);
- if (!status) {
+ if (status == -EHOSTUNREACH) {
+ supported = status;
+ goto done_ver;
+ } else if (!status) {
gettimeofday(&start, &tz);
status = rpc_ping_proto(rpc_info);
gettimeofday(&end, &tz);
@@ -643,15 +655,23 @@ v2_ver:
parms.pm_prot = rpc_info->proto->p_proto;
parms.pm_vers = NFS2_VERSION;
rpc_info->port = rpc_portmap_getport(pm_info, &parms);
- if (rpc_info->port < 0)
+ status = rpc_portmap_getport(pm_info, &parms);
+ if (status == -EHOSTUNREACH) {
+ supported = status;
+ goto done_ver;
+ } else if (status < 0)
goto done_ver;
+ rpc_info->port = status;
}
if (rpc_info->proto->p_proto == IPPROTO_UDP)
status = rpc_udp_getclient(rpc_info, NFS_PROGRAM, NFS2_VERSION);
else
status = rpc_tcp_getclient(rpc_info, NFS_PROGRAM, NFS2_VERSION);
- if (!status) {
+ if (status == -EHOSTUNREACH) {
+ supported = status;
+ goto done_ver;
+ } else if (!status) {
gettimeofday(&start, &tz);
status = rpc_ping_proto(rpc_info);
gettimeofday(&end, &tz);
@@ -728,21 +748,24 @@ static int get_vers_and_cost(unsigned lo
vers &= version;
- if (version & UDP_REQUESTED) {
+ if (version & TCP_REQUESTED) {
supported = get_nfs_info(logopt, host,
- &pm_info, &rpc_info, "udp", vers, options);
- if (supported) {
+ &pm_info, &rpc_info, "tcp", vers, options);
+ if (IS_ERR(supported)) {
+ if (ERR(supported) == EHOSTUNREACH)
+ return ret;
+ } else if (supported) {
ret = 1;
- host->version |= (supported << 8);
+ host->version |= supported;
}
}
- if (version & TCP_REQUESTED) {
+ if (version & UDP_REQUESTED) {
supported = get_nfs_info(logopt, host,
- &pm_info, &rpc_info, "tcp", vers, options);
+ &pm_info, &rpc_info, "udp", vers, options);
if (supported) {
ret = 1;
- host->version |= supported;
+ host->version |= (supported << 8);
}
}
@@ -848,7 +871,9 @@ static int get_supported_ver_and_cost(un
status = rpc_udp_getclient(&rpc_info, NFS_PROGRAM, parms.pm_vers);
else
status = rpc_tcp_getclient(&rpc_info, NFS_PROGRAM, parms.pm_vers);
- if (!status) {
+ if (status == -EHOSTUNREACH)
+ goto done;
+ else if (!status) {
gettimeofday(&start, &tz);
status = rpc_ping_proto(&rpc_info);
gettimeofday(&end, &tz);

View File

@ -1,70 +0,0 @@
autofs-5.0.6 - check if /etc/mtab is a link to /proc/self/mounts
From: Leonardo Chiquitto <leonardo.lists@gmail.com>
Check if /etc/mtab is a link to /proc/self/mounts
Some distributions link /etc/mtab to /proc/self/mounts instead
of /proc/mounts.
---
CHANGELOG | 1 +
daemon/spawn.c | 9 ++++++---
include/automount.h | 3 ++-
3 files changed, 9 insertions(+), 4 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -48,6 +48,7 @@
- move timeout to map_source (allow per direct map timeout).
- fix kernel verion check of version components.
- dont retry ldap connect if not required.
+- check if /etc/mtab is a link to /proc/self/mounts.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/daemon/spawn.c
+++ autofs-5.0.6/daemon/spawn.c
@@ -336,7 +336,8 @@ int spawn_mount(unsigned logopt, ...)
ret = readlink(_PATH_MOUNTED, buf, PATH_MAX);
if (ret != -1) {
buf[ret] = '\0';
- if (!strcmp(buf, _PROC_MOUNTS)) {
+ if (!strcmp(buf, _PROC_MOUNTS) ||
+ !strcmp(buf, _PROC_SELF_MOUNTS)) {
debug(logopt,
"mtab link detected, passing -n to mount");
argc++;
@@ -467,7 +468,8 @@ int spawn_bind_mount(unsigned logopt, ..
ret = readlink(_PATH_MOUNTED, buf, PATH_MAX);
if (ret != -1) {
buf[ret] = '\0';
- if (!strcmp(buf, _PROC_MOUNTS)) {
+ if (!strcmp(buf, _PROC_MOUNTS) ||
+ !strcmp(buf, _PROC_SELF_MOUNTS)) {
debug(logopt,
"mtab link detected, passing -n to mount");
argc++;
@@ -569,7 +571,8 @@ int spawn_umount(unsigned logopt, ...)
ret = readlink(_PATH_MOUNTED, buf, PATH_MAX);
if (ret != -1) {
buf[ret] = '\0';
- if (!strcmp(buf, _PROC_MOUNTS)) {
+ if (!strcmp(buf, _PROC_MOUNTS) ||
+ !strcmp(buf, _PROC_SELF_MOUNTS)) {
debug(logopt,
"mtab link detected, passing -n to mount");
argc++;
--- autofs-5.0.6.orig/include/automount.h
+++ autofs-5.0.6/include/automount.h
@@ -84,7 +84,8 @@ int load_autofs4_module(void);
#define MTAB_NOTUPDATED 0x1000 /* mtab succeded but not updated */
#define NOT_MOUNTED 0x0100 /* path notmounted */
#define MNT_FORCE_FAIL -1
-#define _PROC_MOUNTS "/proc/mounts"
+#define _PROC_MOUNTS "/proc/mounts"
+#define _PROC_SELF_MOUNTS "/proc/self/mounts"
/* Constants for lookup modules */

View File

@ -1,101 +0,0 @@
autofs-5.0.6 - code analysis fixes 1
From: Ian Kent <ikent@redhat.com>
Code analysis defect fixes, installment 1.
- fix signed usage of unsigned variable in do_srv_query().
- make NULL check handling of variable dcs explicit in get_dc_list().
- adding an explicit NULL check for variable dcs gaurds against
future changes in get_srv_rrs() returning success while not
clearing the dcs variable.
- makes it explict for readers why we don't need to check for NULL
before free later in the loop.
- fix typo in do_reconnect()
- uri is never set now and, at this point, we need to try to connect
to the last server uri (ctxt->uri->uri) which is set in find_server()
when ctxt->uri is NULL.
---
CHANGELOG | 1 +
modules/dclist.c | 11 +++++------
modules/lookup_ldap.c | 3 +--
3 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index dc91c25..acc5f0c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,7 @@
- fix dumpmaps not reading maps.
- fix result null check in read_one_map().
- fix LDAP result leaks on error paths.
+- code analysis fixes part 1.
28/06/2011 autofs-5.0.6
-----------------------
diff --git a/modules/dclist.c b/modules/dclist.c
index aeb107f..d16b913 100644
--- a/modules/dclist.c
+++ b/modules/dclist.c
@@ -69,7 +69,7 @@ static void dclist_mutex_unlock(void)
static int do_srv_query(unsigned int logopt, char *name, u_char **packet)
{
- unsigned int len = PACKETSZ;
+ int len = PACKETSZ;
unsigned int last_len = len;
char ebuf[MAX_ERR_BUF];
u_char *buf;
@@ -500,7 +500,8 @@ struct dclist *get_dc_list(unsigned int logopt, const char *uri)
}
dclist_mutex_lock();
- if (!get_srv_rrs(logopt, request, &dcs, &numdcs)) {
+ ret = get_srv_rrs(logopt, request, &dcs, &numdcs);
+ if (!ret | !dcs) {
error(logopt,
"DNS SRV query failed for domain %s", domain);
dclist_mutex_unlock();
@@ -526,8 +527,7 @@ struct dclist *get_dc_list(unsigned int logopt, const char *uri)
if (!tmp) {
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
error(logopt, "realloc: %s", estr);
- if (dcs)
- free_srv_rrs(dcs, numdcs);
+ free_srv_rrs(dcs, numdcs);
goto out_error;
}
@@ -548,8 +548,7 @@ struct dclist *get_dc_list(unsigned int logopt, const char *uri)
if (ret > 6) {
error(logopt,
"invalid port: %u", dcs[i].port);
- if (dcs)
- free_srv_rrs(dcs, numdcs);
+ free_srv_rrs(dcs, numdcs);
goto out_error;
}
strcat(tmp, port);
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
index 29323b2..67a6834 100644
--- a/modules/lookup_ldap.c
+++ b/modules/lookup_ldap.c
@@ -736,7 +736,6 @@ static LDAP *find_server(unsigned logopt, struct lookup_context *ctxt)
static LDAP *do_reconnect(unsigned logopt, struct lookup_context *ctxt)
{
LDAP *ldap = NULL;
- char *uri;
if (ctxt->server || !ctxt->uris) {
ldap = do_connect(logopt, ctxt->server, ctxt);
@@ -780,7 +779,7 @@ static LDAP *do_reconnect(unsigned logopt, struct lookup_context *ctxt)
*/
if (!ldap) {
autofs_sasl_dispose(ctxt);
- ldap = connect_to_server(logopt, uri, ctxt);
+ ldap = connect_to_server(logopt, ctxt->uri->uri, ctxt);
}
#endif
if (ldap)

View File

@ -1,65 +0,0 @@
autofs-5.0.6 - dont retry ldap connect if not required
From: Ian Kent <ikent@redhat.com>
When using LDAP and the server is not available autofs retries the
connection when it fails in case the SASL credentail has expired.
But this is done even when not using SASL, so change it check if
SASL authentication is required.
---
CHANGELOG | 1 +
include/lookup_ldap.h | 1 +
modules/lookup_ldap.c | 6 +++---
3 files changed, 5 insertions(+), 3 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -47,6 +47,7 @@
- update ->timeout() function to not return timeout.
- move timeout to map_source (allow per direct map timeout).
- fix kernel verion check of version components.
+- dont retry ldap connect if not required.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/include/lookup_ldap.h
+++ autofs-5.0.6/include/lookup_ldap.h
@@ -104,6 +104,7 @@ struct lookup_context {
#define LDAP_AUTH_NOTREQUIRED 0x0001
#define LDAP_AUTH_REQUIRED 0x0002
#define LDAP_AUTH_AUTODETECT 0x0004
+#define LDAP_NEED_AUTH (LDAP_AUTH_REQUIRED|LDAP_AUTH_AUTODETECT)
#endif
#define LDAP_AUTH_USESIMPLE 0x0008
--- autofs-5.0.6.orig/modules/lookup_ldap.c
+++ autofs-5.0.6/modules/lookup_ldap.c
@@ -511,7 +511,7 @@ static int do_bind(unsigned logopt, LDAP
debug(logopt, MODPREFIX "auth_required: %d, sasl_mech %s",
ctxt->auth_required, ctxt->sasl_mech);
- if (ctxt->auth_required & (LDAP_AUTH_REQUIRED|LDAP_AUTH_AUTODETECT)) {
+ if (ctxt->auth_required & LDAP_NEED_AUTH) {
rv = autofs_sasl_bind(logopt, ldap, ctxt);
debug(logopt, MODPREFIX "autofs_sasl_bind returned %d", rv);
} else {
@@ -731,7 +731,7 @@ static LDAP *do_reconnect(unsigned logop
ldap = do_connect(logopt, ctxt->server, ctxt);
#ifdef WITH_SASL
/* Dispose of the sasl authentication connection and try again. */
- if (!ldap) {
+ if (!ldap && ctxt->auth_required & LDAP_NEED_AUTH) {
autofs_sasl_dispose(ctxt);
ldap = connect_to_server(logopt, ctxt->server, ctxt);
}
@@ -767,7 +767,7 @@ static LDAP *do_reconnect(unsigned logop
* Dispose of the sasl authentication connection and try the
* current server again before trying other servers in the list.
*/
- if (!ldap) {
+ if (!ldap && ctxt->auth_required & LDAP_NEED_AUTH) {
autofs_sasl_dispose(ctxt);
ldap = connect_to_server(logopt, ctxt->uri->uri, ctxt);
}

View File

@ -1,158 +0,0 @@
autofs-5.0.6 - duplicate parent options for included maps
From: Ian Kent <ikent@redhat.com>
Included maps should inherite mount options from their parent mount.
---
CHANGELOG | 1
modules/lookup_file.c | 61 +++++++++++++++++++++++++++++++++++++++++++-------
2 files changed, 54 insertions(+), 8 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -43,6 +43,7 @@
- fix initialization in rpc create_client().
- fix libtirpc name clash.
- report map not read when debug logging.
+- duplicate parent options for included maps.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/modules/lookup_file.c
+++ autofs-5.0.6/modules/lookup_file.c
@@ -41,9 +41,10 @@ typedef enum {
typedef enum { got_nothing, got_star, got_real, got_plus } FOUND_STATE;
typedef enum { esc_none, esc_char, esc_val, esc_all } ESCAPES;
-
struct lookup_context {
const char *mapname;
+ int opts_argc;
+ const char **opts_argv;
struct parse_mod *parse;
};
@@ -88,8 +89,20 @@ int lookup_init(const char *mapfmt, int
if (!mapfmt)
mapfmt = MAPFMT_DEFAULT;
- ctxt->parse = open_parse(mapfmt, MODPREFIX, argc - 1, argv + 1);
+ argc--;
+ argv++;
+
+ ctxt->opts_argv = copy_argv(argc, (const char **) argv);
+ if (ctxt->opts_argv == NULL) {
+ free(ctxt);
+ warn(LOGOPT_NONE, MODPREFIX "failed to duplicate options");
+ return 1;
+ }
+ ctxt->opts_argc = argc;
+
+ ctxt->parse = open_parse(mapfmt, MODPREFIX, argc, argv);
if (!ctxt->parse) {
+ free_argv(ctxt->opts_argc, ctxt->opts_argv);
free(ctxt);
logmsg(MODPREFIX "failed to open parse context");
return 1;
@@ -512,12 +525,15 @@ static int check_self_include(const char
}
static struct map_source *
-prepare_plus_include(struct autofs_point *ap, time_t age, char *key, unsigned int inc)
+prepare_plus_include(struct autofs_point *ap,
+ time_t age, char *key, unsigned int inc,
+ struct lookup_context *ctxt)
{
struct map_source *current;
struct map_source *source;
struct map_type_info *info;
const char *argv[2];
+ char **tmp_argv, **tmp_opts;
int argc;
char *buf;
@@ -551,9 +567,35 @@ prepare_plus_include(struct autofs_point
argv[0] = info->map;
argv[1] = NULL;
+ tmp_argv = (char **) copy_argv(argc, argv);
+ if (!tmp_argv) {
+ error(ap->logopt, MODPREFIX "failed to allocate args vector");
+ free_map_type_info(info);
+ free(buf);
+ return NULL;
+ }
+
+ tmp_opts = (char **) copy_argv(ctxt->opts_argc, ctxt->opts_argv);
+ if (!tmp_opts) {
+ error(ap->logopt, MODPREFIX "failed to allocate options args vector");
+ free_argv(argc, (const char **) tmp_argv);
+ free_map_type_info(info);
+ free(buf);
+ return NULL;
+ }
+
+ tmp_argv = append_argv(argc, tmp_argv, ctxt->opts_argc, tmp_opts);
+ if (!tmp_argv) {
+ error(ap->logopt, MODPREFIX "failed to append options vector");
+ free_map_type_info(info);
+ free(buf);
+ return NULL;
+ }
+ argc += ctxt->opts_argc;
+
source = master_find_source_instance(current,
info->type, info->format,
- argc, argv);
+ argc, (const char **) tmp_argv);
if (source) {
/*
* Make sure included map age is in sync with its owner
@@ -563,15 +605,17 @@ prepare_plus_include(struct autofs_point
source->stale = 1;
} else {
source = master_add_source_instance(current,
- info->type, info->format,
- age, argc, argv);
+ info->type, info->format, age,
+ argc, (const char **) tmp_argv);
if (!source) {
+ free_argv(argc, (const char **) tmp_argv);
free_map_type_info(info);
free(buf);
error(ap->logopt, "failed to add included map instance");
return NULL;
}
}
+ free_argv(argc, (const char **) tmp_argv);
source->depth = current->depth + 1;
if (inc)
@@ -645,7 +689,7 @@ int lookup_read_map(struct autofs_point
master_source_current_wait(ap->entry);
ap->entry->current = source;
- inc_source = prepare_plus_include(ap, age, key, inc);
+ inc_source = prepare_plus_include(ap, age, key, inc, ctxt);
if (!inc_source) {
debug(ap->logopt,
"failed to select included map %s", key);
@@ -729,7 +773,7 @@ static int lookup_one(struct autofs_poin
master_source_current_wait(ap->entry);
ap->entry->current = source;
- inc_source = prepare_plus_include(ap, age, mkey, inc);
+ inc_source = prepare_plus_include(ap, age, mkey, inc, ctxt);
if (!inc_source) {
debug(ap->logopt,
MODPREFIX
@@ -1096,6 +1140,7 @@ int lookup_done(void *context)
{
struct lookup_context *ctxt = (struct lookup_context *) context;
int rv = close_parse(ctxt->parse);
+ free_argv(ctxt->opts_argc, ctxt->opts_argv);
free(ctxt);
return rv;
}

View File

@ -1,56 +0,0 @@
autofs-5.0.6 - Fix LDAP result leaks on error paths
From: Leonardo Chiquitto <leonardo.lists@gmail.com>
According to ldap_search_s(3), the result structure must be freed
with ldap_msgfree() even when the search function returned failure.
---
CHANGELOG | 1 +
modules/lookup_ldap.c | 6 ++++++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 66b804f..dc91c25 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -5,6 +5,7 @@
- fix paged query more results check.
- fix dumpmaps not reading maps.
- fix result null check in read_one_map().
+- fix LDAP result leaks on error paths.
28/06/2011 autofs-5.0.6
-----------------------
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
index 22ff355..29323b2 100644
--- a/modules/lookup_ldap.c
+++ b/modules/lookup_ldap.c
@@ -347,6 +347,8 @@ static int get_query_dn(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt
error(logopt,
MODPREFIX "query failed for %s: %s",
query, ldap_err2string(rv));
+ if (result)
+ ldap_msgfree(result);
free(query);
return 0;
}
@@ -1573,6 +1575,8 @@ int lookup_read_master(struct master *master, time_t age, void *context)
error(logopt, MODPREFIX "query failed for %s: %s",
query, ldap_err2string(rv));
unbind_ldap_connection(logging, ldap, ctxt);
+ if (result)
+ ldap_msgfree(result);
free(query);
return NSS_STATUS_NOTFOUND;
}
@@ -2586,6 +2590,8 @@ static int lookup_one(struct autofs_point *ap,
if ((rv != LDAP_SUCCESS) || !result) {
crit(ap->logopt, MODPREFIX "query failed for %s", query);
unbind_ldap_connection(ap->logopt, ldap, ctxt);
+ if (result)
+ ldap_msgfree(result);
free(query);
return CHE_FAIL;
}

View File

@ -1,23 +0,0 @@
autofs-5.0.6 - fix MNT_DETACH define
From: Ian Kent <raven@themaw.net>
MNT_DETACH has been included in herder file
---
include/automount.h | 2 ++
1 file changed, 2 insertions(+)
--- autofs-5.0.6.orig/include/automount.h
+++ autofs-5.0.6/include/automount.h
@@ -333,7 +333,9 @@ int ncat_path(char *buf, size_t len,
/* Core automount definitions */
+#ifndef MNT_DETACH
#define MNT_DETACH 0x00000002 /* Just detach from the tree */
+#endif
struct startup_cond {
pthread_mutex_t mutex;

View File

@ -1,69 +0,0 @@
autofs-5.0.6 - fix configure string length tests
From: Ian Kent <ikent@redhat.com>
Checks for sss library directory were missing quotes around
the library variable.
---
CHANGELOG | 1 +
aclocal.m4 | 6 +++---
configure | 6 +++---
3 files changed, 7 insertions(+), 6 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -39,6 +39,7 @@
- use strtok_r() in linux_version_code().
- fix sss wildcard match.
- fix dlopen() error handling in sss module.
+- fix configure string length tests for sss library.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/aclocal.m4
+++ autofs-5.0.6/aclocal.m4
@@ -37,16 +37,16 @@ dnl
dnl Check if a sss autofs library exists.
dnl --------------------------------------------------------------------------
AC_DEFUN(AF_CHECK_SSS_LIB,
-[if test -z $sssldir; then
+[if test -z "$sssldir"; then
AC_MSG_CHECKING(for sssd autofs library)
for libd in /usr/lib64 /usr/lib; do
- if test -z $sssldir; then
+ if test -z "$sssldir"; then
if test -e "$libd/sssd/modules/$2"; then
sssldir=$libd/sssd/modules
fi
fi
done
- if test -n $sssldir; then
+ if test -n "$sssldir"; then
HAVE_$1=1
AC_MSG_RESULT(yes)
else
--- autofs-5.0.6.orig/configure
+++ autofs-5.0.6/configure
@@ -3832,17 +3832,17 @@ else
fi
-if test -z $sssldir; then
+if test -z "$sssldir"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sssd autofs library" >&5
$as_echo_n "checking for sssd autofs library... " >&6; }
for libd in /usr/lib64 /usr/lib; do
- if test -z $sssldir; then
+ if test -z "$sssldir"; then
if test -e "$libd/sssd/modules/libsss_autofs.so"; then
sssldir=$libd/sssd/modules
fi
fi
done
- if test -n $sssldir; then
+ if test -n "$sssldir"; then
HAVE_SSS_AUTOFS=1
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }

View File

@ -1,37 +0,0 @@
autofs-5.0.6 - fix devce ioctl alloc path check
From: Ian Kent <ikent@redhat.com>
The errno error should be set in alloc_dev_ioctl_path() if the passed
in path in NULL.
---
CHANGELOG | 1 +
lib/dev-ioctl-lib.c | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -56,6 +56,7 @@
- fix umount recovery of busy direct mount.
- fix offset mount point directory removal.
- fix remount of multi mount.
+- fix devce ioctl alloc path check.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/lib/dev-ioctl-lib.c
+++ autofs-5.0.6/lib/dev-ioctl-lib.c
@@ -270,8 +270,10 @@ static struct autofs_dev_ioctl *alloc_de
struct autofs_dev_ioctl *ioctl;
size_t size, p_len;
- if (!path)
+ if (!path) {
+ errno = EINVAL;
return NULL;
+ }
p_len = strlen(path);
size = sizeof(struct autofs_dev_ioctl) + p_len + 1;

View File

@ -1,36 +0,0 @@
autofs-5.0.6 - fix dlopen() error handling in sss module
From: Ian Kent <ikent@redhat.com>
If dlopen(3) fails during initialization of the sss module the
error message is incorrect since dlerror(3) must be used, not
errno.
---
CHANGELOG | 1 +
modules/lookup_sss.c | 3 +--
2 files changed, 2 insertions(+), 2 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -38,6 +38,7 @@
- improve UDP RPC timeout handling.
- use strtok_r() in linux_version_code().
- fix sss wildcard match.
+- fix dlopen() error handling in sss module.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/modules/lookup_sss.c
+++ autofs-5.0.6/modules/lookup_sss.c
@@ -94,8 +94,7 @@ int lookup_init(const char *mapfmt, int
dh = dlopen(dlbuf, RTLD_LAZY);
if (!dh) {
- estr = strerror_r(errno, buf, MAX_ERR_BUF);
- logerr(MODPREFIX "dlopen: %s", estr);
+ logerr(MODPREFIX "failed to open %s: %s", dlbuf, dlerror());
free(ctxt);
return 1;
}

View File

@ -1,47 +0,0 @@
autofs-5.0.6 - fix dumpmaps not reading maps
From: Ian Kent <raven@themaw.net>
The lookup modules won't read any indirect map entries (other than those
in a file map) unless unless the browse option is set. In order to list
the entries when tyhe dumpmap option is given the browse option needs to
be set.
---
CHANGELOG | 1 +
lib/master.c | 9 +++++++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 884a9ae..946a196 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,6 +3,7 @@
- fix ipv6 name for lookup fix.
- improve mount location error reporting.
- fix paged query more results check.
+- fix dumpmaps not reading maps.
28/06/2011 autofs-5.0.6
-----------------------
diff --git a/lib/master.c b/lib/master.c
index 153a38b..6c89e1d 100644
--- a/lib/master.c
+++ b/lib/master.c
@@ -1283,6 +1283,15 @@ int master_show_mounts(struct master *master)
printf("\nMount point: %s\n", ap->path);
printf("\nsource(s):\n");
+ /*
+ * Ensure we actually read indirect map entries so we can
+ * list them. The map reads won't read any indirect map
+ * entries (other than those in a file map) unless the
+ * browse option is set.
+ */
+ if (ap->type == LKP_INDIRECT)
+ ap->flags |= MOUNT_FLAG_GHOST;
+
/* Read the map content into the cache */
if (lookup_nss_read_map(ap, NULL, now))
lookup_prune_cache(ap, now);

View File

@ -1,33 +0,0 @@
autofs-5.0.6 - fix fix LDAP result leaks on error paths
From: Ian Kent <raven@themaw.net>
The previous patch with which ensured that the result struture returned
from ldap_search_s(3) was freed could sometimes lead to a segmentation
fault because the local variable used was not initialized before use.
---
modules/lookup_ldap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- autofs-5.0.6.orig/modules/lookup_ldap.c
+++ autofs-5.0.6/modules/lookup_ldap.c
@@ -1521,7 +1521,7 @@ int lookup_read_master(struct master *ma
char buf[MAX_ERR_BUF];
char parse_buf[PARSE_MAX_BUF];
char *query;
- LDAPMessage *result, *e;
+ LDAPMessage *result = NULL, *e;
char *class, *info, *entry;
char **keyValue = NULL;
char **values = NULL;
@@ -2467,7 +2467,7 @@ static int lookup_one(struct autofs_poin
char buf[MAX_ERR_BUF];
time_t age = time(NULL);
char *query;
- LDAPMessage *result, *e;
+ LDAPMessage *result = NULL, *e;
char *class, *info, *entry;
char *enc_key1, *enc_key2;
int enc_len1 = 0, enc_len2 = 0;

View File

@ -1,40 +0,0 @@
autofs-5.0.6 - fix fix map source check in file lookup
From: Ian Kent <raven@themaw.net>
A recent change to correct a problem with included map entry removal
has broken a different case of included map key lookup. The check in
previous patch was too broad and caused map key lookup for keys in an
included multi-mount map entrys to not be found.
---
CHANGELOG | 1 +
modules/lookup_file.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index cb9ac75..304b6a2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -11,6 +11,7 @@
- add "dir" map-type.
- fix wait for master source mutex.
- fix submount shutdown race.
+- fix fix map source check in file lookup.
28/06/2011 autofs-5.0.6
-----------------------
diff --git a/modules/lookup_file.c b/modules/lookup_file.c
index 8ead07c..63b5ae7 100644
--- a/modules/lookup_file.c
+++ b/modules/lookup_file.c
@@ -1046,7 +1046,7 @@ do_cache_lookup:
* instance (same map entry cache), not in a distinct source.
*/
if (me && (!me->mapent ||
- (ap->type == LKP_INDIRECT && me->source != source))) {
+ (me->source != source && *me->key != '/'))) {
while ((me = cache_lookup_key_next(me)))
if (me->source == source)
break;

View File

@ -1,28 +0,0 @@
autofs-5.0.6 - fix fix wait for master source mutex
From: Ian Kent <raven@themaw.net>
The "wait for master source mutex" change wait for a busy read/write
mutex to become available instead of failing. The s390x architecture
is slower than the Intel architectures and the time allowed to wait
can be too short leading to a failure anyway.
This patch increases the maximum wait from 1 second to 5 seconds to
avoid false positive fails.
---
lib/master.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- autofs-5.0.6.orig/lib/master.c
+++ autofs-5.0.6/lib/master.c
@@ -552,7 +552,7 @@ void master_source_writelock(struct mast
void master_source_readlock(struct master_mapent *entry)
{
- int retries = 5; /* 1 second maximum */
+ int retries = 25; /* 5 second maximum */
int status;
while (retries--) {

View File

@ -1,52 +0,0 @@
autofs-5.0.6 - fix function to check mount.nfs version
From: Leonardo Chiquitto <leonardo.lists@gmail.com>
The function check_nfs_mount_version() compares the version
of mount.nfs to decide whether a feature is available or not.
There's a bug in the version comparison code that causes
1.3.0 to be considered less than 1.1.1. This patch fixes it.
---
CHANGELOG | 1 +
lib/mounts.c | 17 +++++------------
2 files changed, 6 insertions(+), 12 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -31,6 +31,7 @@
- catch EHOSTUNREACH and bail out early.
- systemd support fixes.
- check scandir() return value.
+- fix function to check mount.nfs version.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/lib/mounts.c
+++ autofs-5.0.6/lib/mounts.c
@@ -249,18 +249,11 @@ int check_nfs_mount_version(struct nfs_m
}
if (ret) {
- if (vers->major == check->major &&
- vers->minor == check->minor &&
- vers->fix == check->fix)
- ;
- else {
- if (vers->major < check->major)
- ret = 0;
- else if (vers->minor < check->minor)
- ret = 0;
- else if (vers->fix < check->fix)
- ret = 0;
- }
+ if ((vers->major < check->major) ||
+ ((vers->major == check->major) && (vers->minor < check->minor)) ||
+ ((vers->major == check->major) && (vers->minor == check->minor) &&
+ (vers->fix < check->fix)))
+ ret = 0;
}
if (waitpid(f, &status, 0) != f) ;

View File

@ -1,35 +0,0 @@
autofs-5.0.6 - fix get_nfs_info() can incorrectly fail
From: Ian Kent <ikent@redhat.com>
In function get_nfs_info(), if both TCP and UDP protocols are being
checked, the TCP check passes but the UDP check fails, the function
will incorrectly return a fail to the caller.
---
CHANGELOG | 1 +
modules/replicated.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -59,6 +59,7 @@
- fix devce ioctl alloc path check.
- add hup signal handling to hosts map.
- fix systemd argument passing.
+- fix get_nfs_info() can incorrectly fail.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/modules/replicated.c
+++ autofs-5.0.6/modules/replicated.c
@@ -769,7 +769,7 @@ static int get_vers_and_cost(unsigned lo
supported = get_nfs_info(logopt, host,
&pm_info, &rpc_info, "udp", vers, options);
if (IS_ERR(supported)) {
- if (ERR(supported) == ETIMEDOUT)
+ if (!ret && ERR(supported) == ETIMEDOUT)
return ret;
} else if (supported) {
ret = 1;

View File

@ -1,49 +0,0 @@
autofs-5.0.6 - fix improve mount location error reporting
From: Ian Kent <raven@themaw.net>
The validate_location() function is meant to check for a small subset
of map location errors only but the "improve mount location error
reporting" patch inverted a logic test which has made the scope of
the test greater causing false positive fails. So add a check for
those special cases and return success instead.
---
CHANGELOG | 1 +
modules/parse_sun.c | 14 ++++++++++++++
2 files changed, 15 insertions(+)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -19,6 +19,7 @@
- add piddir to configure.
- add systemd unit support.
- remove empty command line arguments (passed by systemd).
+- fix improve mount location error reporting.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/modules/parse_sun.c
+++ autofs-5.0.6/modules/parse_sun.c
@@ -868,6 +868,20 @@ static int validate_location(unsigned in
* have ":", "[" and "]".
*/
if (!check_colon(ptr)) {
+ char *esc;
+ /*
+ * Don't forget cases where a colon is present but
+ * not followed by a "/" or, if there is no colon at
+ * all, we don't know if it is actually invalid since
+ * it may be a map name by itself, for example.
+ */
+ if (!strchr(ptr, ':') ||
+ ((esc = strchr(ptr, '\\')) && *(esc + 1) == ':') ||
+ !strncmp(ptr, "file:", 5) || !strncmp(ptr, "yp:", 3) ||
+ !strncmp(ptr, "nis:", 4) || !strncmp(ptr, "nisplus:", 8) ||
+ !strncmp(ptr, "ldap:", 5) || !strncmp(ptr, "ldaps:", 6) ||
+ !strncmp(ptr, "dir:", 4))
+ return 1;
error(logopt,
"expected colon delimeter not found in location %s",
loc);

View File

@ -1,70 +0,0 @@
autofs-5.0.6 - fix initialization in rpc create_client()
From: Ian Kent <ikent@redhat.com>
Sometimes the RPC function create_client() gets a non-null stack
variable passed in which can cause a SEGV. Fix it by initializing
the passed in variable.
---
CHANGELOG | 1 +
lib/rpc_subs.c | 11 ++++++++---
2 files changed, 9 insertions(+), 3 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -40,6 +40,7 @@
- fix sss wildcard match.
- fix dlopen() error handling in sss module.
- fix configure string length tests for sss library.
+- fix initialization in rpc create_client().
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/lib/rpc_subs.c
+++ autofs-5.0.6/lib/rpc_subs.c
@@ -316,6 +316,7 @@ static int create_client(struct conn_inf
int fd, ret;
fd = RPC_ANYSOCK;
+ *client = NULL;
if (info->client) {
if (!clnt_control(info->client, CLGET_FD, (char *) &fd)) {
@@ -344,7 +345,10 @@ static int create_client(struct conn_inf
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_ADDRCONFIG;
hints.ai_family = AF_UNSPEC;
- hints.ai_socktype = SOCK_DGRAM;
+ if (info->proto->p_proto == IPPROTO_UDP)
+ hints.ai_socktype = SOCK_DGRAM;
+ else
+ hints.ai_socktype = SOCK_STREAM;
ret = getaddrinfo(info->host, NULL, &hints, &ai);
if (ret) {
@@ -377,12 +381,13 @@ static int create_client(struct conn_inf
freeaddrinfo(ai);
+done:
if (!*client) {
info->client = NULL;
ret = -ENOTCONN;
goto out_close;
}
-done:
+
/* Close socket fd on destroy, as is default for rpcowned fds */
if (!clnt_control(*client, CLSET_FD_CLOSE, NULL)) {
clnt_destroy(*client);
@@ -800,7 +805,7 @@ static int rpc_get_exports_proto(struct
(xdrproc_t) xdr_void, NULL,
(xdrproc_t) xdr_exports, (caddr_t) exp,
info->timeout);
- if (status != RPC_PROGVERSMISMATCH)
+ if (status == RPC_SUCCESS)
break;
if (++vers_entry > 2)
break;

View File

@ -1,185 +0,0 @@
autofs-5.0.6 - fix ipv6 configure check
From: Ian Kent <ikent@redhat.com>
Since the functions clntudp6_bufcreate() and clnttcp6_create() of
libtirpc were never actually included in the library our reference
to clntudp6_bufcreate() in configure needs to be removed.
Having redone the libtirpc interface (after realizing these functions
were defined but not actually included in the library) checking for
IPv6 support can't be done now and we need to rely on the transport
independent nature of libtirpc to take care of this. So the INET6
checks have been replaced with WITH_LIBTIRPC checks instead.
---
CHANGELOG | 1 +
aclocal.m4 | 36 ------------------------------------
configure | 46 ----------------------------------------------
include/config.h.in | 3 ---
modules/replicated.c | 10 +++++++---
5 files changed, 8 insertions(+), 88 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -15,6 +15,7 @@
- add disable move mount configure option.
- fix ipv6 name lookup check.
- fix ipv6 rpc calls.
+- fix ipv6 configure check.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/aclocal.m4
+++ autofs-5.0.6/aclocal.m4
@@ -324,41 +324,6 @@ LIBS="$af_check_ldap_parse_page_control_
])
dnl --------------------------------------------------------------------------
-dnl AF_CHECK_LIBTIRPC_IPV6
-dnl
-dnl Use libtirpc for rpc transport
-dnl --------------------------------------------------------------------------
-AC_DEFUN([AF_CHECK_LIBTIRPC_IPV6],
-[AC_MSG_CHECKING(if libtirpc has IPv6 support)
-
-# save current flags
-af_check_libtirpc_ipv6_save_cflags="$CFLAGS"
-af_check_libtirpc_ipv6_save_ldflags="$LDFLAGS"
-CFLAGS="$CFLAGS -I/usr/include/tirpc"
-LDFLAGS="$LDFLAGS -ltirpc"
-
-AC_TRY_LINK(
- [ #define INET6
- #include <rpc/rpc.h> ],
- [ CLIENT *cl;
- struct sockaddr_in6 addr;
- int fd;
- unsigned long ul; struct timeval t; unsigned int ui;
- cl = clntudp6_bufcreate(&addr,ul,ul,t,&fd,ui,ui); ],
- [ af_have_libtirpc_ipv6=yes
- AC_MSG_RESULT(yes) ],
- [ AC_MSG_RESULT(no) ])
-
-if test "$af_have_libtirpc_ipv6" = "yes"; then
- AC_DEFINE(INET6,1, [Use IPv6 with libtirpc])
-fi
-
-# restore flags
-CFLAGS="$af_check_libtirpc_ipv6_save_cflags"
-LDFLAGS="$af_check_libtirpc_ipv6_save_ldflags"
-])
-
-dnl --------------------------------------------------------------------------
dnl AF_CHECK_LIBTIRPC
dnl
dnl Use libtirpc for rpc transport
@@ -399,7 +364,6 @@ AC_ARG_WITH(libtirpc,
[ --with-libtirpc use libtirpc if available],
[if test "$withval" = yes; then
AF_CHECK_LIBTIRPC()
- AF_CHECK_LIBTIRPC_IPV6()
else
AC_MSG_RESULT(no)
fi], [AC_MSG_RESULT(no)])
--- autofs-5.0.6.orig/configure
+++ autofs-5.0.6/configure
@@ -3087,52 +3087,6 @@ fi
CFLAGS="$af_check_libtirpc_save_cflags"
LDFLAGS="$af_check_libtirpc_save_ldflags"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtirpc has IPv6 support" >&5
-$as_echo_n "checking if libtirpc has IPv6 support... " >&6; }
-
-# save current flags
-af_check_libtirpc_ipv6_save_cflags="$CFLAGS"
-af_check_libtirpc_ipv6_save_ldflags="$LDFLAGS"
-CFLAGS="$CFLAGS -I/usr/include/tirpc"
-LDFLAGS="$LDFLAGS -ltirpc"
-
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
- #define INET6
- #include <rpc/rpc.h>
-int
-main ()
-{
- CLIENT *cl;
- struct sockaddr_in6 addr;
- int fd;
- unsigned long ul; struct timeval t; unsigned int ui;
- cl = clntudp6_bufcreate(&addr,ul,ul,t,&fd,ui,ui);
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- af_have_libtirpc_ipv6=yes
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-
-if test "$af_have_libtirpc_ipv6" = "yes"; then
-
-$as_echo "#define INET6 1" >>confdefs.h
-
-fi
-
-# restore flags
-CFLAGS="$af_check_libtirpc_ipv6_save_cflags"
-LDFLAGS="$af_check_libtirpc_ipv6_save_ldflags"
-
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
--- autofs-5.0.6.orig/include/config.h.in
+++ autofs-5.0.6/include/config.h.in
@@ -72,9 +72,6 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
-/* Use IPv6 with libtirpc */
-#undef INET6
-
/* Use libxml2 tsd usage workaround */
#undef LIBXML2_WORKAROUND
--- autofs-5.0.6.orig/modules/replicated.c
+++ autofs-5.0.6/modules/replicated.c
@@ -180,7 +180,7 @@ static unsigned int get_proximity(struct
break;
case AF_INET6:
-#ifndef INET6
+#ifndef WITH_LIBTIRPC
return PROXIMITY_UNSUPPORTED;
#else
addr6 = (struct sockaddr_in6 *) host_addr;
@@ -229,7 +229,9 @@ static unsigned int get_proximity(struct
break;
case AF_INET6:
-#ifdef INET6
+#ifndef WITH_LIBTIRPC
+ return PROXIMITY_UNSUPPORTED;
+#else
if (host_addr->sa_family == AF_INET)
break;
@@ -309,7 +311,9 @@ static unsigned int get_proximity(struct
break;
case AF_INET6:
-#ifdef INET6
+#ifndef WITH_LIBTIRPC
+ return PROXIMITY_UNSUPPORTED;
+#else
if (host_addr->sa_family == AF_INET)
break;

View File

@ -1,79 +0,0 @@
autofs-5.0.6 - fix ipv6 name for lookup fix
From: Ian Kent <ikent@redhat.com>
Fix an error in the recent ipv6 name for lookup patch.
Reported by Leonardo Chiquitto who provided a patch to resolve the
problem. The patch below is a slightly modified version of his patch.
---
CHANGELOG | 4 ++++
modules/replicated.c | 13 ++++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 849a38c..e5dfa83 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+??/??/20?? autofs-5.0.7
+=======================
+- fix ipv6 name for lookup fix.
+
28/06/2011 autofs-5.0.6
-----------------------
- fix included map read fail handling.
diff --git a/modules/replicated.c b/modules/replicated.c
index 7f2b892..a10a817 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -1111,7 +1111,8 @@ static int add_host_addrs(struct host **list, const char *host,
unsigned int weight, unsigned int options)
{
struct addrinfo hints, *ni, *this;
- char *name = strdup(host);
+ char *n_ptr;
+ char *name = n_ptr = strdup(host);
int len;
char buf[MAX_ERR_BUF];
int rr = 0;
@@ -1125,15 +1126,17 @@ static int add_host_addrs(struct host **list, const char *host,
}
len = strlen(name);
- if (name[0] == '[' && name[--len] == ']')
+ if (name[0] == '[' && name[--len] == ']') {
name[len] = '\0';
+ name++;
+ }
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_NUMERICHOST;
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_DGRAM;
- ret = getaddrinfo(name + 1, NULL, &hints, &ni);
+ ret = getaddrinfo(name, NULL, &hints, &ni);
if (ret)
goto try_name;
@@ -1153,7 +1156,7 @@ try_name:
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_DGRAM;
- ret = getaddrinfo(name + 1, NULL, &hints, &ni);
+ ret = getaddrinfo(name, NULL, &hints, &ni);
if (ret) {
error(LOGOPT_ANY, "hostname lookup failed: %s",
gai_strerror(ret));
@@ -1172,7 +1175,7 @@ try_name:
}
freeaddrinfo(ni);
done:
- free(name);
+ free(n_ptr);
return ret;
}

View File

@ -1,63 +0,0 @@
autofs-5.0.6 - fix ipv6 name lookup check
From: Ian Kent <raven@themaw.net>
The host address must be used when the host name has multiple
addresses since we need to mount the specific host and so that
it is known what host log entries refer to.
But the check for multiple addresses can be wrong because there
is no distinction between ipv4 and ipv6 addresses. Change the
check to use the host name when mounting if neither the ipv4
or the ipv6 addresses have more than one record.
---
CHANGELOG | 1 +
modules/replicated.c | 17 +++++++++++++++--
2 files changed, 16 insertions(+), 2 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -13,6 +13,7 @@
- fix submount shutdown race.
- fix fix map source check in file lookup.
- add disable move mount configure option.
+- fix ipv6 name lookup check.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/modules/replicated.c
+++ autofs-5.0.6/modules/replicated.c
@@ -1117,7 +1117,7 @@ static int add_host_addrs(struct host **
char *name = n_ptr = strdup(host);
int len;
char buf[MAX_ERR_BUF];
- int rr = 0;
+ int rr = 0, rr4 = 0, rr6 = 0;
int ret;
if (!name) {
@@ -1167,8 +1167,21 @@ try_name:
}
this = ni;
- if (this->ai_next)
+ while (this->ai_next) {
+ if (this->ai_family == AF_INET) {
+ struct sockaddr_in *addr = (struct sockaddr_in *) this->ai_addr;
+ if (addr->sin_addr.s_addr != INADDR_LOOPBACK)
+ rr4++;
+ } else if (this->ai_family == AF_INET6) {
+ struct sockaddr_in6 *addr = (struct sockaddr_in6 *) this->ai_addr;
+ if (!IN6_IS_ADDR_LOOPBACK(addr->sin6_addr.__in6_u.__u6_addr32))
+ rr6++;
+ }
+ this = this->ai_next;
+ }
+ if (rr4 > 1 || rr6 > 1)
rr++;
+ this = ni;
while (this) {
ret = add_new_host(list, host, weight, this, rr, options);
if (!ret)

View File

@ -1,531 +0,0 @@
autofs-5.0.6 - fix ipv6 rpc calls
From: Ian Kent <ikent@redhat.com>
There is a mistake in the way autofs uses libtirpc. Two IPv6 compatibiliy
functions were thought to be included when in fact they were not and would
not actually work with IPv6 anyway.
To fix that the libtirpc interface code needed to be re-written. Portmap
(using libtirpc calls) is still used to get service port numbers, rather
than rpcbind.
---
CHANGELOG | 1
lib/rpc_subs.c | 370 ++++++++++++++++++++-------------------------------
modules/replicated.c | 8 -
3 files changed, 155 insertions(+), 224 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -14,6 +14,7 @@
- fix fix map source check in file lookup.
- add disable move mount configure option.
- fix ipv6 name lookup check.
+- fix ipv6 rpc calls.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/lib/rpc_subs.c
+++ autofs-5.0.6/lib/rpc_subs.c
@@ -62,89 +62,6 @@ static const rpcvers_t mount_vers[] = {
static int connect_nb(int, struct sockaddr *, socklen_t, struct timeval *);
inline void dump_core(void);
-static CLIENT *rpc_clntudp_create(struct sockaddr *addr, struct conn_info *info, int *fd)
-{
- struct sockaddr_in *in4_raddr;
- struct sockaddr_in6 *in6_raddr;
- CLIENT *client = NULL;
-
- switch (addr->sa_family) {
- case AF_INET:
- in4_raddr = (struct sockaddr_in *) addr;
- in4_raddr->sin_port = htons(info->port);
- client = clntudp_bufcreate(in4_raddr,
- info->program, info->version,
- info->timeout, fd,
- info->send_sz, info->recv_sz);
- break;
-
- case AF_INET6:
-#ifndef INET6
- /* Quiet compile warning */
- in6_raddr = NULL;
-#else
- in6_raddr = (struct sockaddr_in6 *) addr;
- in6_raddr->sin6_port = htons(info->port);
- client = clntudp6_bufcreate(in6_raddr,
- info->program, info->version,
- info->timeout, fd,
- info->send_sz, info->recv_sz);
-#endif
- break;
-
- default:
- break;
- }
-
- return client;
-}
-
-static CLIENT *rpc_clnttcp_create(struct sockaddr *addr, struct conn_info *info, int *fd)
-{
- struct sockaddr_in *in4_raddr;
- struct sockaddr_in6 *in6_raddr;
- CLIENT *client = NULL;
- socklen_t slen;
-
- switch (addr->sa_family) {
- case AF_INET:
- in4_raddr = (struct sockaddr_in *) addr;
- in4_raddr->sin_port = htons(info->port);
- slen = sizeof(struct sockaddr_in);
-
- if (connect_nb(*fd, addr, slen, &info->timeout) < 0)
- break;
-
- client = clnttcp_create(in4_raddr,
- info->program, info->version, fd,
- info->send_sz, info->recv_sz);
- break;
-
- case AF_INET6:
-#ifndef INET6
- /* Quiet compile warning */
- in6_raddr = NULL;
-#else
- in6_raddr = (struct sockaddr_in6 *) addr;
- in6_raddr->sin6_port = htons(info->port);
- slen = sizeof(struct sockaddr_in6);
-
- if (connect_nb(*fd, addr, slen, &info->timeout) < 0)
- break;
-
- client = clnttcp6_create(in6_raddr,
- info->program, info->version, fd,
- info->send_sz, info->recv_sz);
-#endif
- break;
-
- default:
- break;
- }
-
- return client;
-}
-
/*
* Perform a non-blocking connect on the socket fd.
*
@@ -232,12 +149,12 @@ done:
return ret;
}
+#ifndef WITH_LIBTIRPC
static CLIENT *rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, int *fd)
{
CLIENT *client = NULL;
- struct sockaddr *laddr;
struct sockaddr_in in4_laddr;
- struct sockaddr_in6 in6_laddr;
+ struct sockaddr_in in4_raddr;
int type, proto;
socklen_t slen;
@@ -252,48 +169,41 @@ static CLIENT *rpc_do_create_client(stru
* layer, it would bind to a reserved port, which has been shown
* to exhaust the reserved port range in some situations.
*/
- switch (addr->sa_family) {
- case AF_INET:
- in4_laddr.sin_family = AF_INET;
- in4_laddr.sin_port = htons(0);
- in4_laddr.sin_addr.s_addr = htonl(INADDR_ANY);
- slen = sizeof(struct sockaddr_in);
- laddr = (struct sockaddr *) &in4_laddr;
- break;
-
- case AF_INET6:
-#ifndef INET6
- /* Quiet compiler */
- in6_laddr.sin6_family = AF_INET6;
- return NULL;
-#else
- in6_laddr.sin6_family = AF_INET6;
- in6_laddr.sin6_port = htons(0);
- in6_laddr.sin6_addr = in6addr_any;
- slen = sizeof(struct sockaddr_in6);
- laddr = (struct sockaddr *) &in6_laddr;
- break;
-#endif
- default:
- return NULL;
- }
+ in4_laddr.sin_family = AF_INET;
+ in4_laddr.sin_port = htons(0);
+ in4_laddr.sin_addr.s_addr = htonl(INADDR_ANY);
+ slen = sizeof(struct sockaddr_in);
if (!info->client) {
+ struct sockaddr *laddr;
+
*fd = open_sock(addr->sa_family, type, proto);
if (*fd < 0)
return NULL;
+ laddr = (struct sockaddr *) &in4_laddr;
if (bind(*fd, laddr, slen) < 0)
return NULL;
}
+ in4_raddr = (struct sockaddr_in *) addr;
+ in4_raddr->sin_port = htons(info->port);
+
switch (info->proto->p_proto) {
case IPPROTO_UDP:
- client = rpc_clntudp_create(addr, info, fd);
+ client = clntudp_bufcreate(in4_raddr,
+ info->program, info->version,
+ info->timeout, fd,
+ info->send_sz, info->recv_sz);
break;
case IPPROTO_TCP:
- client = rpc_clnttcp_create(addr, info, fd);
+ if (connect_nb(*fd, addr, slen, &info->timeout) < 0)
+ break;
+
+ client = clnttcp_create(in4_raddr,
+ info->program, info->version, fd,
+ info->send_sz, info->recv_sz);
break;
default:
@@ -302,20 +212,126 @@ static CLIENT *rpc_do_create_client(stru
return client;
}
+#else
+struct netconfig *find_netconf(void *handle, char *family, char *proto)
+{
+ struct netconfig *nconf;
+
+ while ((nconf = getnetconfig(handle))) {
+ if ((strcmp(nconf->nc_protofmly, family) == 0) &&
+ (strcmp(nconf->nc_proto, proto) == 0))
+ break;
+ }
+
+ return nconf;
+}
+
+static CLIENT *rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, int *fd)
+{
+ CLIENT *client = NULL;
+ struct sockaddr_in in4_laddr;
+ struct sockaddr_in6 in6_laddr;
+ struct sockaddr *laddr = NULL;
+ struct netconfig *nconf;
+ struct netbuf nb_addr;
+ int type, proto;
+ char *nc_family, *nc_proto;
+ void *handle;
+ size_t slen;
+
+ proto = info->proto->p_proto;
+ if (proto == IPPROTO_UDP) {
+ type = SOCK_DGRAM;
+ nc_proto = NC_UDP;
+ } else {
+ type = SOCK_STREAM;
+ nc_proto = NC_TCP;
+ }
+
+ /*
+ * bind to any unused port. If we left this up to the rpc
+ * layer, it would bind to a reserved port, which has been shown
+ * to exhaust the reserved port range in some situations.
+ */
+ if (addr->sa_family == AF_INET) {
+ struct sockaddr_in *in4_raddr = (struct sockaddr_in *) addr;
+ in4_laddr.sin_family = AF_INET;
+ in4_laddr.sin_port = htons(0);
+ in4_laddr.sin_addr.s_addr = htonl(INADDR_ANY);
+ laddr = (struct sockaddr *) &in4_laddr;
+ in4_raddr->sin_port = htons(info->port);
+ slen = sizeof(struct sockaddr_in);
+ nc_family = NC_INET;
+ } else if (addr->sa_family == AF_INET6) {
+ struct sockaddr_in6 *in6_raddr = (struct sockaddr_in6 *) addr;
+ in6_laddr.sin6_family = AF_INET6;
+ in6_laddr.sin6_port = htons(0);
+ in6_laddr.sin6_addr = in6addr_any;
+ laddr = (struct sockaddr *) &in6_laddr;
+ in6_raddr->sin6_port = htons(info->port);
+ slen = sizeof(struct sockaddr_in6);
+ nc_family = NC_INET6;
+ } else
+ return NULL;
+
+ handle = setnetconfig();
+ if (!handle)
+ return NULL;
+
+ nconf = find_netconf(handle, nc_family, nc_proto);
+ if (!nconf) {
+ endnetconfig(handle);
+ return NULL;
+ }
+
+ /*
+ * bind to any unused port. If we left this up to the rpc layer,
+ * it would bind to a reserved port, which has been shown to
+ * exhaust the reserved port range in some situations.
+ */
+ if (!info->client) {
+ *fd = open_sock(addr->sa_family, type, proto);
+ if (*fd < 0) {
+ endnetconfig(handle);
+ return NULL;
+ }
+
+ if (bind(*fd, laddr, slen) < 0) {
+ endnetconfig(handle);
+ return NULL;
+ }
+ }
+
+ nb_addr.maxlen = nb_addr.len = slen;
+ nb_addr.buf = addr;
+
+ if (info->proto->p_proto == IPPROTO_TCP) {
+ if (connect_nb(*fd, addr, slen, &info->timeout) < 0) {
+ endnetconfig(handle);
+ return NULL;
+ }
+ }
+
+ client = clnt_tli_create(*fd, nconf, &nb_addr,
+ info->program, info->version,
+ info->send_sz, info->recv_sz);
+
+ endnetconfig(handle);
+
+ return client;
+}
+#endif
/*
- * Create a UDP RPC client
+ * Create an RPC client
*/
-static CLIENT *create_udp_client(struct conn_info *info)
+static CLIENT *create_client(struct conn_info *info)
{
CLIENT *client = NULL;
struct addrinfo *ai, *haddr;
struct addrinfo hints;
int fd, ret;
- if (info->proto->p_proto != IPPROTO_UDP)
- return NULL;
-
fd = RPC_ANYSOCK;
if (info->client) {
@@ -355,6 +371,11 @@ static CLIENT *create_udp_client(struct
haddr = ai;
while (haddr) {
+ if (haddr->ai_protocol != info->proto->p_proto) {
+ haddr = haddr->ai_next;
+ continue;
+ }
+
client = rpc_do_create_client(haddr->ai_addr, info, &fd);
if (client)
break;
@@ -408,7 +429,7 @@ int rpc_udp_getclient(struct conn_info *
info->program = program;
info->version = version;
- client = create_udp_client(info);
+ client = create_client(info);
if (!client)
return 0;
@@ -428,92 +449,6 @@ void rpc_destroy_udp_client(struct conn_
return;
}
-/*
- * Create a TCP RPC client using non-blocking connect
- */
-static CLIENT *create_tcp_client(struct conn_info *info)
-{
- CLIENT *client = NULL;
- struct addrinfo *ai, *haddr;
- struct addrinfo hints;
- int fd, ret;
-
- if (info->proto->p_proto != IPPROTO_TCP)
- return NULL;
-
- fd = RPC_ANYSOCK;
-
- if (info->client) {
- if (!clnt_control(info->client, CLGET_FD, (char *) &fd)) {
- fd = RPC_ANYSOCK;
- clnt_destroy(info->client);
- info->client = NULL;
- } else {
- clnt_control(info->client, CLSET_FD_NCLOSE, NULL);
- clnt_destroy(info->client);
- }
- }
-
- if (info->addr) {
- client = rpc_do_create_client(info->addr, info, &fd);
- if (client)
- goto done;
-
- if (!info->client) {
- close(fd);
- fd = RPC_ANYSOCK;
- }
- }
-
- memset(&hints, 0, sizeof(hints));
- hints.ai_flags = AI_ADDRCONFIG;
- hints.ai_family = AF_UNSPEC;
- hints.ai_socktype = SOCK_STREAM;
-
- ret = getaddrinfo(info->host, NULL, &hints, &ai);
- if (ret) {
- error(LOGOPT_ANY,
- "hostname lookup failed: %s", gai_strerror(ret));
- info->client = NULL;
- goto out_close;
- }
-
- haddr = ai;
- while (haddr) {
- client = rpc_do_create_client(haddr->ai_addr, info, &fd);
- if (client)
- break;
-
- if (!info->client && fd != RPC_ANYSOCK) {
- close(fd);
- fd = RPC_ANYSOCK;
- }
-
- haddr = haddr->ai_next;
- }
-
- freeaddrinfo(ai);
-
- if (!client) {
- info->client = NULL;
- goto out_close;
- }
-done:
- /* Close socket fd on destroy, as is default for rpcowned fds */
- if (!clnt_control(client, CLSET_FD_CLOSE, NULL)) {
- clnt_destroy(client);
- info->client = NULL;
- goto out_close;
- }
-
- return client;
-
-out_close:
- if (fd != -1)
- close(fd);
- return NULL;
-}
-
int rpc_tcp_getclient(struct conn_info *info,
unsigned int program, unsigned int version)
{
@@ -533,7 +468,7 @@ int rpc_tcp_getclient(struct conn_info *
info->program = program;
info->version = version;
- client = create_tcp_client(info);
+ client = create_client(info);
if (!client)
return 0;
@@ -593,12 +528,9 @@ int rpc_portmap_getclient(struct conn_in
info->close_option = option;
info->client = NULL;
- if (pe_proto->p_proto == IPPROTO_TCP) {
+ if (pe_proto->p_proto == IPPROTO_TCP)
info->timeout.tv_sec = PMAP_TOUT_TCP;
- client = create_tcp_client(info);
- } else
- client = create_udp_client(info);
-
+ client = create_client(info);
if (!client)
return 0;
@@ -635,11 +567,7 @@ unsigned short rpc_portmap_getport(struc
pmap_info.send_sz = RPCSMALLMSGSIZE;
pmap_info.recv_sz = RPCSMALLMSGSIZE;
- if (proto == IPPROTO_TCP)
- client = create_tcp_client(&pmap_info);
- else
- client = create_udp_client(&pmap_info);
-
+ client = create_client(&pmap_info);
if (!client)
return 0;
}
@@ -700,10 +628,8 @@ int rpc_ping_proto(struct conn_info *inf
if (info->proto->p_proto == IPPROTO_UDP) {
info->send_sz = UDPMSGSIZE;
info->recv_sz = UDPMSGSIZE;
- client = create_udp_client(info);
- } else
- client = create_tcp_client(info);
-
+ }
+ client = create_client(info);
if (!client)
return 0;
}
@@ -857,10 +783,8 @@ static int rpc_get_exports_proto(struct
if (info->proto->p_proto == IPPROTO_UDP) {
info->send_sz = UDPMSGSIZE;
info->recv_sz = UDPMSGSIZE;
- client = create_udp_client(info);
- } else
- client = create_tcp_client(info);
-
+ }
+ client = create_client(info);
if (!client)
return 0;
--- autofs-5.0.6.orig/modules/replicated.c
+++ autofs-5.0.6/modules/replicated.c
@@ -1095,7 +1095,13 @@ static int add_new_host(struct host **li
if (prx == PROXIMITY_ERROR)
return 0;
- addr_len = sizeof(struct sockaddr);
+ if (host_addr->ai_addr->sa_family == AF_INET)
+ addr_len = INET_ADDRSTRLEN;
+ else if (host_addr->ai_addr->sa_family == AF_INET6)
+ addr_len = INET6_ADDRSTRLEN;
+ else
+ return 0;
+
new = new_host(host, host_addr->ai_addr, addr_len, prx, weight, options);
if (!new)
return 0;

View File

@ -1,94 +0,0 @@
autofs-5.0.6 - fix kernel verion check of version components
From: Ian Kent <ikent@redhat.com>
Oops, not following the ball.
The kernel may have (or will have at times) a two digit version number.
Fix the version check function to allow for this.
---
CHANGELOG | 1 +
include/mounts.h | 15 +--------------
lib/mounts.c | 29 +++++++++++++++++++++++++++++
3 files changed, 31 insertions(+), 14 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -46,6 +46,7 @@
- duplicate parent options for included maps.
- update ->timeout() function to not return timeout.
- move timeout to map_source (allow per direct map timeout).
+- fix kernel verion check of version components.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/include/mounts.h
+++ autofs-5.0.6/include/mounts.h
@@ -75,26 +75,13 @@ struct mnt_list {
struct list_head ordered;
};
-static inline unsigned int linux_version_code(void)
-{
- struct utsname my_utsname;
- unsigned int p, q, r;
- char *save;
-
- if (uname(&my_utsname))
- return 0;
-
- p = (unsigned int) atoi(strtok_r(my_utsname.release, ".", &save));
- q = (unsigned int) atoi(strtok_r(NULL, ".", &save));
- r = (unsigned int) atoi(strtok_r(NULL, ".", &save));
- return KERNEL_VERSION(p, q, r);
-}
struct nfs_mount_vers {
unsigned int major;
unsigned int minor;
unsigned int fix;
};
+unsigned int linux_version_code(void);
int check_nfs_mount_version(struct nfs_mount_vers *, struct nfs_mount_vers *);
extern unsigned int nfs_mount_uses_string_options;
--- autofs-5.0.6.orig/lib/mounts.c
+++ autofs-5.0.6/lib/mounts.c
@@ -46,6 +46,35 @@ static const char mnt_name_template[]
static struct kernel_mod_version kver = {0, 0};
static const char kver_options_template[] = "fd=%d,pgrp=%u,minproto=3,maxproto=5";
+unsigned int linux_version_code(void)
+{
+ struct utsname my_utsname;
+ unsigned int p, q, r;
+ char *tmp, *save;
+
+ if (uname(&my_utsname))
+ return 0;
+
+ p = q = r = 0;
+
+ tmp = strtok_r(my_utsname.release, ".", &save);
+ if (!tmp)
+ return 0;
+ p = (unsigned int ) atoi(tmp);
+
+ tmp = strtok_r(NULL, ".", &save);
+ if (!tmp)
+ return KERNEL_VERSION(p, 0, 0);
+ q = (unsigned int) atoi(tmp);
+
+ tmp = strtok_r(NULL, ".", &save);
+ if (!tmp)
+ return KERNEL_VERSION(p, q, 0);
+ r = (unsigned int) atoi(tmp);
+
+ return KERNEL_VERSION(p, q, r);
+}
+
unsigned int query_kproto_ver(void)
{
struct ioctl_ops *ops = get_ioctl_ops();

View File

@ -1,45 +0,0 @@
autofs-5.0.6 - fix libtirpc name clash
From: Ian Kent <ikent@redhat.com>
The tirpc function auth_destroy() is a macro definition in tirpc/rpc/auth.h
which includes an unconditional call to a function log_debug() which clashes
with an autofs function of the same name and has a different call signature.
To fix it redefine auth_destroy() and exclude the debug log call.
---
CHANGELOG | 1 +
lib/rpc_subs.c | 10 ++++++++++
2 files changed, 11 insertions(+)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -41,6 +41,7 @@
- fix dlopen() error handling in sss module.
- fix configure string length tests for sss library.
- fix initialization in rpc create_client().
+- fix libtirpc name clash.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/lib/rpc_subs.c
+++ autofs-5.0.6/lib/rpc_subs.c
@@ -34,6 +34,16 @@
#include <pthread.h>
#include <poll.h>
+#ifdef WITH_LIBTIRPC
+#undef auth_destroy
+#define auth_destroy(auth) \
+ do { \
+ int refs; \
+ if ((refs = auth_put((auth))) == 0) \
+ ((*((auth)->ah_ops->ah_destroy))(auth));\
+ } while (0)
+#endif
+
#include "mount.h"
#include "rpc_subs.h"
#include "automount.h"

View File

@ -1,45 +0,0 @@
autofs-5.0.6 - fix lsb service name in init script 2
From: Ian Kent <raven@themaw.net>
The "Required-Start:" and "Required-Stop:" in the init script header
incorrectly uses $ypbind instead of ypbind. This isn't correct as
using names starting with a $ is reserved for standards-defined
facilities.
---
redhat/autofs.init.in | 4 ++--
samples/rc.autofs.in | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/redhat/autofs.init.in b/redhat/autofs.init.in
index 86b7eb4..48d387d 100644
--- a/redhat/autofs.init.in
+++ b/redhat/autofs.init.in
@@ -9,8 +9,8 @@
#
### BEGIN INIT INFO
# Provides: autofs
-# Required-Start: $network $ypbind
-# Required-Stop: $network $ypbind
+# Required-Start: $network ypbind
+# Required-Stop: $network ypbind
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: Automounts filesystems on demand
diff --git a/samples/rc.autofs.in b/samples/rc.autofs.in
index 0306ef6..35667ba 100644
--- a/samples/rc.autofs.in
+++ b/samples/rc.autofs.in
@@ -8,8 +8,8 @@
#
### BEGIN INIT INFO
# Provides: autofs
-# Required-Start: $network $ypbind
-# Required-Stop: $network $ypbind
+# Required-Start: $network ypbind
+# Required-Stop: $network ypbind
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: Automounts filesystems on demand

View File

@ -1,52 +0,0 @@
autofs-5.0.6 - fix nfs4 contacts portmap
From: Ian Kent <ikent@redhat.com>
When an fstype of nfs4 is specified probing the server for availability
should not need to contact the portmapper, it should use either the port
specified by the port= option or use port 2049.
However, in function modules/replicated.c:get_nfs_info() a check for the
port= option, and subsequent portmap lookup when not it's not present, is
done before the check for whether nfsv3 is to be checked at all.
Oops!
---
CHANGELOG | 1 +
modules/replicated.c | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -49,6 +49,7 @@
- fix kernel verion check of version components.
- dont retry ldap connect if not required.
- check if /etc/mtab is a link to /proc/self/mounts.
+- fix nfs4 contacts portmap.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/modules/replicated.c
+++ autofs-5.0.6/modules/replicated.c
@@ -589,6 +589,9 @@ static unsigned int get_nfs_info(unsigne
}
v3_ver:
+ if (!(version & NFS3_REQUESTED))
+ goto v2_ver;
+
if (!have_port_opt) {
status = rpc_portmap_getclient(pm_info,
host->name, host->addr, host->addr_len,
@@ -600,9 +603,6 @@ v3_ver:
goto done_ver;
}
- if (!(version & NFS3_REQUESTED))
- goto v2_ver;
-
if (have_port_opt) {
if (!(rpc_info->port = get_port_option(options)))
goto done_ver;

View File

@ -1,56 +0,0 @@
autofs-5.0.6 - fix not bind mounting local filesystem
From: Ian Kent <ikent@redhat.com>
When the --random-multimount-selection (-r) option is used automount(8)
won't bind mount a local filesystem. If the filesystem that has been
requested is local it should always be used.
---
CHANGELOG | 1 +
modules/replicated.c | 12 +++++++-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index acc5f0c..7e86c84 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,7 @@
- fix result null check in read_one_map().
- fix LDAP result leaks on error paths.
- code analysis fixes part 1.
+- fix not bind mounting local filesystem.
28/06/2011 autofs-5.0.6
-----------------------
diff --git a/modules/replicated.c b/modules/replicated.c
index a10a817..eee1a06 100644
--- a/modules/replicated.c
+++ b/modules/replicated.c
@@ -1068,18 +1068,20 @@ static int add_new_host(struct host **list,
* We can't use PROXIMITY_LOCAL or we won't perform an RPC ping
* to remove hosts that may be down.
*/
- if (options & MOUNT_FLAG_RANDOM_SELECT)
+ if (!host_addr)
prx = PROXIMITY_SUBNET;
else {
prx = get_proximity(host_addr->ai_addr);
/*
* If we want the weight to be the determining factor
- * when selecting a host then all hosts must have the
- * same proximity. However, if this is the local machine
- * it should always be used since it is certainly available.
+ * when selecting a host, or we are using random selection,
+ * then all hosts must have the same proximity. However,
+ * if this is the local machine it should always be used
+ * since it is certainly available.
*/
if (prx != PROXIMITY_LOCAL &&
- (options & MOUNT_FLAG_USE_WEIGHT_ONLY))
+ (options & (MOUNT_FLAG_USE_WEIGHT_ONLY |
+ MOUNT_FLAG_RANDOM_SELECT)))
prx = PROXIMITY_SUBNET;
}

View File

@ -1,88 +0,0 @@
autofs-5.0.6 - fix offset dir removal
From: Ian Kent <ikent@redhat.com>
When removing autofs multi-mount directories (which usually means the
top level tree where no mount is present at the base) at expire we
need to take care not to remove the top directory of the tree if the
origin map is an indirect mount that has the browse option set.
---
lib/mounts.c | 43 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 41 insertions(+), 2 deletions(-)
--- autofs-5.0.6.orig/lib/mounts.c
+++ autofs-5.0.6/lib/mounts.c
@@ -1687,6 +1687,41 @@ cont:
return mounted;
}
+static int rmdir_path_offset(struct autofs_point *ap, struct mapent *oe)
+{
+ char *dir, *path;
+ unsigned int split;
+ int ret;
+
+ if (ap->type == LKP_DIRECT)
+ return rmdir_path(ap, oe->key, oe->multi->dev);
+
+ dir = strdup(oe->key);
+
+ if (ap->flags & MOUNT_FLAG_GHOST)
+ split = strlen(ap->path) + strlen(oe->multi->key) + 1;
+ else
+ split = strlen(ap->path);
+
+ dir[split] = '\0';
+ path = &dir[split + 1];
+
+ if (chdir(dir) == -1) {
+ error(ap->logopt, "failed to chdir to %s", dir);
+ free(dir);
+ return -1;
+ }
+
+ ret = rmdir_path(ap, path, ap->dev);
+
+ free(dir);
+
+ if (chdir("/") == -1)
+ error(ap->logopt, "failed to chdir to /");
+
+ return ret;
+}
+
int umount_multi_triggers(struct autofs_point *ap, struct mapent *me, char *root, const char *base)
{
char path[PATH_MAX + 1];
@@ -1748,11 +1783,13 @@ int umount_multi_triggers(struct autofs_
* ok so only try and remount the offset if the
* actual mount point still exists.
*/
- ret = rmdir_path(ap, oe->key, ap->dev);
+ ret = rmdir_path_offset(ap, oe);
if (ret == -1 && !stat(oe->key, &st)) {
ret = do_mount_autofs_offset(ap, oe, root, offset);
if (ret)
left++;
+ /* But we did origianlly create this */
+ oe->flags |= MOUNT_FLAG_DIR_CREATED;
}
}
}
@@ -1914,11 +1951,13 @@ int clean_stale_multi_triggers(struct au
* ok so only try and remount the offset if the
* actual mount point still exists.
*/
- ret = rmdir_path(ap, oe->key, ap->dev);
+ ret = rmdir_path_offset(ap, oe);
if (ret == -1 && !stat(oe->key, &st)) {
ret = do_mount_autofs_offset(ap, oe, root, offset);
if (ret) {
left++;
+ /* But we did origianlly create this */
+ oe->flags |= MOUNT_FLAG_DIR_CREATED;
free(key);
continue;
}

View File

@ -1,167 +0,0 @@
autofs-5.0.6 - fix offset mount point directory removal
From: Ian Kent <ikent@redhat.com>
Attempting to remove the last component of a multi-mount offset mount
point is incorrect. The removal and attempted recovery is better
handled in the calling function.
---
CHANGELOG | 1
daemon/direct.c | 7 ----
lib/mounts.c | 82 ++++++++++++++++++++++++++++++++------------------------
3 files changed, 49 insertions(+), 41 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -54,6 +54,7 @@
- fix sss map age not updated.
- fix remount deadlock.
- fix umount recovery of busy direct mount.
+- fix offset mount point directory removal.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/daemon/direct.c
+++ autofs-5.0.6/daemon/direct.c
@@ -633,13 +633,6 @@ force_umount:
} else
info(ap->logopt, "umounted offset mount %s", me->key);
- if (!rv && me->flags & MOUNT_FLAG_DIR_CREATED) {
- if (rmdir(me->key) == -1) {
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
- warn(ap->logopt, "failed to remove dir %s: %s",
- me->key, estr);
- }
- }
return rv;
}
--- autofs-5.0.6.orig/lib/mounts.c
+++ autofs-5.0.6/lib/mounts.c
@@ -1605,6 +1605,33 @@ int umount_ent(struct autofs_point *ap,
return rv;
}
+static int do_mount_autofs_offset(struct autofs_point *ap,
+ struct mapent *oe, const char *root,
+ char *offset)
+
+{
+ int mounted = 0;
+ int ret;
+
+ debug(ap->logopt, "mount offset %s at %s", oe->key, root);
+
+ ret = mount_autofs_offset(ap, oe, root, offset);
+ if (ret >= MOUNT_OFFSET_OK)
+ mounted++;
+ else {
+ if (ret != MOUNT_OFFSET_IGNORE)
+ warn(ap->logopt, "failed to mount offset");
+ else {
+ debug(ap->logopt, "ignoring \"nohide\" trigger %s",
+ oe->key);
+ free(oe->mapent);
+ oe->mapent = NULL;
+ }
+ }
+
+ return mounted;
+}
+
int mount_multi_triggers(struct autofs_point *ap, struct mapent *me,
const char *root, unsigned int start, const char *base)
{
@@ -1613,8 +1640,7 @@ int mount_multi_triggers(struct autofs_p
struct mapent *oe;
struct list_head *pos = NULL;
unsigned int fs_path_len;
- unsigned int mounted;
- int ret;
+ int mounted;
fs_path_len = start + strlen(base);
if (fs_path_len > PATH_MAX)
@@ -1634,22 +1660,7 @@ int mount_multi_triggers(struct autofs_p
if (!oe || !oe->mapent)
goto cont;
- debug(ap->logopt, "mount offset %s at %s", oe->key, root);
-
- ret = mount_autofs_offset(ap, oe, root, offset);
- if (ret >= MOUNT_OFFSET_OK)
- mounted++;
- else {
- if (ret != MOUNT_OFFSET_IGNORE)
- warn(ap->logopt, "failed to mount offset");
- else {
- debug(ap->logopt,
- "ignoring \"nohide\" trigger %s",
- oe->key);
- free(oe->mapent);
- oe->mapent = NULL;
- }
- }
+ mounted += do_mount_autofs_offset(ap, oe, root, offset);
cont:
offset = cache_get_offset(base,
offset, start, &me->multi_list, &pos);
@@ -1681,7 +1692,6 @@ int umount_multi_triggers(struct autofs_
pos = NULL;
offset = path;
- /* Make sure "none" of the offsets have an active mount. */
while ((offset = cache_get_offset(mm_base, offset, start, mm_root, &pos))) {
char *oe_base;
@@ -1700,28 +1710,32 @@ int umount_multi_triggers(struct autofs_
if (oe->ioctlfd != -1 ||
is_mounted(_PROC_MOUNTS, oe->key, MNTS_REAL)) {
left++;
- break;
- }
- }
-
- if (left)
- return left;
-
- pos = NULL;
- offset = path;
-
- /* Make sure "none" of the offsets have an active mount. */
- while ((offset = cache_get_offset(mm_base, offset, start, mm_root, &pos))) {
- oe = cache_lookup_offset(mm_base, offset, start, &me->multi_list);
- /* root offset is a special case */
- if (!oe || !oe->mapent || (strlen(oe->key) - start) == 1)
continue;
+ }
debug(ap->logopt, "umount offset %s", oe->key);
if (umount_autofs_offset(ap, oe)) {
warn(ap->logopt, "failed to umount offset");
left++;
+ } else {
+ struct stat st;
+ int ret;
+
+ if (!(oe->flags & MOUNT_FLAG_DIR_CREATED))
+ continue;
+
+ /*
+ * An error due to partial directory removal is
+ * ok so only try and remount the offset if the
+ * actual mount point still exists.
+ */
+ ret = rmdir_path(ap, oe->key, ap->dev);
+ if (ret == -1 && !stat(oe->key, &st)) {
+ ret = do_mount_autofs_offset(ap, oe, root, offset);
+ if (ret)
+ left++;
+ }
}
}

View File

@ -1,87 +0,0 @@
autofs-5.0.6 - fix paged query more results check
From: Ian Kent <raven@themaw.net>
When getting paged results from an LDAP server the server returns an
opaque cookie (of type berval) that is used to retrieve the next page.
The criteria for deciding if there are more pages is that the berval
value is non-null and has a non-zero length.
To determine if the berval value has non-zero length autofs checks the
strlen() of the value but on ppc64 and s390x this can return 0 even if
the value has non-zero length causing a premature termination of the
query.
Fix this by also checking the berval length field.
Also make sure we free the opaque cookie when the query is finished.
---
CHANGELOG | 1 +
modules/lookup_ldap.c | 13 ++++++++++++-
2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index a178b74..884a9ae 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,7 @@
=======================
- fix ipv6 name for lookup fix.
- improve mount location error reporting.
+- fix paged query more results check.
28/06/2011 autofs-5.0.6
-----------------------
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
index 719fed1..a25050a 100644
--- a/modules/lookup_ldap.c
+++ b/modules/lookup_ldap.c
@@ -2041,7 +2041,8 @@ do_paged:
rv = ldap_parse_page_control(sp->ldap,
returnedControls, &sp->totalCount,
&sp->cookie);
- if (sp->cookie && sp->cookie->bv_val && strlen(sp->cookie->bv_val))
+ if (sp->cookie && sp->cookie->bv_val &&
+ (strlen(sp->cookie->bv_val) || sp->cookie->bv_len))
sp->morePages = TRUE;
else
sp->morePages = FALSE;
@@ -2382,6 +2383,10 @@ static int read_one_map(struct autofs_point *ap,
rv == LDAP_SIZELIMIT_EXCEEDED) {
if (sp.result)
ldap_msgfree(sp.result);
+ if (sp.cookie) {
+ ber_bvfree(sp.cookie);
+ sp.cookie = NULL;
+ }
sp.pageSize = sp.pageSize / 2;
if (sp.pageSize < 5) {
debug(ap->logopt, MODPREFIX
@@ -2397,6 +2402,8 @@ static int read_one_map(struct autofs_point *ap,
if (rv != LDAP_SUCCESS || !sp.result) {
unbind_ldap_connection(ap->logopt, sp.ldap, ctxt);
*result_ldap = rv;
+ if (sp.cookie)
+ ber_bvfree(sp.cookie);
free(sp.query);
return NSS_STATUS_UNAVAIL;
}
@@ -2406,6 +2413,8 @@ static int read_one_map(struct autofs_point *ap,
ldap_msgfree(sp.result);
unbind_ldap_connection(ap->logopt, sp.ldap, ctxt);
*result_ldap = rv;
+ if (sp.cookie)
+ ber_bvfree(sp.cookie);
free(sp.query);
return NSS_STATUS_NOTFOUND;
}
@@ -2417,6 +2426,8 @@ static int read_one_map(struct autofs_point *ap,
unbind_ldap_connection(ap->logopt, sp.ldap, ctxt);
source->age = age;
+ if (sp.cookie)
+ ber_bvfree(sp.cookie);
free(sp.query);
return NSS_STATUS_SUCCESS;

View File

@ -1,78 +0,0 @@
autofs-5.0.6 - fix recursive mount deadlock
From: Ian Kent <raven@themaw.net>
Prior to the vfs-automount changes that went into 2.6.38
and were finalized in 3.1 it was not possible to block
path walks into multi-mounts whose root was covered by
another mount. To deal with that a write lock was used
to ensure the mount tree construction was completed. This
restricts the types of recursively defined mount maps that
can be used and can lead to a deadlock during lookup.
Now that we can prevent processes walking into multi-mounts
that are under construction we no longer need to use a
write lock.
Also, in the patch below, a cache writelock is changed to
a read lock because a write lock isn't needed since the
map cache entry isn't being updated.
---
CHANGELOG | 1 +
daemon/direct.c | 14 ++++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 936c9ab..9cdad6e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -12,6 +12,7 @@
- configure.in: allow cross compilation.
- README: update mailing list subscription info.
- allow non root user to check status.
+- fix recursive mount deadlock.
25/07/2012 autofs-5.0.7
=======================
diff --git a/daemon/direct.c b/daemon/direct.c
index 7e2f0d7..3e09c5d 100644
--- a/daemon/direct.c
+++ b/daemon/direct.c
@@ -1285,6 +1285,8 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_
struct timespec wait;
struct timeval now;
int ioctlfd, len, state;
+ unsigned int kver_major = get_kver_major();
+ unsigned int kver_minor = get_kver_minor();
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state);
@@ -1297,8 +1299,16 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_
* cache entry we will not be able to find the mapent. So
* we must take the source writelock to ensure the parent
* has mount is complete before we look for the entry.
+ *
+ * Since the vfs-automount kernel changes we can now block
+ * on covered mounts during mount tree construction so a
+ * write lock is no longer needed. So we now can handle a
+ * wider class of recursively define mount lookups.
*/
- master_source_writelock(ap->entry);
+ if (kver_major > 5 || (kver_major == 5 && kver_minor > 1))
+ master_source_readlock(ap->entry);
+ else
+ master_source_writelock(ap->entry);
map = ap->entry->maps;
while (map) {
/*
@@ -1311,7 +1321,7 @@ int handle_packet_missing_direct(struct autofs_point *ap, autofs_packet_missing_
}
mc = map->mc;
- cache_writelock(mc);
+ cache_readlock(mc);
me = cache_lookup_ino(mc, pkt->dev, pkt->ino);
if (me)
break;

View File

@ -1,136 +0,0 @@
autofs-5.0.6 - fix remount deadlock
From: Ian Kent <raven@themaw.net>
When reconstructing the mount tree upon restart a writelock to the map
entry cache cannot be taken when parsing a direct map entry because a
readlock is already held higher up in the call tree.
In the place this is done it isn't be necessary to alter the direct map
entries in the cache. Also, it shouldn't be necessary to delete existing
multi-mount cache entries to avoid a duplicate multi-mount entry error
return. The check for a duplicate can be done in the cache handling
functions.
---
CHANGELOG | 1
lib/cache.c | 8 ++++--
modules/parse_sun.c | 60 ++++++++++++++++++++++++++--------------------------
3 files changed, 36 insertions(+), 33 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -52,6 +52,7 @@
- fix nfs4 contacts portmap.
- make autofs wait longer for shutdown completion.
- fix sss map age not updated.
+- fix remount deadlock.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/lib/cache.c
+++ autofs-5.0.6/lib/cache.c
@@ -658,10 +658,12 @@ int cache_add_offset(struct mapent_cache
return CHE_FAIL;
me = cache_lookup_distinct(mc, key);
- if (me && me != owner)
- return CHE_DUPLICATE;
+ if (me && me->age == age) {
+ if (me != owner)
+ return CHE_DUPLICATE;
+ }
- ret = cache_add(mc, owner->source, key, mapent, age);
+ ret = cache_update(mc, owner->source, key, mapent, age);
if (ret == CHE_FAIL) {
warn(logopt, "failed to add key %s to cache", key);
return CHE_FAIL;
--- autofs-5.0.6.orig/modules/parse_sun.c
+++ autofs-5.0.6/modules/parse_sun.c
@@ -843,12 +843,17 @@ add_offset_entry(struct autofs_point *ap
strcpy(m_mapent, loc);
ret = cache_add_offset(mc, name, m_key, m_mapent, age);
- if (ret == CHE_OK)
+ if (ret == CHE_DUPLICATE)
+ warn(ap->logopt, MODPREFIX
+ "syntax error or duplicate offset %s -> %s", path, loc);
+ else if (ret == CHE_FAIL)
+ debug(ap->logopt, MODPREFIX
+ "failed to add multi-mount offset %s -> %s", path, m_mapent);
+ else {
+ ret = CHE_OK;
debug(ap->logopt, MODPREFIX
"added multi-mount offset %s -> %s", path, m_mapent);
- else
- warn(ap->logopt, MODPREFIX
- "syntax error or duplicate offset %s -> %s", path, loc);
+ }
return ret;
}
@@ -1410,7 +1415,7 @@ int parse_mount(struct autofs_point *ap,
char buf[MAX_ERR_BUF];
struct map_source *source;
struct mapent_cache *mc;
- struct mapent *me = NULL;
+ struct mapent *me;
char *pmapent, *options;
const char *p;
int mapent_len, rv = 0;
@@ -1561,33 +1566,28 @@ int parse_mount(struct autofs_point *ap,
strcat(m_root, name);
}
- cache_writelock(mc);
- me = cache_lookup_distinct(mc, name);
- if (!me) {
- int ret;
- /*
- * Not in the cache, perhaps it's a program map
- * or one that doesn't support enumeration
- */
- ret = cache_add(mc, source, name, mapent, time(NULL));
- if (ret == CHE_FAIL) {
- cache_unlock(mc);
- free(options);
- return 1;
+ /*
+ * Can't take the write lock for direct mount entries here
+ * but they should always be present in the map entry cache.
+ */
+ if (ap->type == LKP_INDIRECT) {
+ cache_writelock(mc);
+ me = cache_lookup_distinct(mc, name);
+ if (!me) {
+ int ret;
+ /*
+ * Not in the cache, perhaps it's a program map
+ * or one that doesn't support enumeration.
+ */
+ ret = cache_add(mc, source, name, mapent, age);
+ if (ret == CHE_FAIL) {
+ cache_unlock(mc);
+ free(options);
+ return 1;
+ }
}
- } else {
- /*
- * If the entry exists it must not have any existing
- * multi-mount subordinate entries since we are
- * mounting this afresh. We need to do this to allow
- * us to fail on the check for duplicate offsets in
- * we don't know when submounts go away.
- */
- cache_multi_writelock(me);
- cache_delete_offset_list(mc, name);
- cache_multi_unlock(me);
+ cache_unlock(mc);
}
- cache_unlock(mc);
cache_readlock(mc);
me = cache_lookup_distinct(mc, name);

View File

@ -1,49 +0,0 @@
autofs-5.0.6 - fix remount of multi mount
From: Ian Kent <ikent@redhat.com>
Went accessing a multi-mount only the the offsets that need to be mounted
are mounted. But when re-mounting multi-mounts during a restart we need to
also traverse into existing mounts and re-connect to triggers mounted within
them.
---
CHANGELOG | 1 +
lib/mounts.c | 15 +++++++++++++++
2 files changed, 16 insertions(+)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -55,6 +55,7 @@
- fix remount deadlock.
- fix umount recovery of busy direct mount.
- fix offset mount point directory removal.
+- fix remount of multi mount.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/lib/mounts.c
+++ autofs-5.0.6/lib/mounts.c
@@ -1661,6 +1661,21 @@ int mount_multi_triggers(struct autofs_p
goto cont;
mounted += do_mount_autofs_offset(ap, oe, root, offset);
+
+ /*
+ * If re-constructing a multi-mount it's necessary to walk
+ * into nested mounts, unlike the usual "mount only what's
+ * needed as you go" behavior.
+ */
+ if (ap->state == ST_READMAP && ap->flags & MOUNT_FLAG_REMOUNT) {
+ if (oe->ioctlfd != -1 ||
+ is_mounted(_PROC_MOUNTS, oe->key, MNTS_REAL)) {
+ char oe_root[PATH_MAX + 1];
+ strcpy(oe_root, root);
+ strcat(oe_root, offset);
+ mount_multi_triggers(ap, oe, oe_root, strlen(oe_root), base);
+ }
+ }
cont:
offset = cache_get_offset(base,
offset, start, &me->multi_list, &pos);

View File

@ -1,58 +0,0 @@
autofs-5.0.6 - fix result null check in read_one_map()
From: Ian Kent <ikent@redhat.com>
Fix the check and reset to NULL of the LDAP library allocated result
within the loop to fetch paged query values.
---
CHANGELOG | 1 +
modules/lookup_ldap.c | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 946a196..66b804f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -4,6 +4,7 @@
- improve mount location error reporting.
- fix paged query more results check.
- fix dumpmaps not reading maps.
+- fix result null check in read_one_map().
28/06/2011 autofs-5.0.6
-----------------------
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
index a25050a..22ff355 100644
--- a/modules/lookup_ldap.c
+++ b/modules/lookup_ldap.c
@@ -2381,8 +2381,10 @@ static int read_one_map(struct autofs_point *ap,
if (rv == LDAP_ADMINLIMIT_EXCEEDED ||
rv == LDAP_SIZELIMIT_EXCEEDED) {
- if (sp.result)
+ if (sp.result) {
ldap_msgfree(sp.result);
+ sp.result = NULL;
+ }
if (sp.cookie) {
ber_bvfree(sp.cookie);
sp.cookie = NULL;
@@ -2402,6 +2404,8 @@ static int read_one_map(struct autofs_point *ap,
if (rv != LDAP_SUCCESS || !sp.result) {
unbind_ldap_connection(ap->logopt, sp.ldap, ctxt);
*result_ldap = rv;
+ if (sp.result)
+ ldap_msgfree(sp.result);
if (sp.cookie)
ber_bvfree(sp.cookie);
free(sp.query);
@@ -2419,6 +2423,7 @@ static int read_one_map(struct autofs_point *ap,
return NSS_STATUS_NOTFOUND;
}
ldap_msgfree(sp.result);
+ sp.result = NULL;
} while (sp.morePages == TRUE);
debug(ap->logopt, MODPREFIX "done updating map");

View File

@ -1,45 +0,0 @@
autofs-5.0.6 - fix rework error return handling in rpc code
From: Dustin Polke <DuPol@gmx.de>
This fixes the following error:
rpc_subs.c: In function rpc_do_create_client:
rpc_subs.c:203:3: error: a label can only be part of a statement and a
declaration is not a statement
---
CHANGELOG | 1 +
lib/rpc_subs.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -33,6 +33,7 @@
- check scandir() return value.
- fix function to check mount.nfs version.
- fix typo in libtirpc file name.
+- fix rework error return handling in rpc code.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/lib/rpc_subs.c
+++ autofs-5.0.6/lib/rpc_subs.c
@@ -155,7 +155,7 @@ static int rpc_do_create_client(struct s
CLIENT *clnt = NULL;
struct sockaddr_in in4_laddr;
struct sockaddr_in *in4_raddr;
- int type, proto;
+ int type, proto, ret;
socklen_t slen;
*client = NULL;
@@ -200,7 +200,7 @@ static int rpc_do_create_client(struct s
break;
case IPPROTO_TCP:
- int ret = connect_nb(*fd, addr, slen, &info->timeout);
+ ret = connect_nb(*fd, addr, slen, &info->timeout);
if (ret < 0)
return ret;

View File

@ -1,35 +0,0 @@
autofs-5.0.6 - fix rpc build error
From: Leonardo Chiquitto <leonardo.lists@gmail.com>
The compile error looks like a problem in the libtirpc interface code rewrite
(commit f8ea2a5762 - autofs-5.0.6 - fix ipv6 rpc calls). The following patch
should fix it.
---
CHANGELOG | 1 +
lib/rpc_subs.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -20,6 +20,7 @@
- add systemd unit support.
- remove empty command line arguments (passed by systemd).
- fix improve mount location error reporting.
+- fix rpc build error.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/lib/rpc_subs.c
+++ autofs-5.0.6/lib/rpc_subs.c
@@ -154,7 +154,7 @@ static CLIENT *rpc_do_create_client(stru
{
CLIENT *client = NULL;
struct sockaddr_in in4_laddr;
- struct sockaddr_in in4_raddr;
+ struct sockaddr_in *in4_raddr;
int type, proto;
socklen_t slen;

View File

@ -1,58 +0,0 @@
autofs-5.0.6 - fix segfault in get_query_dn()
From: Leonardo Chiquitto <leonardo.lists@gmail.com>
Automount will segfault when two threads run get_query_dn()
simultaneously and $SEARCH_BASE is defined in sysconfig.
This happens because a thread tries to dereference ctxt->sdns
while another thread running the same function frees the
memory.
I believe we don't need to reread $SEARCH_BASE every time
get_query_dn() is called.
edit: Ian Kent <raven@themaw.net>
move the read of configured search dns to lookup_init().
edit end
---
modules/lookup_ldap.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
--- autofs-5.0.6.orig/modules/lookup_ldap.c
+++ autofs-5.0.6/modules/lookup_ldap.c
@@ -281,7 +281,6 @@ static int get_query_dn(unsigned logopt,
char buf[MAX_ERR_BUF];
char *query, *dn, *qdn;
LDAPMessage *result, *e;
- struct ldap_searchdn *sdns = NULL;
char *attrs[2];
struct berval **value;
int scope;
@@ -330,15 +329,6 @@ static int get_query_dn(unsigned logopt,
scope = LDAP_SCOPE_SUBTREE;
}
- if (!ctxt->base) {
- sdns = defaults_get_searchdns();
- if (sdns) {
- if (ctxt->sdns)
- defaults_free_searchdns(ctxt->sdns);
- ctxt->sdns = sdns;
- }
- }
-
dn = NULL;
if (!ctxt->sdns) {
rv = ldap_search_s(ldap, ctxt->base,
@@ -1467,6 +1457,9 @@ int lookup_init(const char *mapfmt, int
return 1;
}
+ if (!ctxt->base)
+ ctxt->sdns = defaults_get_searchdns();
+
ctxt->timeout = defaults_get_ldap_timeout();
ctxt->network_timeout = defaults_get_ldap_network_timeout();

View File

@ -1,86 +0,0 @@
autofs-5.0.6 - fix segmentation fault in do_remount_indirect()
From: Leonardo Chiquitto <leonardo.lists@gmail.com>
In some rare circumstance, it's possible that automount will crash
on startup while trying to reconnect to a "half-broken" NFS mount
point.
The segmentation fault happens because we're not testing scandir()'s
return value in do_remount_indirect():
lib/mounts.c:
1210 i = j = scandir(buf, &de2, 0, alphasort);
1211 while (i--)
1212 free(de2[i]);
So, if scandir() returns -1, it will try to free de2[-1], de2[-2], etc.
Here's the call trace, for reference:
Program terminated with signal 11, Segmentation fault.
#0 0x00007ffff7fe2425 in do_remount_indirect (ap=0x7ffff821e070, fd=15,
path=0x7ffff821e150 "/nfs/iil") at mounts.c:1212
1212 free(de2[i]);
(gdb) print j
$1 = -1
(gdb) print de2
$3 = (struct dirent **) 0x0
#0 0x00007ffff7fe2425 in do_remount_indirect (ap=0x7ffff821e070, fd=15,
path=0x7ffff821e150 "/nfs/iil") at mounts.c:1212
#1 0x00007ffff7fe2a48 in remount_active_mount (ap=0x7ffff821e070, mc=0x0,
path=0x7ffff821e150 "/nfs/iil", devid=20, type=<optimized out>,
ioctlfd=0x7ffff6e5babc) at mounts.c:1327
#2 0x00007ffff7fe2ac6 in try_remount (ap=0x7ffff821e070, me=0x0, type=1)
at mounts.c:1357
#3 0x00007ffff7fd35e0 in do_mount_autofs_indirect (root=<optimized out>,
ap=<optimized out>) at indirect.c:103
#4 mount_autofs_indirect (ap=0x7ffff821e070, root=0x7ffff8202d50 "/nfs/iil")
at indirect.c:213
#5 0x00007ffff7fd1473 in mount_autofs (root=<optimized out>,
ap=<optimized out>) at automount.c:1005
#6 handle_mounts (arg=0x7fffffffdfd0) at automount.c:1526
#7 0x00007ffff7b8e5f0 in start_thread (arg=<optimized out>)
at pthread_create.c:297
#8 0x00007ffff6f3187d in clone ()
at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#9 0x0000000000000000 in ?? ()
Suggested fix:
Check scandir() return value
In some rare circumstance, it's possible that automount will crash
on startup while trying to reconnect to a "half-broken" NFS mount
point.
---
CHANGELOG | 1 +
lib/mounts.c | 4 ++++
2 files changed, 5 insertions(+)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -30,6 +30,7 @@
- rework error return handling in rpc code.
- catch EHOSTUNREACH and bail out early.
- systemd support fixes.
+- check scandir() return value.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/lib/mounts.c
+++ autofs-5.0.6/lib/mounts.c
@@ -1355,6 +1355,10 @@ static int do_remount_indirect(struct au
int i, j;
i = j = scandir(buf, &de2, 0, alphasort);
+ if (i < 0) {
+ free(de[n]);
+ continue;
+ }
while (i--)
free(de2[i]);
free(de2);

View File

@ -1,34 +0,0 @@
autofs-5.0.6 - fix sss map age not updated
From: Ian Kent <ikent@redhat.com>
The map source age field should be updated when the map is read for
map entry cache cleanup.
---
CHANGELOG | 1 +
modules/lookup_sss.c | 2 ++
2 files changed, 3 insertions(+)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -51,6 +51,7 @@
- check if /etc/mtab is a link to /proc/self/mounts.
- fix nfs4 contacts portmap.
- make autofs wait longer for shutdown completion.
+- fix sss map age not updated.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/modules/lookup_sss.c
+++ autofs-5.0.6/modules/lookup_sss.c
@@ -362,6 +362,8 @@ int lookup_read_map(struct autofs_point
endautomntent(ap->logopt, ctxt, &sss_ctxt);
+ source->age = age;
+
return NSS_STATUS_SUCCESS;
}

View File

@ -1,41 +0,0 @@
autofs-5.0.6 - fix sss wildcard match
From: Ian Kent <ikent@redhat.com>
Check for a wildcard map entry on sss map read and convert to
the usual '*' befone adding to the map entry cache.
---
CHANGELOG | 1 +
modules/lookup_sss.c | 9 +++++++++
2 files changed, 10 insertions(+)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -37,6 +37,7 @@
- allow MOUNT_WAIT to override probe.
- improve UDP RPC timeout handling.
- use strtok_r() in linux_version_code().
+- fix sss wildcard match.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/modules/lookup_sss.c
+++ autofs-5.0.6/modules/lookup_sss.c
@@ -325,6 +325,15 @@ int lookup_read_map(struct autofs_point
continue;
}
+ if (*key == '/' && strlen(key) == 1) {
+ if (ap->type == LKP_DIRECT) {
+ free(key);
+ free(value);
+ continue;
+ }
+ *key = '*';
+ }
+
/*
* TODO: implement sun % hack for key translation for
* mixed case keys in schema that are single case only.

View File

@ -1,141 +0,0 @@
autofs-5.0.6 - fix submount shutdown race
From: Ian Kent <ikent@redhat.com>
Shutdown of submounts is problematic because the kernel doesn't
know when they are going away and so cannot block path walks
while they shut down. After aquiring the locks that cause mount
requests to wait, the daemon checks if the submount is active before
finally umounting it. If the mount is found to be busy the shutdown
is abandoned and the submount returned to a ready state.
But, if a mount request arrives at the same time as the daemon is
attempting to aquire these locks pthreads appears to become confused
and blocks. So change to using the try version of the lock call and
handling the return appropriately.
---
CHANGELOG | 1 +
daemon/automount.c | 76 ++++++++++++++++++++++++++++++++++++++++------------
2 files changed, 60 insertions(+), 17 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index cac450f..cb9ac75 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -10,6 +10,7 @@
- fix not bind mounting local filesystem.
- add "dir" map-type.
- fix wait for master source mutex.
+- fix submount shutdown race.
28/06/2011 autofs-5.0.6
-----------------------
diff --git a/daemon/automount.c b/daemon/automount.c
index 376e965..4f3151f 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -1495,6 +1495,41 @@ static void handle_mounts_cleanup(void *arg)
return;
}
+static int submount_source_writelock_nested(struct autofs_point *ap)
+{
+ struct autofs_point *parent = ap->parent;
+ int status;
+
+ status = pthread_rwlock_trywrlock(&parent->entry->source_lock);
+ if (status)
+ goto done;
+
+ mounts_mutex_lock(parent);
+
+ status = pthread_rwlock_trywrlock(&ap->entry->source_lock);
+ if (status) {
+ mounts_mutex_unlock(parent);
+ master_source_unlock(parent->entry);
+ }
+
+done:
+ if (status && status != EBUSY) {
+ logmsg("submount nested master_mapent source write lock failed");
+ fatal(status);
+ }
+
+ return status;
+}
+
+static void submount_source_unlock_nested(struct autofs_point *ap)
+{
+ struct autofs_point *parent = ap->parent;
+
+ master_source_unlock(ap->entry);
+ mounts_mutex_unlock(parent);
+ master_source_unlock(parent->entry);
+}
+
void *handle_mounts(void *arg)
{
struct startup_cond *suc;
@@ -1565,23 +1600,32 @@ void *handle_mounts(void *arg)
master_mutex_lock();
if (ap->submount) {
- master_source_writelock(ap->parent->entry);
- mounts_mutex_lock(ap->parent);
- }
-
- master_source_writelock(ap->entry);
+ /*
+ * If a mount request arrives before the locks are
+ * aquired just return to ready state.
+ */
+ ret = submount_source_writelock_nested(ap);
+ if (ret) {
+ warn(ap->logopt,
+ "can't shutdown submount: mount in progress");
+ /* Return to ST_READY is done immediately */
+ st_add_task(ap, ST_READY);
+ master_mutex_unlock();
+ pthread_setcancelstate(cur_state, NULL);
+ continue;
+ }
+ } else
+ master_source_writelock(ap->entry);
if (ap->state != ST_SHUTDOWN) {
if (!ap->submount)
alarm_add(ap, ap->exp_runfreq);
/* Return to ST_READY is done immediately */
st_add_task(ap, ST_READY);
- master_source_unlock(ap->entry);
- if (ap->submount) {
- mounts_mutex_unlock(ap->parent);
- master_source_unlock(ap->parent->entry);
- }
-
+ if (ap->submount)
+ submount_source_unlock_nested(ap);
+ else
+ master_source_unlock(ap->entry);
master_mutex_unlock();
pthread_setcancelstate(cur_state, NULL);
@@ -1621,12 +1665,10 @@ void *handle_mounts(void *arg)
alarm_add(ap, ap->exp_runfreq);
/* Return to ST_READY is done immediately */
st_add_task(ap, ST_READY);
- master_source_unlock(ap->entry);
- if (ap->submount) {
- mounts_mutex_unlock(ap->parent);
- master_source_unlock(ap->parent->entry);
- }
-
+ if (ap->submount)
+ submount_source_unlock_nested(ap);
+ else
+ master_source_unlock(ap->entry);
master_mutex_unlock();
pthread_setcancelstate(cur_state, NULL);

View File

@ -1,36 +0,0 @@
autofs-5.0.6 - fix systemd argument passing
From: Ian Kent <ikent@redhat.com>
The substition of the environment variable OPTIONS, from the autofs
confuguration may contain multiple elements that need to be passed
as such when systemd run the unit file. That requires that the braces
be omitted the ExecStart entry of the unit file.
---
CHANGELOG | 1 +
samples/autofs.service.in | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -58,6 +58,7 @@
- fix remount of multi mount.
- fix devce ioctl alloc path check.
- add hup signal handling to hosts map.
+- fix systemd argument passing.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/samples/autofs.service.in
+++ autofs-5.0.6/samples/autofs.service.in
@@ -6,7 +6,7 @@ After=network.target ypbind.service
Type=forking
PIDFile=@@autofspiddir@@/autofs.pid
EnvironmentFile=-@@autofsconfdir@@/autofs
-ExecStart=@@sbindir@@/automount ${OPTIONS} --pid-file @@autofspiddir@@/autofs.pid
+ExecStart=@@sbindir@@/automount $OPTIONS --pid-file @@autofspiddir@@/autofs.pid
ExecReload=/usr/bin/kill -HUP $MAINPID
TimeoutSec=180

View File

@ -1,36 +0,0 @@
autofs-5.0.6 - fix typo in libtirpc file name
From: Leonardo Chiquitto <leonardo.lists@gmail.com>
The library file name was misspelled as libitirpc.so.
---
CHANGELOG | 1 +
daemon/automount.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -32,6 +32,7 @@
- systemd support fixes.
- check scandir() return value.
- fix function to check mount.nfs version.
+- fix typo in libtirpc file name.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/daemon/automount.c
+++ autofs-5.0.6/daemon/automount.c
@@ -2232,9 +2232,9 @@ int main(int argc, char *argv[])
xmlInitParser();
#endif
#ifdef TIRPC_WORKAROUND
- void *dh_tirpc = dlopen("libitirpc.so", RTLD_NOW);
+ void *dh_tirpc = dlopen("libtirpc.so", RTLD_NOW);
if (!dh_tirpc)
- dh_tirpc = dlopen("libitirpc.so.1", RTLD_NOW);
+ dh_tirpc = dlopen("libtirpc.so.1", RTLD_NOW);
#endif
if (!master_read_master(master_list, age, 0)) {

View File

@ -1,66 +0,0 @@
autofs-5.0.6 - fix umount recovery of busy direct mount
From: Ian Kent <raven@themaw.net>
Reported by Leonardo Chiquitto (along with a problem analysis that lead
to the resolution). Thanks for the effort Leonardo.
When umounting direct mounts at exit, if any are busy and contain offset
trigger mounts automount will try and re-mount them when the umount fails
so they can be used to re-construct the mount tree at restart. But this
fails because the kernel communication pipe, which is used as a parameter
when mounting the offsets, has already been closed. To fix this all we
need do is delay closing the kernel pipe file handle until after the
direct mounts have been umounted since this doesn't affect the in use
status of the mounts.
---
CHANGELOG | 1 +
daemon/direct.c | 18 +++++++++---------
2 files changed, 10 insertions(+), 9 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -53,6 +53,7 @@
- make autofs wait longer for shutdown completion.
- fix sss map age not updated.
- fix remount deadlock.
+- fix umount recovery of busy direct mount.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/daemon/direct.c
+++ autofs-5.0.6/daemon/direct.c
@@ -193,15 +193,6 @@ int umount_autofs_direct(struct autofs_p
struct mnt_list *mnts;
struct mapent *me, *ne;
- close(ap->state_pipe[0]);
- close(ap->state_pipe[1]);
- if (ap->pipefd >= 0)
- close(ap->pipefd);
- if (ap->kpipefd >= 0) {
- close(ap->kpipefd);
- ap->kpipefd = -1;
- }
-
mnts = tree_make_mnt_tree(_PROC_MOUNTS, "/");
pthread_cleanup_push(mnts_cleanup, mnts);
nc = ap->entry->master->nc;
@@ -231,6 +222,15 @@ int umount_autofs_direct(struct autofs_p
pthread_cleanup_pop(1);
pthread_cleanup_pop(1);
+ close(ap->state_pipe[0]);
+ close(ap->state_pipe[1]);
+ if (ap->pipefd >= 0)
+ close(ap->pipefd);
+ if (ap->kpipefd >= 0) {
+ close(ap->kpipefd);
+ ap->kpipefd = -1;
+ }
+
return 0;
}

View File

@ -1,84 +0,0 @@
autofs-5.0.6 - fix wait for master source mutex
From: Ian Kent <ikent@redhat.com>
A previous change that was meant to handle the case where the master map
source mutex read lock count was exceeded was incorrectly done for the
write lock case instead of the read lock case.
---
CHANGELOG | 1 +
lib/master.c | 30 +++++++++++++++---------------
2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 5b988d4..cac450f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -9,6 +9,7 @@
- code analysis fixes part 1.
- fix not bind mounting local filesystem.
- add "dir" map-type.
+- fix wait for master source mutex.
28/06/2011 autofs-5.0.6
-----------------------
diff --git a/lib/master.c b/lib/master.c
index 6c89e1d..87d1269 100644
--- a/lib/master.c
+++ b/lib/master.c
@@ -540,38 +540,38 @@ void send_map_update_request(struct autofs_point *ap)
void master_source_writelock(struct master_mapent *entry)
{
- int retries = 5; /* 1 second maximum */
int status;
- while (retries--) {
- status = pthread_rwlock_wrlock(&entry->source_lock);
- if (status != EAGAIN)
- break;
- else {
- struct timespec t = { 0, 200000000 };
- struct timespec r;
- while (nanosleep(&t, &r) == -1 && errno == EINTR)
- memcpy(&t, &r, sizeof(struct timespec));
- }
- }
-
+ status = pthread_rwlock_wrlock(&entry->source_lock);
if (status) {
logmsg("master_mapent source write lock failed");
fatal(status);
}
-
return;
}
void master_source_readlock(struct master_mapent *entry)
{
+ int retries = 5; /* 1 second maximum */
int status;
- status = pthread_rwlock_rdlock(&entry->source_lock);
+ while (retries--) {
+ status = pthread_rwlock_tryrdlock(&entry->source_lock);
+ if (status != EAGAIN && status != EBUSY)
+ break;
+ else {
+ struct timespec t = { 0, 200000000 };
+ struct timespec r;
+ while (nanosleep(&t, &r) == -1 && errno == EINTR)
+ memcpy(&t, &r, sizeof(struct timespec));
+ }
+ }
+
if (status) {
logmsg("master_mapent source read lock failed");
fatal(status);
}
+
return;
}

View File

@ -1,33 +0,0 @@
autofs-5.0.6 - ignore duplicate exports in auto.net
From: Paul Smith <pds at us.ibm.com>
---
CHANGELOG | 1 +
samples/auto.net | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -23,6 +23,7 @@
- fix rpc build error.
- add sss lookup module.
- teach automount about sss source.
+- ignore duplicate exports in auto.net.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/samples/auto.net
+++ autofs-5.0.6/samples/auto.net
@@ -35,7 +35,7 @@ done
# Newer distributions get this right
SHOWMOUNT="$SMNT --no-headers -e $key"
-$SHOWMOUNT | LC_ALL=C sort -k 1 | \
+$SHOWMOUNT | LC_ALL=C cut -d' ' -f1 | LC_ALL=C sort -u | \
awk -v key="$key" -v opts="$opts" -- '
BEGIN { ORS=""; first=1 }
{ if (first) { print opts; first=0 }; print " \\\n\t" $1, key ":" $1 }

View File

@ -1,372 +0,0 @@
autofs-5.0.6 - improve UDP RPC timeout handling
From: Ian Kent <ikent@redhat.com>
The RPC code still doesn't control timeout quite right. Change that
to take control of the UDP timeout too.
---
CHANGELOG | 1
include/rpc_subs.h | 5 ++
lib/rpc_subs.c | 93 +++++++++++++++++++--------------------------------
modules/replicated.c | 36 ++++++++++++-------
4 files changed, 63 insertions(+), 72 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -35,6 +35,7 @@
- fix typo in libtirpc file name.
- fix rework error return handling in rpc code.
- allow MOUNT_WAIT to override probe.
+- improve UDP RPC timeout handling.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/include/rpc_subs.h
+++ autofs-5.0.6/include/rpc_subs.h
@@ -42,6 +42,9 @@
#define PMAP_TOUT_UDP 3
#define PMAP_TOUT_TCP 5
+#define RPC_TOUT_UDP PMAP_TOUT_UDP
+#define RPC_TOUT_TCP PMAP_TOUT_TCP
+
#define HOST_ENT_BUF_SIZE 2048
struct conn_info {
@@ -64,7 +67,7 @@ void rpc_destroy_udp_client(struct conn_
int rpc_tcp_getclient(struct conn_info *, unsigned int, unsigned int);
void rpc_destroy_tcp_client(struct conn_info *);
int rpc_portmap_getclient(struct conn_info *, const char *, struct sockaddr *, size_t, const char *, unsigned int);
-unsigned short rpc_portmap_getport(struct conn_info *, struct pmap *);
+int rpc_portmap_getport(struct conn_info *, struct pmap *, unsigned short *);
int rpc_ping_proto(struct conn_info *);
int rpc_ping(const char *, long, long, unsigned int);
double elapsed(struct timeval, struct timeval);
--- autofs-5.0.6.orig/lib/rpc_subs.c
+++ autofs-5.0.6/lib/rpc_subs.c
@@ -218,43 +218,24 @@ static int rpc_do_create_client(struct s
return 0;
}
#else
-struct netconfig *find_netconf(void *handle, char *family, char *proto)
-{
- struct netconfig *nconf;
-
- while ((nconf = getnetconfig(handle))) {
- if ((strcmp(nconf->nc_protofmly, family) == 0) &&
- (strcmp(nconf->nc_proto, proto) == 0))
- break;
- }
-
- return nconf;
-}
-
static int rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, int *fd, CLIENT **client)
{
CLIENT *clnt = NULL;
struct sockaddr_in in4_laddr;
struct sockaddr_in6 in6_laddr;
struct sockaddr *laddr = NULL;
- struct netconfig *nconf;
struct netbuf nb_addr;
int type, proto;
- char *nc_family, *nc_proto;
- void *handle;
size_t slen;
int ret;
*client = NULL;
proto = info->proto->p_proto;
- if (proto == IPPROTO_UDP) {
+ if (proto == IPPROTO_UDP)
type = SOCK_DGRAM;
- nc_proto = NC_UDP;
- } else {
+ else
type = SOCK_STREAM;
- nc_proto = NC_TCP;
- }
/*
* bind to any unused port. If we left this up to the rpc
@@ -269,7 +250,6 @@ static int rpc_do_create_client(struct s
laddr = (struct sockaddr *) &in4_laddr;
in4_raddr->sin_port = htons(info->port);
slen = sizeof(struct sockaddr_in);
- nc_family = NC_INET;
} else if (addr->sa_family == AF_INET6) {
struct sockaddr_in6 *in6_raddr = (struct sockaddr_in6 *) addr;
in6_laddr.sin6_family = AF_INET6;
@@ -278,20 +258,9 @@ static int rpc_do_create_client(struct s
laddr = (struct sockaddr *) &in6_laddr;
in6_raddr->sin6_port = htons(info->port);
slen = sizeof(struct sockaddr_in6);
- nc_family = NC_INET6;
} else
return -EINVAL;
- handle = setnetconfig();
- if (!handle)
- return -EINVAL;
-
- nconf = find_netconf(handle, nc_family, nc_proto);
- if (!nconf) {
- endnetconfig(handle);
- return -EINVAL;
- }
-
/*
* bind to any unused port. If we left this up to the rpc layer,
* it would bind to a reserved port, which has been shown to
@@ -301,13 +270,11 @@ static int rpc_do_create_client(struct s
*fd = open_sock(addr->sa_family, type, proto);
if (*fd < 0) {
ret = -errno;
- endnetconfig(handle);
return ret;
}
if (bind(*fd, laddr, slen) < 0) {
ret = -errno;
- endnetconfig(handle);
return ret;
}
}
@@ -315,19 +282,23 @@ static int rpc_do_create_client(struct s
nb_addr.maxlen = nb_addr.len = slen;
nb_addr.buf = addr;
- if (info->proto->p_proto == IPPROTO_TCP) {
+ if (info->proto->p_proto == IPPROTO_UDP)
+ clnt = clnt_dg_create(*fd, &nb_addr,
+ info->program, info->version,
+ info->send_sz, info->recv_sz);
+ else if (info->proto->p_proto == IPPROTO_TCP) {
ret = connect_nb(*fd, addr, slen, &info->timeout);
- if (ret < 0) {
- endnetconfig(handle);
+ if (ret < 0)
return ret;
- }
- }
-
- clnt = clnt_tli_create(*fd, nconf, &nb_addr,
- info->program, info->version,
- info->send_sz, info->recv_sz);
+ clnt = clnt_vc_create(*fd, &nb_addr,
+ info->program, info->version,
+ info->send_sz, info->recv_sz);
+ } else
+ return -EINVAL;
- endnetconfig(handle);
+ /* Our timeout is in seconds */
+ if (clnt && info->timeout.tv_sec)
+ clnt_control(clnt, CLSET_TIMEOUT, (void *) &info->timeout);
*client = clnt;
@@ -441,6 +412,8 @@ int rpc_udp_getclient(struct conn_info *
return -ENOENT;
info->proto = pe_proto;
+ info->timeout.tv_sec = RPC_TOUT_UDP;
+ info->timeout.tv_usec = 0;
info->send_sz = UDPMSGSIZE;
info->recv_sz = UDPMSGSIZE;
}
@@ -480,6 +453,8 @@ int rpc_tcp_getclient(struct conn_info *
return -ENOENT;
info->proto = pe_proto;
+ info->timeout.tv_sec = RPC_TOUT_TCP;
+ info->timeout.tv_usec = 0;
info->send_sz = 0;
info->recv_sz = 0;
}
@@ -559,10 +534,10 @@ int rpc_portmap_getclient(struct conn_in
return 0;
}
-unsigned short rpc_portmap_getport(struct conn_info *info, struct pmap *parms)
+int rpc_portmap_getport(struct conn_info *info,
+ struct pmap *parms, unsigned short *port)
{
struct conn_info pmap_info;
- unsigned short port = 0;
CLIENT *client;
enum clnt_stat status;
int proto = info->proto->p_proto;
@@ -604,7 +579,7 @@ unsigned short rpc_portmap_getport(struc
if (status == RPC_SUCCESS) {
status = clnt_call(client, PMAPPROC_GETPORT,
(xdrproc_t) xdr_pmap, (caddr_t) parms,
- (xdrproc_t) xdr_u_short, (caddr_t) &port,
+ (xdrproc_t) xdr_u_short, (caddr_t) port,
pmap_info.timeout);
}
@@ -631,10 +606,12 @@ unsigned short rpc_portmap_getport(struc
clnt_destroy(client);
}
- if (status != RPC_SUCCESS)
+ if (status == RPC_TIMEDOUT)
+ return -ETIMEDOUT;
+ else if (status != RPC_SUCCESS)
return -EIO;
- return port;
+ return 0;
}
int rpc_ping_proto(struct conn_info *info)
@@ -686,7 +663,9 @@ int rpc_ping_proto(struct conn_info *inf
clnt_destroy(client);
}
- if (status != RPC_SUCCESS)
+ if (status == RPC_TIMEDOUT)
+ return -ETIMEDOUT;
+ else if (status != RPC_SUCCESS)
return -EIO;
return 1;
@@ -725,8 +704,8 @@ static unsigned int __rpc_ping(const cha
parms.pm_prot = info.proto->p_proto;
parms.pm_port = 0;
- info.port = rpc_portmap_getport(&info, &parms);
- if (info.port < 0)
+ status = rpc_portmap_getport(&info, &parms, &info.port);
+ if (status < 0)
return status;
status = rpc_ping_proto(&info);
@@ -915,8 +894,8 @@ exports rpc_get_exports(const char *host
parms.pm_prot = info.proto->p_proto;
- info.port = rpc_portmap_getport(&info, &parms);
- if (info.port < 0)
+ status = rpc_portmap_getport(&info, &parms, &info.port);
+ if (status < 0)
goto try_tcp;
memset(&exportlist, '\0', sizeof(exportlist));
@@ -932,8 +911,8 @@ try_tcp:
parms.pm_prot = info.proto->p_proto;
- info.port = rpc_portmap_getport(&info, &parms);
- if (info.port < 0)
+ status = rpc_portmap_getport(&info, &parms, &info.port);
+ if (status < 0)
return NULL;
memset(&exportlist, '\0', sizeof(exportlist));
--- autofs-5.0.6.orig/modules/replicated.c
+++ autofs-5.0.6/modules/replicated.c
@@ -569,7 +569,9 @@ static unsigned int get_nfs_info(unsigne
gettimeofday(&start, &tz);
status = rpc_ping_proto(rpc_info);
gettimeofday(&end, &tz);
- if (status > 0) {
+ if (status == -ETIMEDOUT)
+ return (unsigned int) status;
+ else if (status > 0) {
double reply;
if (random_selection) {
/* Random value between 0 and 1 */
@@ -607,13 +609,12 @@ v3_ver:
} else {
parms.pm_prot = rpc_info->proto->p_proto;
parms.pm_vers = NFS3_VERSION;
- status = rpc_portmap_getport(pm_info, &parms);
- if (status == -EHOSTUNREACH) {
+ status = rpc_portmap_getport(pm_info, &parms, &rpc_info->port);
+ if (status == -EHOSTUNREACH || status == -ETIMEDOUT) {
supported = status;
goto done_ver;
} else if (status < 0)
goto v2_ver;
- rpc_info->port = status;
}
if (rpc_info->proto->p_proto == IPPROTO_UDP)
@@ -627,7 +628,10 @@ v3_ver:
gettimeofday(&start, &tz);
status = rpc_ping_proto(rpc_info);
gettimeofday(&end, &tz);
- if (status > 0) {
+ if (status == -ETIMEDOUT) {
+ supported = status;
+ goto done_ver;
+ } else if (status > 0) {
double reply;
if (random_selection) {
/* Random value between 0 and 1 */
@@ -654,14 +658,12 @@ v2_ver:
} else {
parms.pm_prot = rpc_info->proto->p_proto;
parms.pm_vers = NFS2_VERSION;
- rpc_info->port = rpc_portmap_getport(pm_info, &parms);
- status = rpc_portmap_getport(pm_info, &parms);
- if (status == -EHOSTUNREACH) {
+ status = rpc_portmap_getport(pm_info, &parms, &rpc_info->port);
+ if (status == -EHOSTUNREACH || status == -ETIMEDOUT) {
supported = status;
goto done_ver;
} else if (status < 0)
goto done_ver;
- rpc_info->port = status;
}
if (rpc_info->proto->p_proto == IPPROTO_UDP)
@@ -675,7 +677,9 @@ v2_ver:
gettimeofday(&start, &tz);
status = rpc_ping_proto(rpc_info);
gettimeofday(&end, &tz);
- if (status > 0) {
+ if (status == -ETIMEDOUT)
+ supported = status;
+ else if (status > 0) {
double reply;
if (random_selection) {
/* Random value between 0 and 1 */
@@ -752,7 +756,8 @@ static int get_vers_and_cost(unsigned lo
supported = get_nfs_info(logopt, host,
&pm_info, &rpc_info, "tcp", vers, options);
if (IS_ERR(supported)) {
- if (ERR(supported) == EHOSTUNREACH)
+ if (ERR(supported) == EHOSTUNREACH ||
+ ERR(supported) == ETIMEDOUT)
return ret;
} else if (supported) {
ret = 1;
@@ -763,7 +768,10 @@ static int get_vers_and_cost(unsigned lo
if (version & UDP_REQUESTED) {
supported = get_nfs_info(logopt, host,
&pm_info, &rpc_info, "udp", vers, options);
- if (supported) {
+ if (IS_ERR(supported)) {
+ if (ERR(supported) == ETIMEDOUT)
+ return ret;
+ } else if (supported) {
ret = 1;
host->version |= (supported << 8);
}
@@ -862,8 +870,8 @@ static int get_supported_ver_and_cost(un
return 0;
parms.pm_prot = rpc_info.proto->p_proto;
- rpc_info.port = rpc_portmap_getport(&pm_info, &parms);
- if (rpc_info.port < 0)
+ ret = rpc_portmap_getport(&pm_info, &parms, &rpc_info.port);
+ if (ret < 0)
goto done;
}

View File

@ -1,117 +0,0 @@
autofs-5.0.6 - improve mount location error reporting
From: Ian Kent <raven@themaw.net>
Try and report a more sensible error when an invalid location is
encountered.
---
CHANGELOG | 1 +
modules/parse_sun.c | 32 ++++++++++++++++++--------------
2 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index e5dfa83..a178b74 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
??/??/20?? autofs-5.0.7
=======================
- fix ipv6 name for lookup fix.
+- improve mount location error reporting.
28/06/2011 autofs-5.0.6
-----------------------
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
index 3242e3b..021850d 100644
--- a/modules/parse_sun.c
+++ b/modules/parse_sun.c
@@ -853,7 +853,7 @@ add_offset_entry(struct autofs_point *ap, const char *name,
return ret;
}
-static int validate_location(char *loc)
+static int validate_location(unsigned int logopt, char *loc)
{
char *ptr = loc;
@@ -867,14 +867,22 @@ static int validate_location(char *loc)
* and "@" in the host name part and ipv6 addresses that
* have ":", "[" and "]".
*/
- if (check_colon(ptr)) {
+ if (!check_colon(ptr)) {
+ error(logopt,
+ "expected colon delimeter not found in location %s",
+ loc);
+ return 0;
+ } else {
while (*ptr && strncmp(ptr, ":/", 2)) {
if (!(isalnum(*ptr) ||
*ptr == '-' || *ptr == '.' || *ptr == '_' ||
*ptr == ',' || *ptr == '(' || *ptr == ')' ||
*ptr == '#' || *ptr == '@' || *ptr == ':' ||
- *ptr == '[' || *ptr == ']'))
+ *ptr == '[' || *ptr == ']')) {
+ error(logopt, "invalid character \"%c\" "
+ "found in location %s", *ptr, loc);
return 0;
+ }
ptr++;
}
@@ -883,8 +891,10 @@ static int validate_location(char *loc)
}
/* Must always be something following */
- if (!*ptr)
+ if (!*ptr) {
+ error(logopt, "invalid location %s", loc);
return 0;
+ }
return 1;
}
@@ -951,8 +961,7 @@ static int parse_mapent(const char *ent, char *g_options, char **options, char *
return 0;
}
- if (!validate_location(loc)) {
- warn(logopt, MODPREFIX "invalid location %s", loc);
+ if (!validate_location(logopt, loc)) {
free(myoptions);
free(loc);
return 0;
@@ -985,9 +994,7 @@ static int parse_mapent(const char *ent, char *g_options, char **options, char *
return 0;
}
- if (!validate_location(ent_chunk)) {
- warn(logopt,
- MODPREFIX "invalid location %s", ent_chunk);
+ if (!validate_location(logopt, ent_chunk)) {
free(ent_chunk);
free(myoptions);
free(loc);
@@ -1688,8 +1695,7 @@ int parse_mount(struct autofs_point *ap, const char *name,
return 1;
}
- if (!validate_location(loc)) {
- warn(ap->logopt, MODPREFIX "invalid location %s", loc);
+ if (!validate_location(ap->logopt, loc)) {
free(loc);
free(options);
return 1;
@@ -1714,9 +1720,7 @@ int parse_mount(struct autofs_point *ap, const char *name,
return 1;
}
- if (!validate_location(ent)) {
- warn(ap->logopt,
- MODPREFIX "invalid location %s", loc);
+ if (!validate_location(ap->logopt, ent)) {
free(ent);
free(loc);
free(options);

View File

@ -1,38 +0,0 @@
autofs-5.0.6 - increase file map read buffer size
From: Ian Kent <raven@themaw.net>
The file map entry read buffer can be too small for larger
multi-mount map entries so increase it.
---
CHANGELOG | 1 +
include/automount.h | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 9cdad6e..3bdf8a4 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -13,6 +13,7 @@
- README: update mailing list subscription info.
- allow non root user to check status.
- fix recursive mount deadlock.
+- increase file map read buffer size.
25/07/2012 autofs-5.0.7
=======================
diff --git a/include/automount.h b/include/automount.h
index 561fcc2..37541f5 100644
--- a/include/automount.h
+++ b/include/automount.h
@@ -233,7 +233,7 @@ int rmdir_path(struct autofs_point *ap, const char *path, dev_t dev);
#define AUTOFS_LOOKUP_VERSION 5
#define KEY_MAX_LEN NAME_MAX
-#define MAPENT_MAX_LEN 4095
+#define MAPENT_MAX_LEN 16384
#define PARSE_MAX_BUF KEY_MAX_LEN + MAPENT_MAX_LEN + 2
int lookup_nss_read_master(struct master *master, time_t age);

View File

@ -1,78 +0,0 @@
autofs-5.0.6 - make autofs wait longer for shutdown
From: Ian Kent <ikent@redhat.com>
After signaling the automount daemon to shutdown the autofs init script
doesn't wait long enough for the daemon to exit. This can be a problem
if there are a large number of mounts or if servers are slow to respond.
---
CHANGELOG | 1 +
redhat/autofs.init.in | 5 ++++-
samples/autofs.service.in | 1 +
samples/rc.autofs.in | 5 ++++-
4 files changed, 10 insertions(+), 2 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -50,6 +50,7 @@
- dont retry ldap connect if not required.
- check if /etc/mtab is a link to /proc/self/mounts.
- fix nfs4 contacts portmap.
+- make autofs wait longer for shutdown completion.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/redhat/autofs.init.in
+++ autofs-5.0.6/redhat/autofs.init.in
@@ -108,7 +108,7 @@ function stop() {
while [ -n "`pidof $prog`" -a $count -lt 15 ] ; do
killproc $prog -TERM >& /dev/null
RETVAL=$?
- [ $RETVAL = 0 -a -z "`pidof $prog`" ] || sleep 3
+ [ $RETVAL = 0 -a -z "`pidof $prog`" ] || sleep 20
count=`expr $count + 1`
done
if [ $RETVAL -eq 0 ]; then
@@ -129,6 +129,9 @@ function restart() {
status autofs > /dev/null 2>&1
if [ $? -eq 0 ]; then
stop
+ while [ -n "`pidof $prog`" ] ; do
+ sleep 5
+ done
fi
start
}
--- autofs-5.0.6.orig/samples/autofs.service.in
+++ autofs-5.0.6/samples/autofs.service.in
@@ -8,6 +8,7 @@ PIDFile=@@autofspiddir@@/autofs.pid
EnvironmentFile=-@@autofsconfdir@@/autofs
ExecStart=@@sbindir@@/automount ${OPTIONS} --pid-file @@autofspiddir@@/autofs.pid
ExecReload=/usr/bin/kill -HUP $MAINPID
+TimeoutSec=180
[Install]
WantedBy=multi-user.target
--- autofs-5.0.6.orig/samples/rc.autofs.in
+++ autofs-5.0.6/samples/rc.autofs.in
@@ -91,7 +91,7 @@ function stop() {
while [ -n "`pidof $prog`" -a $count -lt 15 ] ; do
killall -TERM $prog >& /dev/null
RETVAL=$?
- [ $RETVAL = 0 -a -z "`pidof $prog`" ] || sleep 3
+ [ $RETVAL = 0 -a -z "`pidof $prog`" ] || sleep 20
count=`expr $count + 1`
done
if [ -z "`pidof $prog`" ] ; then
@@ -104,6 +104,9 @@ function stop() {
function restart() {
stop
+ while [ -n "`pidof $prog`" ] ; do
+ sleep 5
+ done
start
}

View File

@ -1,529 +0,0 @@
autofs-5.0.6 - move timeout to map_source
From: Ian Kent <ikent@redhat.com>
Move the map entry timeout field from "struct autofs_point" to
"struct map_source".
The result of this change is that an individual timeout may be
set for each direct map master map entry.
---
CHANGELOG | 1 +
daemon/automount.c | 2 +-
daemon/direct.c | 32 +++++++++++++++++++++-----------
daemon/indirect.c | 7 +++----
daemon/lookup.c | 2 ++
daemon/state.c | 18 +++++++++++++++++-
include/automount.h | 5 +++--
include/master.h | 3 ++-
include/mounts.h | 2 +-
lib/master.c | 9 ++++-----
lib/master_parse.y | 32 +++++++++++++-------------------
lib/mounts.c | 37 ++++++++++++++++++-------------------
modules/mount_autofs.c | 5 +++--
13 files changed, 89 insertions(+), 66 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -45,6 +45,7 @@
- report map not read when debug logging.
- duplicate parent options for included maps.
- update ->timeout() function to not return timeout.
+- move timeout to map_source (allow per direct map timeout).
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/daemon/automount.c
+++ autofs-5.0.6/daemon/automount.c
@@ -1585,7 +1585,7 @@ void *handle_mounts(void *arg)
/* We often start several automounters at the same time. Add some
randomness so we don't all expire at the same time. */
- if (!ap->submount && ap->exp_timeout)
+ if (!ap->submount && ap->exp_runfreq)
alarm_add(ap, ap->exp_runfreq + rand() % ap->exp_runfreq);
pthread_setcancelstate(cancel_state, NULL);
--- autofs-5.0.6.orig/daemon/direct.c
+++ autofs-5.0.6/daemon/direct.c
@@ -286,7 +286,7 @@ static int unlink_active_mounts(struct a
if (tree_get_mnt_list(mnts, &list, me->key, 1)) {
if (ap->state == ST_READMAP) {
- time_t tout = ap->exp_timeout;
+ time_t tout = me->source->exp_timeout;
int save_ioctlfd, ioctlfd;
save_ioctlfd = ioctlfd = me->ioctlfd;
@@ -321,18 +321,26 @@ static int unlink_active_mounts(struct a
return 1;
}
-int do_mount_autofs_direct(struct autofs_point *ap, struct mnt_list *mnts, struct mapent *me)
+int do_mount_autofs_direct(struct autofs_point *ap,
+ struct mnt_list *mnts, struct mapent *me,
+ time_t timeout)
{
const char *str_direct = mount_type_str(t_direct);
struct ioctl_ops *ops = get_ioctl_ops();
struct mnt_params *mp;
- time_t timeout = ap->exp_timeout;
struct stat st;
int status, ret, ioctlfd;
const char *map_name;
+ time_t runfreq;
- /* Calculate the timeouts */
- ap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO;
+ if (timeout) {
+ /* Calculate the expire run frequency */
+ runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO;
+ if (ap->exp_runfreq)
+ ap->exp_runfreq = min(ap->exp_runfreq, runfreq);
+ else
+ ap->exp_runfreq = runfreq;
+ }
if (ops->version && !do_force_unlink) {
ap->flags |= MOUNT_FLAG_REMOUNT;
@@ -425,7 +433,7 @@ int do_mount_autofs_direct(struct autofs
}
ops->timeout(ap->logopt, ioctlfd, timeout);
- notify_mount_result(ap, me->key, str_direct);
+ notify_mount_result(ap, me->key, timeout, str_direct);
cache_set_ino_index(me->mc, me->key, st.st_dev, st.st_ino);
ops->close(ap->logopt, ioctlfd);
@@ -473,6 +481,7 @@ int mount_autofs_direct(struct autofs_po
pthread_cleanup_push(cache_lock_cleanup, nc);
map = ap->entry->maps;
while (map) {
+ time_t timeout;
/*
* Only consider map sources that have been read since
* the map entry was last updated.
@@ -483,6 +492,7 @@ int mount_autofs_direct(struct autofs_po
}
mc = map->mc;
+ timeout = map->exp_timeout;
cache_readlock(mc);
pthread_cleanup_push(cache_lock_cleanup, mc);
me = cache_enumerate(mc, NULL);
@@ -491,7 +501,7 @@ int mount_autofs_direct(struct autofs_po
if (ne) {
if (map->master_line < ne->age) {
/* TODO: check return, locking me */
- do_mount_autofs_direct(ap, mnts, me);
+ do_mount_autofs_direct(ap, mnts, me, timeout);
}
me = cache_enumerate(mc, me);
continue;
@@ -508,7 +518,7 @@ int mount_autofs_direct(struct autofs_po
}
/* TODO: check return, locking me */
- do_mount_autofs_direct(ap, mnts, me);
+ do_mount_autofs_direct(ap, mnts, me, timeout);
me = cache_enumerate(mc, me);
}
@@ -639,7 +649,7 @@ int mount_autofs_offset(struct autofs_po
struct ioctl_ops *ops = get_ioctl_ops();
char buf[MAX_ERR_BUF];
struct mnt_params *mp;
- time_t timeout = ap->exp_timeout;
+ time_t timeout = me->source->exp_timeout;
struct stat st;
int ioctlfd, status, ret;
const char *hosts_map_name = "-hosts";
@@ -774,9 +784,9 @@ int mount_autofs_offset(struct autofs_po
ops->timeout(ap->logopt, ioctlfd, timeout);
cache_set_ino_index(me->mc, me->key, st.st_dev, st.st_ino);
if (ap->logopt & LOGOPT_DEBUG)
- notify_mount_result(ap, mountpoint, str_offset);
+ notify_mount_result(ap, mountpoint, timeout, str_offset);
else
- notify_mount_result(ap, me->key, str_offset);
+ notify_mount_result(ap, me->key, timeout, str_offset);
ops->close(ap->logopt, ioctlfd);
debug(ap->logopt, "mounted trigger %s at %s", me->key, mountpoint);
--- autofs-5.0.6.orig/daemon/indirect.c
+++ autofs-5.0.6/daemon/indirect.c
@@ -87,7 +87,7 @@ static int do_mount_autofs_indirect(stru
{
const char *str_indirect = mount_type_str(t_indirect);
struct ioctl_ops *ops = get_ioctl_ops();
- time_t timeout = ap->exp_timeout;
+ time_t timeout = ap->entry->maps->exp_timeout;
char *options = NULL;
const char *hosts_map_name = "-hosts";
const char *map_name = hosts_map_name;
@@ -170,13 +170,12 @@ static int do_mount_autofs_indirect(stru
}
ap->dev = st.st_dev; /* Device number for mount point checks */
- ap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO;
ops->timeout(ap->logopt, ap->ioctlfd, timeout);
if (ap->logopt & LOGOPT_DEBUG)
- notify_mount_result(ap, root, str_indirect);
+ notify_mount_result(ap, root, timeout, str_indirect);
else
- notify_mount_result(ap, ap->path, str_indirect);
+ notify_mount_result(ap, ap->path, timeout, str_indirect);
return 0;
--- autofs-5.0.6.orig/daemon/lookup.c
+++ autofs-5.0.6/daemon/lookup.c
@@ -413,6 +413,7 @@ static enum nsswitch_status read_map_sou
tmap.lookup = map->lookup;
tmap.mc = map->mc;
tmap.instance = map->instance;
+ tmap.exp_timeout = map->exp_timeout;
tmap.recurse = map->recurse;
tmap.depth = map->depth;
tmap.stale = map->stale;
@@ -770,6 +771,7 @@ static enum nsswitch_status lookup_map_n
tmap.format = map->format;
tmap.mc = map->mc;
tmap.instance = map->instance;
+ tmap.exp_timeout = map->exp_timeout;
tmap.recurse = map->recurse;
tmap.depth = map->depth;
tmap.argc = 0;
--- autofs-5.0.6.orig/daemon/state.c
+++ autofs-5.0.6/daemon/state.c
@@ -400,6 +400,9 @@ static void do_readmap_mount(struct auto
}
if (valid) {
struct mapent_cache *vmc = valid->mc;
+ struct ioctl_ops *ops = get_ioctl_ops();
+ time_t runfreq;
+
cache_unlock(vmc);
debug(ap->logopt,
"updating cache entry for valid direct trigger %s",
@@ -412,13 +415,22 @@ static void do_readmap_mount(struct auto
/* Set device and inode number of the new mapent */
cache_set_ino_index(vmc, me->key, me->dev, me->ino);
cache_unlock(vmc);
+ /* Set timeout and calculate the expire run frequency */
+ ops->timeout(ap->logopt, valid->ioctlfd, map->exp_timeout);
+ if (map->exp_timeout) {
+ runfreq = (map->exp_timeout + CHECK_RATIO - 1) / CHECK_RATIO;
+ if (ap->exp_runfreq)
+ ap->exp_runfreq = min(ap->exp_runfreq, runfreq);
+ else
+ ap->exp_runfreq = runfreq;
+ }
} else if (!tree_is_mounted(mnts, me->key, MNTS_REAL))
do_umount_autofs_direct(ap, mnts, me);
else
debug(ap->logopt,
"%s is mounted", me->key);
} else
- do_mount_autofs_direct(ap, mnts, me);
+ do_mount_autofs_direct(ap, mnts, me, map->exp_timeout);
return;
}
@@ -466,6 +478,10 @@ static void *do_readmap(void *arg)
pthread_cleanup_pop(1);
if (ap->type == LKP_INDIRECT) {
+ struct ioctl_ops *ops = get_ioctl_ops();
+ time_t timeout = ap->entry->maps->exp_timeout;
+ ap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO;
+ ops->timeout(ap->logopt, ap->ioctlfd, timeout);
lookup_prune_cache(ap, now);
status = lookup_ghost(ap, ap->path);
} else {
--- autofs-5.0.6.orig/include/automount.h
+++ autofs-5.0.6/include/automount.h
@@ -114,6 +114,8 @@ int load_autofs4_module(void);
#define DB(x) do { } while(0)
#endif
+#define min(a, b) (a <= b ? a : b)
+
/* Forward declaraion */
struct autofs_point;
@@ -461,7 +463,6 @@ struct autofs_point {
dev_t dev; /* "Device" number assigned by kernel */
struct master_mapent *entry; /* Master map entry for this mount */
unsigned int type; /* Type of map direct or indirect */
- time_t exp_timeout; /* Timeout for expiring mounts */
time_t exp_runfreq; /* Frequency for polling for timeouts */
time_t negative_timeout; /* timeout in secs for failed mounts */
unsigned int flags; /* autofs mount flags */
@@ -495,7 +496,7 @@ void *expire_proc_indirect(void *);
void *expire_proc_direct(void *);
int expire_offsets_direct(struct autofs_point *ap, struct mapent *me, int now);
int mount_autofs_indirect(struct autofs_point *ap, const char *root);
-int do_mount_autofs_direct(struct autofs_point *ap, struct mnt_list *mnts, struct mapent *me);
+int do_mount_autofs_direct(struct autofs_point *ap, struct mnt_list *mnts, struct mapent *me, time_t timeout);
int mount_autofs_direct(struct autofs_point *ap);
int mount_autofs_offset(struct autofs_point *ap, struct mapent *me, const char *root, const char *offset);
void submount_signal_parent(struct autofs_point *ap, unsigned int success);
--- autofs-5.0.6.orig/include/master.h
+++ autofs-5.0.6/include/master.h
@@ -23,6 +23,7 @@
struct map_source {
char *type;
char *format;
+ time_t exp_timeout; /* Timeout for expiring mounts */
time_t age;
unsigned int master_line;
struct mapent_cache *mc;
@@ -78,7 +79,7 @@ void master_mutex_unlock(void);
void master_mutex_lock_cleanup(void *);
void master_set_default_timeout(void);
void master_set_default_ghost_mode(void);
-int master_add_autofs_point(struct master_mapent *, time_t, unsigned, unsigned, unsigned, int);
+int master_add_autofs_point(struct master_mapent *, unsigned, unsigned, unsigned, int);
void master_free_autofs_point(struct autofs_point *);
struct map_source *
master_add_map_source(struct master_mapent *, char *, char *, time_t, int, const char **);
--- autofs-5.0.6.orig/include/mounts.h
+++ autofs-5.0.6/include/mounts.h
@@ -120,7 +120,7 @@ int tree_find_mnt_ents(struct mnt_list *
int tree_is_mounted(struct mnt_list *mnts, const char *path, unsigned int type);
void set_tsd_user_vars(unsigned int, uid_t, gid_t);
const char *mount_type_str(unsigned int);
-void notify_mount_result(struct autofs_point *, const char *, const char *);
+void notify_mount_result(struct autofs_point *, const char *, time_t, const char *);
int try_remount(struct autofs_point *, struct mapent *, unsigned int);
int umount_ent(struct autofs_point *, const char *);
int mount_multi_triggers(struct autofs_point *, struct mapent *, const char *, unsigned int, const char *);
--- autofs-5.0.6.orig/lib/master.c
+++ autofs-5.0.6/lib/master.c
@@ -65,9 +65,8 @@ void master_mutex_lock_cleanup(void *arg
return;
}
-int master_add_autofs_point(struct master_mapent *entry, time_t timeout,
- unsigned logopt, unsigned nobind, unsigned ghost,
- int submount)
+int master_add_autofs_point(struct master_mapent *entry, unsigned logopt,
+ unsigned nobind, unsigned ghost, int submount)
{
struct autofs_point *ap;
int status;
@@ -91,7 +90,6 @@ int master_add_autofs_point(struct maste
ap->entry = entry;
ap->exp_thread = 0;
ap->readmap_thread = 0;
- ap->exp_timeout = timeout;
/*
* Program command line option overrides config.
* We can't use 0 negative timeout so use default.
@@ -100,7 +98,7 @@ int master_add_autofs_point(struct maste
ap->negative_timeout = defaults_get_negative_timeout();
else
ap->negative_timeout = global_negative_timeout;
- ap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO;
+ ap->exp_runfreq = 0;
ap->flags = 0;
if (ghost)
ap->flags = MOUNT_FLAG_GHOST;
@@ -437,6 +435,7 @@ master_add_source_instance(struct map_so
new->age = age;
new->master_line = 0;
new->mc = source->mc;
+ new->exp_timeout = source->exp_timeout;
new->stale = 1;
tmpargv = copy_argv(argc, argv);
--- autofs-5.0.6.orig/lib/master_parse.y
+++ autofs-5.0.6/lib/master_parse.y
@@ -765,9 +765,6 @@ int master_parse_entry(const char *buffe
logopt |= (verbose ? LOGOPT_VERBOSE : 0);
}
- if (timeout < 0)
- timeout = default_timeout;
-
new = NULL;
entry = master_find_mapent(master, path);
if (!entry) {
@@ -789,8 +786,19 @@ int master_parse_entry(const char *buffe
}
}
+ if (timeout < 0) {
+ /*
+ * If no timeout is given get the timout from first
+ * map (if it exists).
+ */
+ if (entry->maps)
+ timeout = entry->maps->exp_timeout;
+ else
+ timeout = default_timeout;
+ }
+
if (!entry->ap) {
- ret = master_add_autofs_point(entry, timeout, logopt, nobind, ghost, 0);
+ ret = master_add_autofs_point(entry, logopt, nobind, ghost, 0);
if (!ret) {
error(m_logopt, "failed to add autofs_point");
if (new)
@@ -798,20 +806,6 @@ int master_parse_entry(const char *buffe
local_free_vars();
return 0;
}
- } else {
- struct ioctl_ops *ops = get_ioctl_ops();
- struct autofs_point *ap = entry->ap;
-
- /*
- * Second and subsequent instances of a mount point
- * use the ghost, log and timeout of the first
- */
- if (entry->age < age) {
- ap->exp_timeout = timeout;
- ap->exp_runfreq = (ap->exp_timeout + CHECK_RATIO - 1) / CHECK_RATIO;
- if (ap->ioctlfd != -1 && ap->type == LKP_INDIRECT)
- ops->timeout(ap->logopt, ap->ioctlfd, timeout);
- }
}
if (random_selection)
entry->ap->flags |= MOUNT_FLAG_RANDOM_SELECT;
@@ -838,7 +832,7 @@ int master_parse_entry(const char *buffe
local_free_vars();
return 0;
}
-
+ source->exp_timeout = timeout;
source->master_line = lineno;
entry->age = age;
--- autofs-5.0.6.orig/lib/mounts.c
+++ autofs-5.0.6/lib/mounts.c
@@ -1268,13 +1268,12 @@ const char *mount_type_str(const unsigne
}
void notify_mount_result(struct autofs_point *ap,
- const char *path, const char *type)
+ const char *path, time_t timeout, const char *type)
{
- if (ap->exp_timeout)
+ if (timeout)
info(ap->logopt,
"mounted %s on %s with timeout %u, freq %u seconds",
- type, path,
- (unsigned int) ap->exp_timeout,
+ type, path, (unsigned int) timeout,
(unsigned int) ap->exp_runfreq);
else
info(ap->logopt,
@@ -1382,16 +1381,14 @@ static int do_remount_indirect(struct au
}
static int remount_active_mount(struct autofs_point *ap,
- struct mapent_cache *mc,
- const char *path, dev_t devid,
- const unsigned int type,
- int *ioctlfd)
+ struct mapent *me, const char *path, dev_t devid,
+ const unsigned int type, int *ioctlfd)
{
struct ioctl_ops *ops = get_ioctl_ops();
- time_t timeout = ap->exp_timeout;
const char *str_type = mount_type_str(type);
char buf[MAX_ERR_BUF];
unsigned int mounted;
+ time_t timeout;
struct stat st;
int fd;
@@ -1401,6 +1398,12 @@ static int remount_active_mount(struct a
ops->open(ap->logopt, &fd, devid, path);
if (fd == -1)
return REMOUNT_OPEN_FAIL;
+ else {
+ if (type == t_indirect || type == t_offset)
+ timeout = ap->entry->maps->exp_timeout;
+ else
+ timeout = me->source->exp_timeout;
+ }
/* Re-reading the map, set timeout and return */
if (ap->state == ST_READMAP) {
@@ -1434,11 +1437,11 @@ static int remount_active_mount(struct a
ops->close(ap->logopt, fd);
return REMOUNT_STAT_FAIL;
}
- if (mc)
- cache_set_ino_index(mc, path, st.st_dev, st.st_ino);
+ if (type != t_indirect)
+ cache_set_ino_index(me->mc, path, st.st_dev, st.st_ino);
else
ap->dev = st.st_dev;
- notify_mount_result(ap, path, str_type);
+ notify_mount_result(ap, path, timeout, str_type);
*ioctlfd = fd;
@@ -1481,24 +1484,20 @@ static int remount_active_mount(struct a
int try_remount(struct autofs_point *ap, struct mapent *me, unsigned int type)
{
struct ioctl_ops *ops = get_ioctl_ops();
- struct mapent_cache *mc;
const char *path;
int ret, fd;
dev_t devid;
- if (type == t_indirect) {
- mc = NULL;
+ if (type == t_indirect)
path = ap->path;
- } else {
- mc = me->mc;
+ else
path = me->key;
- }
ret = ops->mount_device(ap->logopt, path, type, &devid);
if (ret == -1 || ret == 0)
return -1;
- ret = remount_active_mount(ap, mc, path, devid, type, &fd);
+ ret = remount_active_mount(ap, me, path, devid, type, &fd);
/*
* The directory must exist since we found a device
--- autofs-5.0.6.orig/modules/mount_autofs.c
+++ autofs-5.0.6/modules/mount_autofs.c
@@ -51,7 +51,7 @@ int mount_mount(struct autofs_point *ap,
int argc, status;
int nobind = ap->flags & MOUNT_FLAG_NOBIND;
int ghost = ap->flags & MOUNT_FLAG_GHOST;
- time_t timeout = ap->exp_timeout;
+ time_t timeout = ap->entry->maps->exp_timeout;
unsigned logopt = ap->logopt;
struct map_type_info *info;
struct master *master;
@@ -149,7 +149,7 @@ int mount_mount(struct autofs_point *ap,
return 1;
}
- ret = master_add_autofs_point(entry, timeout, logopt, nobind, ghost, 1);
+ ret = master_add_autofs_point(entry, logopt, nobind, ghost, 1);
if (!ret) {
error(ap->logopt,
MODPREFIX "failed to add autofs_point to entry");
@@ -203,6 +203,7 @@ int mount_mount(struct autofs_point *ap,
return 1;
}
free_map_type_info(info);
+ source->exp_timeout = timeout;
mounts_mutex_lock(ap);

View File

@ -1,248 +0,0 @@
autofs-5.0.6 - refactor hosts lookup module
From: Ian Kent <ikent@redhat.com>
Simplify lookup hosts lookup_mount() function.
---
modules/lookup_hosts.c | 206 ++++++++++++++++++++++++-------------------------
1 file changed, 101 insertions(+), 105 deletions(-)
--- autofs-5.0.6.orig/modules/lookup_hosts.c
+++ autofs-5.0.6/modules/lookup_hosts.c
@@ -78,6 +78,94 @@ int lookup_read_master(struct master *ma
return NSS_STATUS_UNKNOWN;
}
+static char *get_exports(struct autofs_point *ap, const char *host)
+{
+ char *mapent = NULL;
+ exports exp;
+
+ debug(ap->logopt, MODPREFIX "fetchng export list for %s", name);
+
+ exp = rpc_get_exports(host, 10, 0, RPC_CLOSE_NOLINGER);
+
+ mapent = NULL;
+ while (exp) {
+ if (mapent) {
+ int len = strlen(mapent) + 1;
+
+ len += strlen(name) + 2*(strlen(exp->ex_dir) + 2) + 3;
+ mapent = realloc(mapent, len);
+ if (!mapent) {
+ char *estr;
+ estr = strerror_r(errno, buf, MAX_ERR_BUF);
+ error(ap->logopt, MODPREFIX "malloc: %s", estr);
+ rpc_exports_free(exp);
+ return NSS_STATUS_UNAVAIL;
+ }
+ strcat(mapent, " \"");
+ strcat(mapent, exp->ex_dir);
+ strcat(mapent, "\"");
+ } else {
+ int len = 2*(strlen(exp->ex_dir) + 2) + strlen(name) + 3;
+
+ mapent = malloc(len);
+ if (!mapent) {
+ char *estr;
+ estr = strerror_r(errno, buf, MAX_ERR_BUF);
+ error(ap->logopt, MODPREFIX "malloc: %s", estr);
+ rpc_exports_free(exp);
+ return NSS_STATUS_UNAVAIL;
+ }
+ strcpy(mapent, "\"");
+ strcat(mapent, exp->ex_dir);
+ strcat(mapent, "\"");
+ }
+ strcat(mapent, " \"");
+ strcat(mapent, name);
+ strcat(mapent, ":");
+ strcat(mapent, exp->ex_dir);
+ strcat(mapent, "\"");
+
+ exp = exp->ex_next;
+ }
+ rpc_exports_free(exp);
+
+ if (!mapent)
+ error(ap->logopt, "exports lookup failed for %s", name);
+
+ return mapent;
+}
+
+static int do_parse_mount(struct autofs_point *ap,
+ const char *name, int name_len, char *mapent,
+ void *context)
+{
+ int ret;
+
+ master_source_current_wait(ap->entry);
+ ap->entry->current = source;
+
+ ret = ctxt->parse->parse_mount(ap, name, name_len,
+ mapent, ctxt->parse->context);
+ if (ret) {
+ time_t now = time(NULL);
+ struct mapent_cache *mc = source->mc;
+ struct mapent *me;
+ int rv = CHE_OK;
+
+ cache_writelock(mc);
+ me = cache_lookup_distinct(mc, name);
+ if (!me)
+ rv = cache_update(mc, source, name, NULL, now);
+ if (rv != CHE_FAIL) {
+ me = cache_lookup_distinct(mc, name);
+ me->status = now + ap->negative_timeout;
+ }
+ cache_unlock(mc);
+ return NSS_STATUS_TRYAGAIN;
+ }
+ return NSS_STATUS_SUCCESS;
+}
+
int lookup_read_map(struct autofs_point *ap, time_t age, void *context)
{
struct map_source *source;
@@ -209,126 +297,34 @@ int lookup_mount(struct autofs_point *ap
if (*name == '/') {
pthread_cleanup_push(cache_lock_cleanup, mc);
mapent_len = strlen(me->mapent);
- mapent = alloca(mapent_len + 1);
+ mapent = malloc(mapent_len + 1);
if (mapent)
strcpy(mapent, me->mapent);
pthread_cleanup_pop(0);
}
cache_unlock(mc);
- if (mapent) {
- master_source_current_wait(ap->entry);
- ap->entry->current = source;
-
- debug(ap->logopt, MODPREFIX "%s -> %s", name, me->mapent);
-
- ret = ctxt->parse->parse_mount(ap, name, name_len,
- mapent, ctxt->parse->context);
-
- if (ret) {
- time_t now = time(NULL);
- int rv = CHE_OK;
-
- cache_writelock(mc);
- me = cache_lookup_distinct(mc, name);
- if (!me)
- rv = cache_update(mc, source, name, NULL, now);
- if (rv != CHE_FAIL) {
- me = cache_lookup_distinct(mc, name);
- me->status = now + ap->negative_timeout;
- }
- cache_unlock(mc);
- return NSS_STATUS_TRYAGAIN;
- }
- return NSS_STATUS_SUCCESS;
- }
done:
- /*
- * Otherwise we need to get the exports list and add update
- * the cache.
- */
- debug(ap->logopt, MODPREFIX "fetchng export list for %s", name);
-
- exp = rpc_get_exports(name, 10, 0, RPC_CLOSE_NOLINGER);
-
- mapent = NULL;
- while (exp) {
- if (mapent) {
- int len = strlen(mapent) + 1;
-
- len += strlen(name) + 2*(strlen(exp->ex_dir) + 2) + 3;
- mapent = realloc(mapent, len);
- if (!mapent) {
- char *estr;
- estr = strerror_r(errno, buf, MAX_ERR_BUF);
- logerr(MODPREFIX "malloc: %s", estr);
- rpc_exports_free(exp);
- return NSS_STATUS_UNAVAIL;
- }
- strcat(mapent, " \"");
- strcat(mapent, exp->ex_dir);
- strcat(mapent, "\"");
- } else {
- int len = 2*(strlen(exp->ex_dir) + 2) + strlen(name) + 3;
-
- mapent = malloc(len);
- if (!mapent) {
- char *estr;
- estr = strerror_r(errno, buf, MAX_ERR_BUF);
- logerr(MODPREFIX "malloc: %s", estr);
- rpc_exports_free(exp);
- return NSS_STATUS_UNAVAIL;
- }
- strcpy(mapent, "\"");
- strcat(mapent, exp->ex_dir);
- strcat(mapent, "\"");
- }
- strcat(mapent, " \"");
- strcat(mapent, name);
- strcat(mapent, ":");
- strcat(mapent, exp->ex_dir);
- strcat(mapent, "\"");
-
- exp = exp->ex_next;
- }
- rpc_exports_free(exp);
-
- /* Exports lookup failed so we're outa here */
- if (!mapent) {
- error(ap->logopt, "exports lookup failed for %s", name);
- return NSS_STATUS_UNAVAIL;
- }
-
debug(ap->logopt, MODPREFIX "%s -> %s", name, mapent);
- cache_writelock(mc);
- cache_update(mc, source, name, mapent, now);
- cache_unlock(mc);
-
- master_source_current_wait(ap->entry);
- ap->entry->current = source;
-
- ret = ctxt->parse->parse_mount(ap, name, name_len,
- mapent, ctxt->parse->context);
- free(mapent);
+ if (!mapent) {
+ /* We need to get the exports list and update the cache. */
+ mapent = get_exports(ap, name);
- if (ret) {
- time_t now = time(NULL);
- int rv = CHE_OK;
+ /* Exports lookup failed so we're outa here */
+ if (!mapent)
+ return NSS_STATUS_UNAVAIL;
cache_writelock(mc);
- me = cache_lookup_distinct(mc, name);
- if (!me)
- rv = cache_update(mc, source, name, NULL, now);
- if (rv != CHE_FAIL) {
- me = cache_lookup_distinct(mc, name);
- me->status = now + ap->negative_timeout;
- }
+ cache_update(mc, source, name, mapent, now);
cache_unlock(mc);
- return NSS_STATUS_TRYAGAIN;
}
- return NSS_STATUS_SUCCESS;
+ ret = do_parse_mount(ap, name, name_len, mapent, ctxt->parse->context);
+
+ free(mapent);
+
+ return ret;
}
int lookup_done(void *context)

View File

@ -1,105 +0,0 @@
autofs-5.0.6 - reinstate singleton mount probe
From: Ian Kent <ikent@redhat.com>
The change to have the kernel process text based mount options can
introduce lengthy timeout waits when attempting a mount to a host
that is not available.
To avoid these waits autofs should probe singleton mounts if it
thinks mount.nfs will pass text options to the kernel (which of
course implies the kernel supports this).
---
CHANGELOG | 1 +
daemon/automount.c | 7 +++++++
include/mounts.h | 1 +
modules/replicated.c | 18 ++++++++++++++++--
4 files changed, 25 insertions(+), 2 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -26,6 +26,7 @@
- ignore duplicate exports in auto.net.
- add kernel verion check function.
- add function to check mount.nfs version.
+- reinstate singleton mount probe.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/daemon/automount.c
+++ autofs-5.0.6/daemon/automount.c
@@ -51,6 +51,9 @@ const char *libdir = AUTOFS_LIB_DIR; /*
const char *mapdir = AUTOFS_MAP_DIR; /* Location of mount maps */
const char *confdir = AUTOFS_CONF_DIR; /* Location of autofs config file */
+unsigned int nfs_mount_uses_string_options = 0;
+static struct nfs_mount_vers vers, check = {1, 1, 1};
+
/* autofs fifo name prefix */
const char *fifodir = AUTOFS_FIFO_DIR "/autofs.fifo";
@@ -1273,6 +1276,8 @@ static int do_hup_signal(struct master *
if (status)
fatal(status);
+ nfs_mount_uses_string_options = check_nfs_mount_version(&vers, &check);
+
master_mutex_lock();
if (master->reading) {
status = pthread_mutex_unlock(&mrc.mutex);
@@ -1936,6 +1941,8 @@ int main(int argc, char *argv[])
defaults_read_config(0);
+ nfs_mount_uses_string_options = check_nfs_mount_version(&vers, &check);
+
kpkt_len = get_kpkt_len();
timeout = defaults_get_timeout();
ghost = defaults_get_browse_mode();
--- autofs-5.0.6.orig/include/mounts.h
+++ autofs-5.0.6/include/mounts.h
@@ -95,6 +95,7 @@ struct nfs_mount_vers {
unsigned int fix;
};
int check_nfs_mount_version(struct nfs_mount_vers *, struct nfs_mount_vers *);
+extern unsigned int nfs_mount_uses_string_options;
unsigned int query_kproto_ver(void);
unsigned int get_kver_major(void);
--- autofs-5.0.6.orig/modules/replicated.c
+++ autofs-5.0.6/modules/replicated.c
@@ -901,6 +901,7 @@ int prune_host_list(unsigned logopt, str
unsigned int v2_udp_count, v3_udp_count, v4_udp_count;
unsigned int max_udp_count, max_tcp_count, max_count;
int status;
+ int kern_vers;
if (!*list)
return 0;
@@ -920,9 +921,22 @@ int prune_host_list(unsigned logopt, str
* or a single host entry whose proximity isn't local. If so
* return immediately as we don't want to add probe latency for
* the common case of a single filesystem mount request.
+ *
+ * But, if the kernel understands text nfs mount options then
+ * mount.nfs most likely bypasses its probing and lets the kernel
+ * do all the work. This can lead to long timeouts for hosts that
+ * are not available so check the kernel version and mount.nfs
+ * version and probe singleton mounts if the kernel version is
+ * greater than 2.6.22 and mount.nfs version is greater than 1.1.1.
*/
- if (!this || !this->next)
- return 1;
+ if (nfs_mount_uses_string_options &&
+ (kern_vers = linux_version_code()) > KERNEL_VERSION(2, 6, 22)) {
+ if (!this)
+ return 1;
+ } else {
+ if (!this || !this->next)
+ return 1;
+ }
proximity = this->proximity;
while (this) {

View File

@ -1,47 +0,0 @@
autofs-5.0.6 - remove cache update from parse_mount()
From: Ian Kent <ikent@redhat.com>
I'm not sure why I added this update in the parse sun module.
The lookup modules have the job of updating the map entry cache and
I can't see why an entry would be missing since the parse function
is called following the entry lookup (which does the update).
---
modules/parse_sun.c | 23 -----------------------
1 file changed, 23 deletions(-)
--- autofs-5.0.6.orig/modules/parse_sun.c
+++ autofs-5.0.6/modules/parse_sun.c
@@ -1383,29 +1383,6 @@ int parse_mount(struct autofs_point *ap,
strcat(m_root, name);
}
- /*
- * Can't take the write lock for direct mount entries here
- * but they should always be present in the map entry cache.
- */
- if (ap->type == LKP_INDIRECT) {
- cache_writelock(mc);
- me = cache_lookup_distinct(mc, name);
- if (!me) {
- int ret;
- /*
- * Not in the cache, perhaps it's a program map
- * or one that doesn't support enumeration.
- */
- ret = cache_add(mc, source, name, mapent, age);
- if (ret == CHE_FAIL) {
- cache_unlock(mc);
- free(options);
- return 1;
- }
- }
- cache_unlock(mc);
- }
-
cache_readlock(mc);
me = cache_lookup_distinct(mc, name);
if (me) {

View File

@ -1,113 +0,0 @@
autofs-5.0.6 - remove empty command line arguments
From: Ian Kent <raven@themaw.net>
When invoking the automount daemon from a systemd unit file a macro
that evaluates to the empty string is passed as an empty argument
unlike the shell environment within which unquoted arguments are
seen as white space and are not passed at all.
These empty arguments confuse getopt(3) and cause the program
parameters to be misread so we need to remove them before calling
getopt(3).
---
CHANGELOG | 1 +
daemon/automount.c | 39 +++++++++++++++++++++++++++++++++++----
2 files changed, 36 insertions(+), 4 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -18,6 +18,7 @@
- fix ipv6 configure check.
- add piddir to configure.
- add systemd unit support.
+- remove empty command line arguments (passed by systemd).
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/daemon/automount.c
+++ autofs-5.0.6/daemon/automount.c
@@ -1865,6 +1865,34 @@ static int convert_log_priority(char *pr
return -1;
}
+static void remove_empty_args(char **argv, int *argc)
+{
+ int next_to_last = *argc - 1;
+ int i, j;
+
+ for (i = j = 1; i < *argc; i++) {
+ if (*argv[i]) {
+ j++;
+ continue;
+ }
+
+ while (i < *argc && argv[i] && !*argv[i]) i++;
+
+ if (i == *argc)
+ break;
+
+ if (i == next_to_last) {
+ if (*argv[i])
+ argv[j++] = argv[i];
+ break;
+ } else {
+ argv[j++] = argv[i];
+ argv[i--] = "";
+ }
+ }
+ *argc = j;
+}
+
int main(int argc, char *argv[])
{
int res, opt, status;
@@ -1874,6 +1902,7 @@ int main(int argc, char *argv[])
time_t timeout;
time_t age = time(NULL);
struct rlimit rlim;
+ const char *options = "+hp:t:vmdD:fVrO:l:n:CF";
static const struct option long_options[] = {
{"help", 0, 0, 'h'},
{"pid-file", 1, 0, 'p'},
@@ -1918,8 +1947,10 @@ int main(int argc, char *argv[])
dumpmaps = 0;
daemon_check = 1;
+ remove_empty_args(argv, &argc);
+
opterr = 0;
- while ((opt = getopt_long(argc, argv, "+hp:t:vmdD:fVrO:l:n:CF", long_options, NULL)) != EOF) {
+ while ((opt = getopt_long(argc, argv, options, long_options, NULL)) != EOF) {
switch (opt) {
case 'h':
usage();
@@ -2066,7 +2097,7 @@ int main(int argc, char *argv[])
res = setrlimit(RLIMIT_NOFILE, &rlim);
if (res)
printf("%s: can't increase open file limit - continuing",
- argv[0]);
+ program);
#if ENABLE_CORES
rlim.rlim_cur = RLIM_INFINITY;
@@ -2074,7 +2105,7 @@ int main(int argc, char *argv[])
res = setrlimit(RLIMIT_CORE, &rlim);
if (res)
printf("%s: can't increase core file limit - continuing",
- argv[0]);
+ program);
#endif
if (argc == 0)
@@ -2097,7 +2128,7 @@ int main(int argc, char *argv[])
nc = cache_init_null_cache(master_list);
if (!nc) {
printf("%s: failed to init null map cache for %s",
- master_list->name, argv[0]);
+ program, master_list->name);
exit(1);
}
master_list->nc = nc;

View File

@ -1,421 +0,0 @@
autofs-5.0.6 - remove move mount code and configure option
From: Ian Kent <ikent@redhat.com>
The code to construct a multi-mount tree in a temporary location and then
move it into place is obsolete when using a kernel which includes the
vfs-automount infrastructure.
It is incompatible with systemd and cannot be used if systemd is being used.
So it's being removed.
---
autofs.spec | 2
configure | 18 ----
configure.in | 10 --
daemon/automount.c | 5 -
include/config.h.in | 3
modules/parse_sun.c | 195 +---------------------------------------------------
6 files changed, 7 insertions(+), 226 deletions(-)
--- autofs-5.0.6.orig/autofs.spec
+++ autofs-5.0.6/autofs.spec
@@ -74,7 +74,7 @@ echo %{version}-%{release} > .version
%endif
%build
-CFLAGS="$RPM_OPT_FLAGS -Wall" ./configure --libdir=%{_libdir} --disable-mount-locking --enable-ignore-busy --with-libtirpc --disable-mount-move %{?systemd_configure_arg:}
+CFLAGS="$RPM_OPT_FLAGS -Wall" ./configure --libdir=%{_libdir} --disable-mount-locking --enable-ignore-busy --with-libtirpc %{?systemd_configure_arg:}
CFLAGS="$RPM_OPT_FLAGS -Wall" make initdir=/etc/rc.d/init.d DONTSTRIP=1
%install
--- autofs-5.0.6.orig/configure
+++ autofs-5.0.6/configure
@@ -719,7 +719,6 @@ with_openldap
with_sasl
enable_ext_env
enable_mount_locking
-enable_mount_move
enable_forced_shutdown
enable_ignore_busy
'
@@ -1343,7 +1342,6 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--disable-ext-env disable search in environment for substitution variable
--disable-mount-locking disable use of locking when spawning mount command
- --disable-mount-move disable use of mount move when when preparing tree of mounts
--enable-force-shutdown enable USR1 signal to force unlink umount of any
busy mounts during shutdown
--enable-ignore-busy enable exit without umounting busy mounts during
@@ -5447,22 +5445,6 @@ $as_echo "#define ENABLE_MOUNT_LOCKING 1
fi
-#
-# Disable use of mount move
-#
-# Check whether --enable-mount-move was given.
-if test "${enable_mount_move+set}" = set; then :
- enableval=$enable_mount_move;
-else
- enableval=yes
-fi
-
-if test x$enable_mount_move = xyes -o x$enableval = xyes; then
-
-$as_echo "#define ENABLE_MOUNT_MOVE 1" >>confdefs.h
-
-fi
-
#
# Enable forced shutdown on USR1 signal (unlink umounts all mounts).
#
--- autofs-5.0.6.orig/configure.in
+++ autofs-5.0.6/configure.in
@@ -338,16 +338,6 @@ if test x$enable_mount_locking = xyes -o
fi
#
-# Disable use of mount move
-#
-AC_ARG_ENABLE(mount-move,
-[ --disable-mount-move disable use of mount move when when preparing tree of mounts],,
- enableval=yes)
-if test x$enable_mount_move = xyes -o x$enableval = xyes; then
- AC_DEFINE(ENABLE_MOUNT_MOVE, 1, [Disable use of mount move when preparing tree of mounts])
-fi
-
-#
# Enable forced shutdown on USR1 signal (unlink umounts all mounts).
#
AC_ARG_ENABLE(forced-shutdown,
--- autofs-5.0.6.orig/daemon/automount.c
+++ autofs-5.0.6/daemon/automount.c
@@ -1748,11 +1748,6 @@ static void show_build_info(void)
count = 22;
#endif
-#ifndef ENABLE_MOUNT_MOVE
- printf("DISABLE_MOUNT_MOVE ");
- count = count + 19;
-#endif
-
#ifdef ENABLE_FORCED_SHUTDOWN
printf("ENABLE_FORCED_SHUTDOWN ");
count = count + 23;
--- autofs-5.0.6.orig/include/config.h.in
+++ autofs-5.0.6/include/config.h.in
@@ -12,9 +12,6 @@
/* Disable use of locking when spawning mount command */
#undef ENABLE_MOUNT_LOCKING
-/* Disable use of mount move when preparing tree of mounts */
-#undef ENABLE_MOUNT_MOVE
-
/* define if you have E2FSCK */
#undef HAVE_E2FSCK
--- autofs-5.0.6.orig/modules/parse_sun.c
+++ autofs-5.0.6/modules/parse_sun.c
@@ -37,10 +37,6 @@
#define MODPREFIX "parse(sun): "
-#define MOUNT_MOVE_NONE 0x00
-#define MOUNT_MOVE_AUTOFS 0x01
-#define MOUNT_MOVE_OTHER 0x02
-
int parse_version = AUTOFS_PARSE_VERSION; /* Required by protocol */
static struct mount_mod *mount_nfs = NULL;
@@ -1047,86 +1043,6 @@ static int parse_mapent(const char *ent,
return (p - ent);
}
-#ifdef ENABLE_MOUNT_MOVE
-static int move_mount(struct autofs_point *ap,
- const char *mm_tmp_root, const char *mm_root,
- unsigned int move)
-{
- char buf[MAX_ERR_BUF];
- int err;
-
- if (move == MOUNT_MOVE_NONE)
- return 1;
-
- err = mkdir_path(mm_root, 0555);
- if (err < 0 && errno != EEXIST) {
- error(ap->logopt,
- "failed to create move target mount point %s", mm_root);
- return 0;
- }
-
- if (move == MOUNT_MOVE_AUTOFS)
- err = mount(mm_tmp_root, mm_root, NULL, MS_MOVE, NULL);
- else
- err = spawn_mount(ap->logopt,
- "--move", mm_tmp_root, mm_root, NULL);
- if (err) {
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
- error(ap->logopt,
- "failed to move mount from %s to %s: %s",
- mm_tmp_root, mm_root, estr);
- return 0;
- }
-
- debug(ap->logopt,
- "moved mount tree from %s to %s", mm_tmp_root, mm_root);
-
- return 1;
-}
-#endif
-
-static void cleanup_multi_root(struct autofs_point *ap, const char *root,
- const char *path, unsigned int move)
-{
- if (move == MOUNT_MOVE_NONE)
- return;
-
- if (move == MOUNT_MOVE_OTHER)
- spawn_umount(ap->logopt, root, NULL);
- else {
- struct ioctl_ops *ops = get_ioctl_ops();
- struct autofs_point *submount;
-
- mounts_mutex_lock(ap);
- submount = __master_find_submount(ap, path);
- if (!submount) {
- mounts_mutex_unlock(ap);
- return;
- }
-
- alarm_delete(submount);
- st_remove_tasks(submount);
- st_wait_state(submount, ST_READY);
-
- submount->parent->submnt_count--;
- list_del_init(&submount->mounts);
-
- ops->catatonic(submount->logopt, submount->ioctlfd);
-
- mounts_mutex_unlock(ap);
-
- if (submount->thid) {
- pthread_cancel(submount->thid);
- close_mount_fds(submount);
- umount(root);
- destroy_logpri_fifo(submount);
- master_free_mapent_sources(submount->entry, 1);
- master_free_mapent(ap->entry);
- }
- }
- return;
-}
-
static void cleanup_multi_triggers(struct autofs_point *ap,
struct mapent *me, const char *root, int start,
const char *base)
@@ -1166,49 +1082,15 @@ static void cleanup_multi_triggers(struc
return;
}
-#ifdef ENABLE_MOUNT_MOVE
-static int check_fstype_autofs_option(const char *options)
-{
- char *tok, *tokbuf;
- int found;
-
- /*
- * Look for fstype= in options and return true if
- * the last occurrence is fstype=autofs.
- */
- found = 0;
- tokbuf = alloca(strlen(options) + 2);
- strcpy(tokbuf, options);
- tok = strtok_r(tokbuf, ",", &tokbuf);
- if (tok) {
- do {
- if (strstr(tok, "fstype=")) {
- if (strstr(tok, "autofs"))
- found = 1;
- else
- found = 0;
- }
- } while ((tok = strtok_r(NULL, ",", &tokbuf)));
- }
-
- return found;
-}
-#endif
-
static int mount_subtree(struct autofs_point *ap, struct mapent *me,
const char *name, char *loc, char *options, void *ctxt)
{
struct mapent *mm;
struct mapent *ro;
char *mm_root, *mm_base, *mm_key;
- const char *mnt_root, *target;
+ const char *mnt_root;
unsigned int mm_root_len, mnt_root_len;
int start, ret = 0, rv;
- unsigned int move = MOUNT_MOVE_NONE;
-#ifdef ENABLE_MOUNT_MOVE
- char t_dir[] = "/tmp/autoXXXXXX";
- char *mnt_tmp_root = NULL;
-#endif
rv = 0;
@@ -1227,26 +1109,12 @@ static int mount_subtree(struct autofs_p
}
mm_root_len = strlen(mm_root);
-#ifndef ENABLE_MOUNT_MOVE
mnt_root = mm_root;
mnt_root_len = mm_root_len;
-#else
- if (ap->flags & MOUNT_FLAG_REMOUNT) {
- mnt_root = mm_root;
- mnt_root_len = mm_root_len;
- } else {
- mnt_root = mkdtemp(t_dir);
- if (!mnt_root)
- return 1;
- mnt_root_len = strlen(mnt_root);
- mnt_tmp_root = (char *) mnt_root;
- }
-#endif
if (me == me->multi) {
/* name = NULL */
/* destination = mm_root */
- target = mm_root;
mm_base = "/";
/* Mount root offset if it exists */
@@ -1263,18 +1131,10 @@ static int mount_subtree(struct autofs_p
warn(ap->logopt,
MODPREFIX "failed to parse root offset");
cache_delete_offset_list(me->mc, name);
- goto error_out;
+ return 1;
}
ro_len = strlen(ro_loc);
-#ifdef ENABLE_MOUNT_MOVE
- if (!(ap->flags & MOUNT_FLAG_REMOUNT)) {
- move = MOUNT_MOVE_OTHER;
- if (check_fstype_autofs_option(myoptions))
- move = MOUNT_MOVE_AUTOFS;
- }
-#endif
-
tmp = alloca(mnt_root_len + 1);
strcpy(tmp, mnt_root);
tmp[mnt_root_len] = '/';
@@ -1293,44 +1153,25 @@ static int mount_subtree(struct autofs_p
error(ap->logopt, MODPREFIX
"failed to mount offset triggers");
cleanup_multi_triggers(ap, me, mnt_root, start, mm_base);
- cleanup_multi_root(ap, mnt_root, mm_root, move);
- goto error_out;
+ return 1;
}
} else if (rv <= 0) {
-#ifdef ENABLE_MOUNT_MOVE
- move = MOUNT_MOVE_NONE;
-#endif
ret = mount_multi_triggers(ap, me, mm_root, start, mm_base);
if (ret == -1) {
error(ap->logopt, MODPREFIX
"failed to mount offset triggers");
cleanup_multi_triggers(ap, me, mm_root, start, mm_base);
- goto error_out;
+ return 1;
}
}
} else {
int loclen = strlen(loc);
int namelen = strlen(name);
-#ifndef ENABLE_MOUNT_MOVE
- /*
- * When using move mount to mount offsets or direct mounts
- * the base of the tree can be the base of the temporary
- * mount point it needs to be the full path when not moving
- * the mount after construction.
- */
mnt_root = name;
-#else
- if (!(ap->flags & MOUNT_FLAG_REMOUNT)) {
- move = MOUNT_MOVE_OTHER;
- if (check_fstype_autofs_option(options))
- move = MOUNT_MOVE_AUTOFS;
- }
-#endif
/* name = mm_root + mm_base */
/* destination = mm_root + mm_base = name */
- target = name;
mm_base = &me->key[start];
rv = sun_mount(ap, mnt_root, name, namelen, loc, loclen, options, ctxt);
@@ -1340,16 +1181,11 @@ static int mount_subtree(struct autofs_p
error(ap->logopt, MODPREFIX
"failed to mount offset triggers");
cleanup_multi_triggers(ap, me, mnt_root, start, mm_base);
- cleanup_multi_root(ap, mnt_root, mm_root, move);
- goto error_out;
+ return 1;
}
} else if (rv < 0) {
char *mm_root_base = alloca(strlen(mm_root) + strlen(mm_base) + 1);
-#ifdef ENABLE_MOUNT_MOVE
- move = MOUNT_MOVE_NONE;
-#endif
-
strcpy(mm_root_base, mm_root);
strcat(mm_root_base, mm_base);
@@ -1358,22 +1194,11 @@ static int mount_subtree(struct autofs_p
error(ap->logopt, MODPREFIX
"failed to mount offset triggers");
cleanup_multi_triggers(ap, me, mm_root, start, mm_base);
- goto error_out;
+ return 1;
}
}
}
-#ifdef ENABLE_MOUNT_MOVE
- if (!move_mount(ap, mnt_root, target, move)) {
- cleanup_multi_triggers(ap, me, mnt_root, start, mm_base);
- cleanup_multi_root(ap, mnt_root, mm_root, move);
- goto error_out;
- }
-
- if (mnt_tmp_root)
- rmdir(mnt_tmp_root);
-#endif
-
/* Mount for base of tree failed */
if (rv > 0)
return rv;
@@ -1386,14 +1211,6 @@ static int mount_subtree(struct autofs_p
rv = 0;
return rv;
-
-error_out:
-#ifdef ENABLE_MOUNT_MOVE
- if (mnt_tmp_root)
- rmdir(mnt_tmp_root);
-#endif
-
- return 1;
}
/*

View File

@ -1,99 +0,0 @@
autofs-5.0.6 - report map not read when debug logging
From: Ian Kent <ikent@redhat.com>
When a map read is called automount will report that is is reading the
map when debug logging is set. If a map read is not actually needed the
lookup module read map function should also report that it didn't need
to read the map.
---
CHANGELOG | 1 +
modules/lookup_hosts.c | 4 +++-
modules/lookup_ldap.c | 4 +++-
modules/lookup_nisplus.c | 4 +++-
modules/lookup_sss.c | 4 +++-
modules/lookup_yp.c | 4 +++-
6 files changed, 16 insertions(+), 5 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -42,6 +42,7 @@
- fix configure string length tests for sss library.
- fix initialization in rpc create_client().
- fix libtirpc name clash.
+- report map not read when debug logging.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/modules/lookup_hosts.c
+++ autofs-5.0.6/modules/lookup_hosts.c
@@ -94,8 +94,10 @@ int lookup_read_map(struct autofs_point
* reading the map. We always need to read the whole map for
* direct mounts in order to mount the triggers.
*/
- if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT)
+ if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT) {
+ debug(ap->logopt, "map read not needed, so not done");
return NSS_STATUS_SUCCESS;
+ }
mc = source->mc;
--- autofs-5.0.6.orig/modules/lookup_ldap.c
+++ autofs-5.0.6/modules/lookup_ldap.c
@@ -2326,8 +2326,10 @@ static int read_one_map(struct autofs_po
* reading the map. We always need to read the whole map for
* direct mounts in order to mount the triggers.
*/
- if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT)
+ if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT) {
+ debug(ap->logopt, "map read not needed, so not done");
return NSS_STATUS_SUCCESS;
+ }
sp.ap = ap;
sp.age = age;
--- autofs-5.0.6.orig/modules/lookup_nisplus.c
+++ autofs-5.0.6/modules/lookup_nisplus.c
@@ -185,8 +185,10 @@ int lookup_read_map(struct autofs_point
* reading the map. We always need to read the whole map for
* direct mounts in order to mount the triggers.
*/
- if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT)
+ if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT) {
+ debug(ap->logopt, "map read not needed, so not done");
return NSS_STATUS_SUCCESS;
+ }
mc = source->mc;
--- autofs-5.0.6.orig/modules/lookup_sss.c
+++ autofs-5.0.6/modules/lookup_sss.c
@@ -275,8 +275,10 @@ int lookup_read_map(struct autofs_point
* reading the map. We always need to read the whole map for
* direct mounts in order to mount the triggers.
*/
- if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT)
+ if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT) {
+ debug(ap->logopt, "map read not needed, so not done");
return NSS_STATUS_SUCCESS;
+ }
if (!setautomntent(ap->logopt, ctxt, ctxt->mapname, &sss_ctxt))
return NSS_STATUS_UNAVAIL;
--- autofs-5.0.6.orig/modules/lookup_yp.c
+++ autofs-5.0.6/modules/lookup_yp.c
@@ -327,8 +327,10 @@ int lookup_read_map(struct autofs_point
* reading the map. We always need to read the whole map for
* direct mounts in order to mount the triggers.
*/
- if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT)
+ if (!(ap->flags & MOUNT_FLAG_GHOST) && ap->type != LKP_DIRECT) {
+ debug(ap->logopt, "map read not needed, so not done");
return NSS_STATUS_SUCCESS;
+ }
ypcb_data.ap = ap;
ypcb_data.source = source;

View File

@ -1,618 +0,0 @@
autofs-5.0.6 - rework error return handling in rpc code
From: Ian Kent <raven@themaw.net>
With the changes to the way mount.nfs performs nfs mounts for
kernels that support passing of text based options mounts to
hosts that are down or unreachable can take a long time to
fail due to lengthy timeouts. The kernel rpc code is duty
bound to honour these timeouts so we need to find a way to
catch EHOSTUNREACH errors during host probing.
The first thing to do is to rework the lower level autofs
rpc code to propogate error returns up to the higher levels.
---
CHANGELOG | 1
lib/rpc_subs.c | 178 ++++++++++++++++++++++++++++-----------------------
modules/replicated.c | 26 +++----
3 files changed, 114 insertions(+), 91 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -27,6 +27,7 @@
- add kernel verion check function.
- add function to check mount.nfs version.
- reinstate singleton mount probe.
+- rework error return handling in rpc code.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/lib/rpc_subs.c
+++ autofs-5.0.6/lib/rpc_subs.c
@@ -76,11 +76,11 @@ static int connect_nb(int fd, struct soc
flags = fcntl(fd, F_GETFL, 0);
if (flags < 0)
- return -1;
+ return -errno;
ret = fcntl(fd, F_SETFL, flags | O_NONBLOCK);
if (ret < 0)
- return -1;
+ return -errno;
/*
* From here on subsequent sys calls could change errno so
@@ -150,14 +150,16 @@ done:
}
#ifndef WITH_LIBTIRPC
-static CLIENT *rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, int *fd)
+static int rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, int *fd, CLIENT **client)
{
- CLIENT *client = NULL;
+ CLIENT *clnt = NULL;
struct sockaddr_in in4_laddr;
struct sockaddr_in *in4_raddr;
int type, proto;
socklen_t slen;
+ *client = NULL;
+
proto = info->proto->p_proto;
if (proto == IPPROTO_UDP)
type = SOCK_DGRAM;
@@ -179,11 +181,11 @@ static CLIENT *rpc_do_create_client(stru
*fd = open_sock(addr->sa_family, type, proto);
if (*fd < 0)
- return NULL;
+ return -errno;
laddr = (struct sockaddr *) &in4_laddr;
if (bind(*fd, laddr, slen) < 0)
- return NULL;
+ return -errno;
}
in4_raddr = (struct sockaddr_in *) addr;
@@ -191,26 +193,29 @@ static CLIENT *rpc_do_create_client(stru
switch (info->proto->p_proto) {
case IPPROTO_UDP:
- client = clntudp_bufcreate(in4_raddr,
- info->program, info->version,
- info->timeout, fd,
- info->send_sz, info->recv_sz);
+ clnt = clntudp_bufcreate(in4_raddr,
+ info->program, info->version,
+ info->timeout, fd,
+ info->send_sz, info->recv_sz);
break;
case IPPROTO_TCP:
- if (connect_nb(*fd, addr, slen, &info->timeout) < 0)
- break;
-
- client = clnttcp_create(in4_raddr,
- info->program, info->version, fd,
- info->send_sz, info->recv_sz);
+ int ret = connect_nb(*fd, addr, slen, &info->timeout);
+ if (ret < 0)
+ return ret;
+
+ clnt = clnttcp_create(in4_raddr,
+ info->program, info->version, fd,
+ info->send_sz, info->recv_sz);
break;
default:
break;
}
- return client;
+ *client = clnt;
+
+ return 0;
}
#else
struct netconfig *find_netconf(void *handle, char *family, char *proto)
@@ -226,9 +231,9 @@ struct netconfig *find_netconf(void *han
return nconf;
}
-static CLIENT *rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, int *fd)
+static int rpc_do_create_client(struct sockaddr *addr, struct conn_info *info, int *fd, CLIENT **client)
{
- CLIENT *client = NULL;
+ CLIENT *clnt = NULL;
struct sockaddr_in in4_laddr;
struct sockaddr_in6 in6_laddr;
struct sockaddr *laddr = NULL;
@@ -238,6 +243,9 @@ static CLIENT *rpc_do_create_client(stru
char *nc_family, *nc_proto;
void *handle;
size_t slen;
+ int ret;
+
+ *client = NULL;
proto = info->proto->p_proto;
if (proto == IPPROTO_UDP) {
@@ -272,16 +280,16 @@ static CLIENT *rpc_do_create_client(stru
slen = sizeof(struct sockaddr_in6);
nc_family = NC_INET6;
} else
- return NULL;
+ return -EINVAL;
handle = setnetconfig();
if (!handle)
- return NULL;
+ return -EINVAL;
nconf = find_netconf(handle, nc_family, nc_proto);
if (!nconf) {
endnetconfig(handle);
- return NULL;
+ return -EINVAL;
}
/*
@@ -292,13 +300,15 @@ static CLIENT *rpc_do_create_client(stru
if (!info->client) {
*fd = open_sock(addr->sa_family, type, proto);
if (*fd < 0) {
+ ret = -errno;
endnetconfig(handle);
- return NULL;
+ return ret;
}
if (bind(*fd, laddr, slen) < 0) {
+ ret = -errno;
endnetconfig(handle);
- return NULL;
+ return ret;
}
}
@@ -306,28 +316,30 @@ static CLIENT *rpc_do_create_client(stru
nb_addr.buf = addr;
if (info->proto->p_proto == IPPROTO_TCP) {
- if (connect_nb(*fd, addr, slen, &info->timeout) < 0) {
+ ret = connect_nb(*fd, addr, slen, &info->timeout);
+ if (ret < 0) {
endnetconfig(handle);
- return NULL;
+ return ret;
}
}
- client = clnt_tli_create(*fd, nconf, &nb_addr,
- info->program, info->version,
- info->send_sz, info->recv_sz);
+ clnt = clnt_tli_create(*fd, nconf, &nb_addr,
+ info->program, info->version,
+ info->send_sz, info->recv_sz);
endnetconfig(handle);
- return client;
+ *client = clnt;
+
+ return 0;
}
#endif
/*
* Create an RPC client
*/
-static CLIENT *create_client(struct conn_info *info)
+static int create_client(struct conn_info *info, CLIENT **client)
{
- CLIENT *client = NULL;
struct addrinfo *ai, *haddr;
struct addrinfo hints;
int fd, ret;
@@ -346,9 +358,11 @@ static CLIENT *create_client(struct conn
}
if (info->addr) {
- client = rpc_do_create_client(info->addr, info, &fd);
- if (client)
+ ret = rpc_do_create_client(info->addr, info, &fd, client);
+ if (ret == 0)
goto done;
+ if (ret == -EHOSTUNREACH)
+ goto out_close;
if (!info->client && fd != RPC_ANYSOCK) {
close(fd);
@@ -376,9 +390,11 @@ static CLIENT *create_client(struct conn
continue;
}
- client = rpc_do_create_client(haddr->ai_addr, info, &fd);
- if (client)
+ ret = rpc_do_create_client(haddr->ai_addr, info, &fd, client);
+ if (ret == 0)
break;
+ if (ret == -EHOSTUNREACH)
+ goto out_close;
if (!info->client && fd != RPC_ANYSOCK) {
close(fd);
@@ -390,24 +406,26 @@ static CLIENT *create_client(struct conn
freeaddrinfo(ai);
- if (!client) {
+ if (!*client) {
info->client = NULL;
+ ret = -ENOTCONN;
goto out_close;
}
done:
/* Close socket fd on destroy, as is default for rpcowned fds */
- if (!clnt_control(client, CLSET_FD_CLOSE, NULL)) {
- clnt_destroy(client);
+ if (!clnt_control(*client, CLSET_FD_CLOSE, NULL)) {
+ clnt_destroy(*client);
info->client = NULL;
+ ret = -ENOTCONN;
goto out_close;
}
- return client;
+ return 0;
out_close:
if (fd != -1)
close(fd);
- return NULL;
+ return ret;
}
int rpc_udp_getclient(struct conn_info *info,
@@ -415,11 +433,12 @@ int rpc_udp_getclient(struct conn_info *
{
struct protoent *pe_proto;
CLIENT *client;
+ int ret;
if (!info->client) {
pe_proto = getprotobyname("udp");
if (!pe_proto)
- return 0;
+ return -ENOENT;
info->proto = pe_proto;
info->send_sz = UDPMSGSIZE;
@@ -429,14 +448,13 @@ int rpc_udp_getclient(struct conn_info *
info->program = program;
info->version = version;
- client = create_client(info);
-
- if (!client)
- return 0;
+ ret = create_client(info, &client);
+ if (ret < 0)
+ return ret;
info->client = client;
- return 1;
+ return 0;
}
void rpc_destroy_udp_client(struct conn_info *info)
@@ -454,11 +472,12 @@ int rpc_tcp_getclient(struct conn_info *
{
struct protoent *pe_proto;
CLIENT *client;
+ int ret;
if (!info->client) {
pe_proto = getprotobyname("tcp");
if (!pe_proto)
- return 0;
+ return -ENOENT;
info->proto = pe_proto;
info->send_sz = 0;
@@ -468,14 +487,13 @@ int rpc_tcp_getclient(struct conn_info *
info->program = program;
info->version = version;
- client = create_client(info);
-
- if (!client)
- return 0;
+ ret = create_client(info, &client);
+ if (ret < 0)
+ return ret;
info->client = client;
- return 1;
+ return 0;
}
void rpc_destroy_tcp_client(struct conn_info *info)
@@ -509,10 +527,11 @@ int rpc_portmap_getclient(struct conn_in
{
struct protoent *pe_proto;
CLIENT *client;
+ int ret;
pe_proto = getprotobyname(proto);
if (!pe_proto)
- return 0;
+ return -ENOENT;
info->host = host;
info->addr = addr;
@@ -530,13 +549,14 @@ int rpc_portmap_getclient(struct conn_in
if (pe_proto->p_proto == IPPROTO_TCP)
info->timeout.tv_sec = PMAP_TOUT_TCP;
- client = create_client(info);
- if (!client)
- return 0;
+
+ ret = create_client(info, &client);
+ if (ret < 0)
+ return ret;
info->client = client;
- return 1;
+ return 0;
}
unsigned short rpc_portmap_getport(struct conn_info *info, struct pmap *parms)
@@ -546,6 +566,7 @@ unsigned short rpc_portmap_getport(struc
CLIENT *client;
enum clnt_stat status;
int proto = info->proto->p_proto;
+ int ret;
memset(&pmap_info, 0, sizeof(struct conn_info));
@@ -567,9 +588,9 @@ unsigned short rpc_portmap_getport(struc
pmap_info.send_sz = RPCSMALLMSGSIZE;
pmap_info.recv_sz = RPCSMALLMSGSIZE;
- client = create_client(&pmap_info);
- if (!client)
- return 0;
+ ret = create_client(&pmap_info, &client);
+ if (ret < 0)
+ return ret;
}
/*
@@ -611,7 +632,7 @@ unsigned short rpc_portmap_getport(struc
}
if (status != RPC_SUCCESS)
- return 0;
+ return -EIO;
return port;
}
@@ -621,6 +642,7 @@ int rpc_ping_proto(struct conn_info *inf
CLIENT *client;
enum clnt_stat status;
int proto = info->proto->p_proto;
+ int ret;
if (info->client)
client = info->client;
@@ -629,9 +651,9 @@ int rpc_ping_proto(struct conn_info *inf
info->send_sz = UDPMSGSIZE;
info->recv_sz = UDPMSGSIZE;
}
- client = create_client(info);
- if (!client)
- return 0;
+ ret = create_client(info, &client);
+ if (ret < 0)
+ return ret;
}
clnt_control(client, CLSET_TIMEOUT, (char *) &info->timeout);
@@ -665,7 +687,7 @@ int rpc_ping_proto(struct conn_info *inf
}
if (status != RPC_SUCCESS)
- return 0;
+ return -EIO;
return 1;
}
@@ -704,7 +726,7 @@ static unsigned int __rpc_ping(const cha
parms.pm_port = 0;
info.port = rpc_portmap_getport(&info, &parms);
- if (!info.port)
+ if (info.port < 0)
return status;
status = rpc_ping_proto(&info);
@@ -719,19 +741,19 @@ int rpc_ping(const char *host, long seco
unsigned int status;
status = __rpc_ping(host, vers2, "udp", seconds, micros, option);
- if (status)
+ if (status > 0)
return RPC_PING_V2 | RPC_PING_UDP;
status = __rpc_ping(host, vers3, "udp", seconds, micros, option);
- if (status)
+ if (status > 0)
return RPC_PING_V3 | RPC_PING_UDP;
status = __rpc_ping(host, vers2, "tcp", seconds, micros, option);
- if (status)
+ if (status > 0)
return RPC_PING_V2 | RPC_PING_TCP;
status = __rpc_ping(host, vers3, "tcp", seconds, micros, option);
- if (status)
+ if (status > 0)
return RPC_PING_V3 | RPC_PING_TCP;
return status;
@@ -760,9 +782,8 @@ int rpc_time(const char *host,
status = __rpc_ping(host, vers, proto, seconds, micros, option);
gettimeofday(&end, &tz);
- if (!status) {
- return 0;
- }
+ if (status == RPC_PING_FAIL || status < 0)
+ return status;
taken = elapsed(start, end);
@@ -779,13 +800,14 @@ static int rpc_get_exports_proto(struct
int proto = info->proto->p_proto;
unsigned int option = info->close_option;
int vers_entry;
+ int ret;
if (info->proto->p_proto == IPPROTO_UDP) {
info->send_sz = UDPMSGSIZE;
info->recv_sz = UDPMSGSIZE;
}
- client = create_client(info);
- if (!client)
+ ret = create_client(info, &client);
+ if (ret < 0)
return 0;
clnt_control(client, CLSET_TIMEOUT, (char *) &info->timeout);
@@ -894,7 +916,7 @@ exports rpc_get_exports(const char *host
parms.pm_prot = info.proto->p_proto;
info.port = rpc_portmap_getport(&info, &parms);
- if (!info.port)
+ if (info.port < 0)
goto try_tcp;
memset(&exportlist, '\0', sizeof(exportlist));
@@ -911,7 +933,7 @@ try_tcp:
parms.pm_prot = info.proto->p_proto;
info.port = rpc_portmap_getport(&info, &parms);
- if (!info.port)
+ if (info.port < 0)
return NULL;
memset(&exportlist, '\0', sizeof(exportlist));
--- autofs-5.0.6.orig/modules/replicated.c
+++ autofs-5.0.6/modules/replicated.c
@@ -563,11 +563,11 @@ static unsigned int get_nfs_info(unsigne
status = rpc_udp_getclient(rpc_info, NFS_PROGRAM, NFS4_VERSION);
else
status = rpc_tcp_getclient(rpc_info, NFS_PROGRAM, NFS4_VERSION);
- if (status) {
+ if (!status) {
gettimeofday(&start, &tz);
status = rpc_ping_proto(rpc_info);
gettimeofday(&end, &tz);
- if (status) {
+ if (status > 0) {
double reply;
if (random_selection) {
/* Random value between 0 and 1 */
@@ -589,7 +589,7 @@ v3_ver:
status = rpc_portmap_getclient(pm_info,
host->name, host->addr, host->addr_len,
proto, RPC_CLOSE_DEFAULT);
- if (!status)
+ if (status)
goto done_ver;
}
@@ -603,7 +603,7 @@ v3_ver:
parms.pm_prot = rpc_info->proto->p_proto;
parms.pm_vers = NFS3_VERSION;
rpc_info->port = rpc_portmap_getport(pm_info, &parms);
- if (!rpc_info->port)
+ if (rpc_info->port < 0)
goto v2_ver;
}
@@ -611,11 +611,11 @@ v3_ver:
status = rpc_udp_getclient(rpc_info, NFS_PROGRAM, NFS3_VERSION);
else
status = rpc_tcp_getclient(rpc_info, NFS_PROGRAM, NFS3_VERSION);
- if (status) {
+ if (!status) {
gettimeofday(&start, &tz);
status = rpc_ping_proto(rpc_info);
gettimeofday(&end, &tz);
- if (status) {
+ if (status > 0) {
double reply;
if (random_selection) {
/* Random value between 0 and 1 */
@@ -643,7 +643,7 @@ v2_ver:
parms.pm_prot = rpc_info->proto->p_proto;
parms.pm_vers = NFS2_VERSION;
rpc_info->port = rpc_portmap_getport(pm_info, &parms);
- if (!rpc_info->port)
+ if (rpc_info->port < 0)
goto done_ver;
}
@@ -651,11 +651,11 @@ v2_ver:
status = rpc_udp_getclient(rpc_info, NFS_PROGRAM, NFS2_VERSION);
else
status = rpc_tcp_getclient(rpc_info, NFS_PROGRAM, NFS2_VERSION);
- if (status) {
+ if (!status) {
gettimeofday(&start, &tz);
status = rpc_ping_proto(rpc_info);
gettimeofday(&end, &tz);
- if (status) {
+ if (status > 0) {
double reply;
if (random_selection) {
/* Random value between 0 and 1 */
@@ -835,12 +835,12 @@ static int get_supported_ver_and_cost(un
int ret = rpc_portmap_getclient(&pm_info,
host->name, host->addr, host->addr_len,
proto, RPC_CLOSE_DEFAULT);
- if (!ret)
+ if (ret)
return 0;
parms.pm_prot = rpc_info.proto->p_proto;
rpc_info.port = rpc_portmap_getport(&pm_info, &parms);
- if (!rpc_info.port)
+ if (rpc_info.port < 0)
goto done;
}
@@ -848,11 +848,11 @@ static int get_supported_ver_and_cost(un
status = rpc_udp_getclient(&rpc_info, NFS_PROGRAM, parms.pm_vers);
else
status = rpc_tcp_getclient(&rpc_info, NFS_PROGRAM, parms.pm_vers);
- if (status) {
+ if (!status) {
gettimeofday(&start, &tz);
status = rpc_ping_proto(&rpc_info);
gettimeofday(&end, &tz);
- if (status) {
+ if (status > 0) {
if (random_selection) {
/* Random value between 0 and 1 */
taken = ((float) random())/((float) RAND_MAX+1);

View File

@ -1,110 +0,0 @@
autofs-5.0.6 - systemd support fixes
From: Ian Kent <raven@themaw.net>
Fix up some of in spec file systemd scriptlets.
The pre-system package verion uninstall scriptlet has been commented
out in the tar spec file. It's is an example of what might need to
be done in a distro spec file.
---
CHANGELOG | 1 +
autofs.spec | 41 ++++++++++++++++++++++++++++++-----------
samples/autofs.service.in | 1 +
3 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 69ade49..b9c3149 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -32,6 +32,7 @@
- reinstate singleton mount probe.
- rework error return handling in rpc code.
- catch EHOSTUNREACH and bail out early.
+- systemd support fixes.
28/06/2011 autofs-5.0.6
-----------------------
diff --git a/autofs.spec b/autofs.spec
index d854b1f..a73fefb 100644
--- a/autofs.spec
+++ b/autofs.spec
@@ -105,34 +105,53 @@ install -m 644 redhat/autofs.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/autofs
%post
%if %{with_systemd}
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -eq 1 ]; then
+ %{_bindir}/systemctl daemon-reload >/dev/null 2>&1 || :
+ # autofs has been approved to be enabled by default
+ %{_bindir}/systemctl enable %{name}.service >/dev/null 2>&1 || :
+fi
%else
-chkconfig --add autofs
+if [ $1 -eq 1 ]; then
+ %{_sbindir}/chkconfig --add autofs
+fi
%endif
%preun
-if [ "$1" = 0 ] ; then
%if %{with_systemd}
- /bin/systemctl --no-reload disable autofs.service > /dev/null 2>&1 || :
- /bin/systemctl stop autofs.service > /dev/null 2>&1 || :
+if [ $1 -eq 0 ] ; then
+ %{_bindir}/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || :
+ %{_bindir}/systemctl stop %{name}.service > /dev/null 2>&1 || :
+fi
%else
- /sbin/service autofs stop > /dev/null 2>&1 || :
- /sbin/chkconfig --del autofs
-%endif
+if [ $1 -eq 0 ] ; then
+ %{_sbindir}/service autofs stop > /dev/null 2>&1 || :
+ %{_sbindir}/chkconfig --del autofs
fi
+%endif
%postun
%if %{with_systemd}
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+%{_bindir}/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
- /bin/systemctl try-restart autofs.service >/dev/null 2>&1 || :
+ # Package upgrade, not removal
+ %{_bindir}/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
fi
%else
if [ $1 -ge 1 ] ; then
- /sbin/service autofs condrestart > /dev/null 2>&1 || :
+ %{_sbindir}/service autofs condrestart > /dev/null 2>&1 || :
fi
%endif
+#%triggerun -- %{name} < $bla release
+## Save the current service runlevel info
+## User must manually run systemd-sysv-convert --apply %{name}
+## to migrate them to systemd targets
+#%{_bindir}/systemd-sysv-convert --save %{name} >/dev/null 2>&1 ||:
+#
+## Run these because the SysV package being removed won't do them
+#%{_sbindir}/chkconfig --del %{name} >/dev/null 2>&1 || :
+#%{_bindir}/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
+
%files
%defattr(-,root,root)
%doc CREDITS CHANGELOG INSTALL COPY* README* samples/ldap* samples/autofs.schema samples/autofs_ldap_auth.conf
diff --git a/samples/autofs.service.in b/samples/autofs.service.in
index 3756078..879b47b 100644
--- a/samples/autofs.service.in
+++ b/samples/autofs.service.in
@@ -7,6 +7,7 @@ Type=forking
PIDFile=@@autofspiddir@@/autofs.pid
EnvironmentFile=-@@autofsconfdir@@/autofs
ExecStart=@@sbindir@@/automount ${OPTIONS} --pid-file @@autofspiddir@@/autofs.pid
+ExecReload=/usr/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target

View File

@ -1,83 +0,0 @@
autofs-5.0.6 - teach automount about sss source
From: Ian Kent <raven@themaw.net>
Add parser and conditional checks to automount to handle sss source.
Note, the parsing probably needs more work, both for master map entries
and map entries, to attempt to narrow invalid map names passed down to
lower level modules. For now we have to just handle these failures in
the lookup module.
---
CHANGELOG | 1 +
daemon/lookup.c | 1 +
lib/master_tok.l | 2 +-
lib/nss_parse.y | 6 ++++--
modules/parse_sun.c | 2 +-
5 files changed, 8 insertions(+), 4 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -22,6 +22,7 @@
- fix improve mount location error reporting.
- fix rpc build error.
- add sss lookup module.
+- teach automount about sss source.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/daemon/lookup.c
+++ autofs-5.0.6/daemon/lookup.c
@@ -177,6 +177,7 @@ int lookup_nss_read_master(struct master
!strncmp(name, "nisplus:", 8) ||
!strncmp(name, "ldap:", 5) ||
!strncmp(name, "ldaps:", 6) ||
+ !strncmp(name, "sss:", 4) ||
!strncmp(name, "dir:", 4)) {
strncpy(source, name, tmp - name);
--- autofs-5.0.6.orig/lib/master_tok.l
+++ autofs-5.0.6/lib/master_tok.l
@@ -118,7 +118,7 @@ DNNAMESTR2 ([[:alnum:]_.\-]+)
INTMAP (-hosts|-null)
MULTI ((multi)(,(sun|hesiod))?(:{OPTWS}|{WS}))
MULTISEP ([\-]{2}[[:blank:]]+)
-MTYPE ((file|program|yp|nis|nisplus|ldap|ldaps|hesiod|userdir)(,(sun|hesiod))?(:{OPTWS}|{WS}))
+MTYPE ((file|program|sss|yp|nis|nisplus|ldap|ldaps|hesiod|userdir)(,(sun|hesiod))?(:{OPTWS}|{WS}))
OPTTOUT (-t{OPTWS}|-t{OPTWS}={OPTWS}|--timeout{OPTWS}|--timeout{OPTWS}={OPTWS})
--- autofs-5.0.6.orig/lib/nss_parse.y
+++ autofs-5.0.6/lib/nss_parse.y
@@ -82,7 +82,8 @@ nss_source: SOURCE
{
if (!strcmp($1, "files") || !strcmp($1, "yp") ||
!strcmp($1, "nis") || !strcmp($1, "ldap") ||
- !strcmp($1, "nisplus") || !strcmp($1, "hesiod"))
+ !strcmp($1, "nisplus") || !strcmp($1, "hesiod") ||
+ !strcmp($1, "sss"))
src = add_source(nss_list, $1);
else
nss_ignore($1);
@@ -92,7 +93,8 @@ nss_source: SOURCE
if (!strcmp($1, "files") || !strcmp($1, "yp") ||
!strcmp($1, "nis") || !strcmp($1, "ldap") ||
- !strcmp($1, "nisplus") || !strcmp($1, "hesiod")) {
+ !strcmp($1, "nisplus") || !strcmp($1, "hesiod") ||
+ !strcmp($1, "sss")) {
src = add_source(nss_list, $1);
for (a = 0; a < NSS_STATUS_MAX; a++) {
if (act[a].action != NSS_ACTION_UNKNOWN) {
--- autofs-5.0.6.orig/modules/parse_sun.c
+++ autofs-5.0.6/modules/parse_sun.c
@@ -880,7 +880,7 @@ static int validate_location(unsigned in
!strncmp(ptr, "file:", 5) || !strncmp(ptr, "yp:", 3) ||
!strncmp(ptr, "nis:", 4) || !strncmp(ptr, "nisplus:", 8) ||
!strncmp(ptr, "ldap:", 5) || !strncmp(ptr, "ldaps:", 6) ||
- !strncmp(ptr, "dir:", 4))
+ !strncmp(ptr, "sss:", 4) || !strncmp(ptr, "dir:", 4))
return 1;
error(logopt,
"expected colon delimeter not found in location %s",

View File

@ -1,171 +0,0 @@
autofs-5.0.6 - update ->timeout() function to not return timeout
From: Ian Kent <ikent@redhat.com>
The value returned by the ->timeout() autofs control interface
function is not used so make that usage explict by not using a
pass by address parameter. This saves having to take care to
always use a temporary storage location when using the function.
---
CHANGELOG | 1 +
daemon/direct.c | 6 +++---
daemon/indirect.c | 2 +-
include/dev-ioctl-lib.h | 2 +-
lib/dev-ioctl-lib.c | 15 +++++++--------
lib/master_parse.y | 3 +--
lib/mounts.c | 4 ++--
7 files changed, 16 insertions(+), 17 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -44,6 +44,7 @@
- fix libtirpc name clash.
- report map not read when debug logging.
- duplicate parent options for included maps.
+- update ->timeout() function to not return timeout.
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/daemon/direct.c
+++ autofs-5.0.6/daemon/direct.c
@@ -302,7 +302,7 @@ static int unlink_active_mounts(struct a
return 0;
}
- ops->timeout(ap->logopt, ioctlfd, &tout);
+ ops->timeout(ap->logopt, ioctlfd, tout);
if (save_ioctlfd == -1)
ops->close(ap->logopt, ioctlfd);
@@ -424,7 +424,7 @@ int do_mount_autofs_direct(struct autofs
goto out_umount;
}
- ops->timeout(ap->logopt, ioctlfd, &timeout);
+ ops->timeout(ap->logopt, ioctlfd, timeout);
notify_mount_result(ap, me->key, str_direct);
cache_set_ino_index(me->mc, me->key, st.st_dev, st.st_ino);
ops->close(ap->logopt, ioctlfd);
@@ -771,7 +771,7 @@ int mount_autofs_offset(struct autofs_po
goto out_umount;
}
- ops->timeout(ap->logopt, ioctlfd, &timeout);
+ ops->timeout(ap->logopt, ioctlfd, timeout);
cache_set_ino_index(me->mc, me->key, st.st_dev, st.st_ino);
if (ap->logopt & LOGOPT_DEBUG)
notify_mount_result(ap, mountpoint, str_offset);
--- autofs-5.0.6.orig/daemon/indirect.c
+++ autofs-5.0.6/daemon/indirect.c
@@ -172,7 +172,7 @@ static int do_mount_autofs_indirect(stru
ap->dev = st.st_dev; /* Device number for mount point checks */
ap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO;
- ops->timeout(ap->logopt, ap->ioctlfd, &timeout);
+ ops->timeout(ap->logopt, ap->ioctlfd, timeout);
if (ap->logopt & LOGOPT_DEBUG)
notify_mount_result(ap, root, str_indirect);
else
--- autofs-5.0.6.orig/include/dev-ioctl-lib.h
+++ autofs-5.0.6/include/dev-ioctl-lib.h
@@ -45,7 +45,7 @@ struct ioctl_ops {
int (*send_fail)(unsigned int, int, unsigned int, int);
int (*setpipefd)(unsigned int, int, int);
int (*catatonic)(unsigned int, int);
- int (*timeout)(unsigned int, int, time_t *);
+ int (*timeout)(unsigned int, int, time_t);
int (*requestor)(unsigned int, int, const char *, uid_t *, gid_t *);
int (*expire)(unsigned int, int, const char *, unsigned int);
int (*askumount)(unsigned int, int, unsigned int *);
--- autofs-5.0.6.orig/lib/dev-ioctl-lib.c
+++ autofs-5.0.6/lib/dev-ioctl-lib.c
@@ -55,7 +55,7 @@ static int dev_ioctl_send_ready(unsigned
static int dev_ioctl_send_fail(unsigned int, int, unsigned int, int);
static int dev_ioctl_setpipefd(unsigned int, int, int);
static int dev_ioctl_catatonic(unsigned int, int);
-static int dev_ioctl_timeout(unsigned int, int, time_t *);
+static int dev_ioctl_timeout(unsigned int, int, time_t);
static int dev_ioctl_requestor(unsigned int, int, const char *, uid_t *, gid_t *);
static int dev_ioctl_expire(unsigned int, int, const char *, unsigned int);
static int dev_ioctl_askumount(unsigned int, int, unsigned int *);
@@ -69,7 +69,7 @@ static int ioctl_close(unsigned int, int
static int ioctl_send_ready(unsigned int, int, unsigned int);
static int ioctl_send_fail(unsigned int, int, unsigned int, int);
static int ioctl_catatonic(unsigned int, int);
-static int ioctl_timeout(unsigned int, int, time_t *);
+static int ioctl_timeout(unsigned int, int, time_t);
static int ioctl_expire(unsigned int, int, const char *, unsigned int);
static int ioctl_askumount(unsigned int, int, unsigned int *);
@@ -577,25 +577,24 @@ static int ioctl_catatonic(unsigned int
}
/* Set the autofs mount timeout */
-static int dev_ioctl_timeout(unsigned int logopt, int ioctlfd, time_t *timeout)
+static int dev_ioctl_timeout(unsigned int logopt, int ioctlfd, time_t timeout)
{
struct autofs_dev_ioctl param;
init_autofs_dev_ioctl(&param);
param.ioctlfd = ioctlfd;
- param.timeout.timeout = *timeout;
+ param.timeout.timeout = timeout;
if (ioctl(ctl.devfd, AUTOFS_DEV_IOCTL_TIMEOUT, &param) == -1)
return -1;
- *timeout = param.timeout.timeout;
-
return 0;
}
-static int ioctl_timeout(unsigned int logopt, int ioctlfd, time_t *timeout)
+static int ioctl_timeout(unsigned int logopt, int ioctlfd, time_t timeout)
{
- return ioctl(ioctlfd, AUTOFS_IOC_SETTIMEOUT, timeout);
+ time_t tout = timeout;
+ return ioctl(ioctlfd, AUTOFS_IOC_SETTIMEOUT, &tout);
}
/*
--- autofs-5.0.6.orig/lib/master_parse.y
+++ autofs-5.0.6/lib/master_parse.y
@@ -801,7 +801,6 @@ int master_parse_entry(const char *buffe
} else {
struct ioctl_ops *ops = get_ioctl_ops();
struct autofs_point *ap = entry->ap;
- time_t tout = timeout;
/*
* Second and subsequent instances of a mount point
@@ -811,7 +810,7 @@ int master_parse_entry(const char *buffe
ap->exp_timeout = timeout;
ap->exp_runfreq = (ap->exp_timeout + CHECK_RATIO - 1) / CHECK_RATIO;
if (ap->ioctlfd != -1 && ap->type == LKP_INDIRECT)
- ops->timeout(ap->logopt, ap->ioctlfd, &tout);
+ ops->timeout(ap->logopt, ap->ioctlfd, timeout);
}
}
if (random_selection)
--- autofs-5.0.6.orig/lib/mounts.c
+++ autofs-5.0.6/lib/mounts.c
@@ -1404,7 +1404,7 @@ static int remount_active_mount(struct a
/* Re-reading the map, set timeout and return */
if (ap->state == ST_READMAP) {
- ops->timeout(ap->logopt, fd, &timeout);
+ ops->timeout(ap->logopt, fd, timeout);
ops->close(ap->logopt, fd);
return REMOUNT_READ_MAP;
}
@@ -1426,7 +1426,7 @@ static int remount_active_mount(struct a
ops->close(ap->logopt, fd);
return REMOUNT_OPEN_FAIL;
}
- ops->timeout(ap->logopt, fd, &timeout);
+ ops->timeout(ap->logopt, fd, timeout);
if (fstat(fd, &st) == -1) {
error(ap->logopt,
"failed to stat %s mount %s", str_type, path);

View File

@ -1,51 +0,0 @@
autofs-5.0.6 - use strtok_r() in linux_version_code()
From: Ian Kent <ikent@redhat.com>
Use re-entrant version of strtok() in linux_version_code() function.
Also fix tab formatting.
---
CHANGELOG | 1 +
include/mounts.h | 17 +++++++++--------
2 files changed, 10 insertions(+), 8 deletions(-)
--- autofs-5.0.6.orig/CHANGELOG
+++ autofs-5.0.6/CHANGELOG
@@ -36,6 +36,7 @@
- fix rework error return handling in rpc code.
- allow MOUNT_WAIT to override probe.
- improve UDP RPC timeout handling.
+- use strtok_r() in linux_version_code().
28/06/2011 autofs-5.0.6
-----------------------
--- autofs-5.0.6.orig/include/mounts.h
+++ autofs-5.0.6/include/mounts.h
@@ -77,16 +77,17 @@ struct mnt_list {
static inline unsigned int linux_version_code(void)
{
- struct utsname my_utsname;
- unsigned int p, q, r;
+ struct utsname my_utsname;
+ unsigned int p, q, r;
+ char *save;
- if (uname(&my_utsname))
- return 0;
+ if (uname(&my_utsname))
+ return 0;
- p = (unsigned int)atoi(strtok(my_utsname.release, "."));
- q = (unsigned int)atoi(strtok(NULL, "."));
- r = (unsigned int)atoi(strtok(NULL, "."));
- return KERNEL_VERSION(p, q, r);
+ p = (unsigned int) atoi(strtok_r(my_utsname.release, ".", &save));
+ q = (unsigned int) atoi(strtok_r(NULL, ".", &save));
+ r = (unsigned int) atoi(strtok_r(NULL, ".", &save));
+ return KERNEL_VERSION(p, q, r);
}
struct nfs_mount_vers {

View File

@ -1,56 +0,0 @@
autofs-5.0.7 - README: update mailing list subscription info
From: Chris Packham <chris.packham@alliedtelesis.co.nz>
Following the kernel.org compromise the mailing list was moved to
vger.kernel.org. Update the subscription info and add URLs for the gmane
mailing list archive.
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
CHANGELOG | 1 +
README | 17 ++++++++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index fe801e8..44c9fb2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -10,6 +10,7 @@
- fix null map entry order handling.
- make description of default MOUNT_WAIT setting clear.
- configure.in: allow cross compilation.
+- README: update mailing list subscription info.
25/07/2012 autofs-5.0.7
=======================
diff --git a/README b/README
index cef16a9..9024e64 100644
--- a/README
+++ b/README
@@ -43,9 +43,20 @@ Fitzhardinge's <jeremy@goop.org> work on autofs 3. Further enhancements
have been made by Ian Kent <raven@themaw.net>.
If you use or want to help develop autofs, please join the autofs
-mailing list by visiting:
+mailing list by sending an email to:
- http://linux.kernel.org/mailman/listinfo/autofs
+ majordomo@vger.kernel.org
-and folling the instructions there to subscribe to the autofs mailing list.
+With the body text:
+
+ subscribe autofs
+
+Once subscribed you can send patches to:
+
+ autofs@vger.kernel.org
+
+The autofs mailing list archive can be viewed on gmane:
+
+ http://news.gmane.org/gmane.linux.kernel.autofs
+ http://blog.gmane.org/gmane.linux.kernel.autofs

View File

@ -1,35 +0,0 @@
autofs-5.0.7 - add after sssd dependency to unit file
From: Ian Kent <ikent@redhat.com>
When using sss as a map source autofs can sometimes start before
sssd is ready.
---
CHANGELOG | 1 +
samples/autofs.service.in | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG b/CHANGELOG
index 7749f01..2734fe3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -55,6 +55,7 @@
- fix add null check in parse_server_string().
- don't override LDFLAGS in make rules.
- fix a couple of compiler warnings.
+- add after sssd dependency to unit file.
25/07/2012 autofs-5.0.7
=======================
diff --git a/samples/autofs.service.in b/samples/autofs.service.in
index 056ab5e..777463d 100644
--- a/samples/autofs.service.in
+++ b/samples/autofs.service.in
@@ -1,6 +1,6 @@
[Unit]
Description=Automounts filesystems on demand
-After=network.target ypbind.service
+After=network.target ypbind.service sssd.service
[Service]
Type=forking

View File

@ -1,48 +0,0 @@
autofs-5.0.7 - add changlog entry for coverity fixes
From: Ian Kent <raven@themaw.net>
A bunch of changes have been made based on a Covarity report.
Mostly I pust the changes into seperate patches so they can be kept simple.
Changes:
- fix fcntl return check.
- fix spawn_umount() return check in mount_bind.c:lookup_init().
- fix check mkdir_path() in mount_bind.c:mount_mount().
- fix incorrect var name in test.
- remove debug only code in alarm.c.
- fix inconsistent use of cache lock in handle_packet_missing_direct().
- fix several off by one errors.
- fix memory leak in get_dc_list().
- fix host_addr null reference in add_new_host().
- add null check in read_one().
- add pgrp check in do_spawn().
- fix inconsistent signed usage for __rpc_ping().
- add null check in extract_version().
- recheck valid map entry lookup return in do_readmap_mount().
- add null check in parse_server_string().
- add map entry null check in do_expire_direct().
- add mapent null check in lookup_nisplus.c:lookup_mount().
- fix potential null dereference in lookup_mount().
- fix leaked ldap percent hack allocation in lookup_one().
- fix incorrect value reference in parse_line().
- add debug alert for waitpid in check_nfs_mount_version().
- add initialization of bind_result in-do_sasl_bind().
- fix incorrect check in flag_is_owned().
- fix possible use after free in lookup_dir.c:lookup_init().
---
CHANGELOG | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGELOG b/CHANGELOG
index 48e9806..25179b1 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -49,6 +49,7 @@
- fix master map bogus keywork match.
- fix fix map entry duplicate offset detection.
- probe each nfs version in turn for singleton mounts.
+- add changlog entry for coverity fixes.
25/07/2012 autofs-5.0.7
=======================

View File

@ -1,24 +0,0 @@
autofs-5.0.7 - add debug alert for waitpid in check_nfs_mount_version()
From: Ian Kent <raven@themaw.net>
We don't really case if there's no process to wait for but add a debug
log alert for information.
---
lib/mounts.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/mounts.c b/lib/mounts.c
index 7b959b8..a6f560e 100644
--- a/lib/mounts.c
+++ b/lib/mounts.c
@@ -287,7 +287,8 @@ int check_nfs_mount_version(struct nfs_mount_vers *vers,
ret = 0;
}
- if (waitpid(f, &status, 0) != f) ;
+ if (waitpid(f, &status, 0) != f)
+ debug(LOGOPT_NONE, "no process found to wait for");
pthread_sigmask(SIG_SETMASK, &oldsig, NULL);
pthread_setcancelstate(cancel_state, NULL);

View File

@ -1,691 +0,0 @@
autofs-5.0.7 - add enable sloppy mount option to configure
From: Ian Kent <ikent@redhat.com>
Add an option --enable-sloppy-mount or --disable-sloppy-mount to force
or prevent the use of the -s option to mount, thus avoiding the
autodetection. This can be useful in setups where executing mount
might be undesirable, particularly in packaging environments.
2013-04-04 Martin von Gagern
References:
* https://bugs.gentoo.org/453778
---
CHANGELOG | 1
aclocal.m4 | 2
configure | 252 +++++++++++++++++++++++++++++++---------------------------
configure.in | 10 ++
4 files changed, 146 insertions(+), 119 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 61edddf..66c11de 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -42,6 +42,7 @@
- fix submount tree not all expiring.
- make dump maps check for duplicate indirect mounts.
- document allowed map sources in auto.master.
+- add enable sloppy mount option to configure.
25/07/2012 autofs-5.0.7
=======================
diff --git a/aclocal.m4 b/aclocal.m4
index 47bca0c..c5de159 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -66,7 +66,7 @@ AC_DEFUN(AF_SLOPPY_MOUNT,
[if test -n "$MOUNT" ; then
AC_MSG_CHECKING([if mount accepts the -s option])
if "$MOUNT" -s > /dev/null 2>&1 ; then
- AC_DEFINE(HAVE_SLOPPY_MOUNT, 1, [define if the mount command supports the -s option])
+ enable_sloppy_mount=yes
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
diff --git a/configure b/configure
index c1423d8..08b7ccc 100755
--- a/configure
+++ b/configure
@@ -1,11 +1,9 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68.
+# Generated by GNU Autoconf 2.69.
#
#
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
@@ -134,6 +132,31 @@ export LANGUAGE
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
emulate sh
@@ -167,7 +190,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
else
exitcode=1; echo positional parameters were not saved.
fi
-test x\$exitcode = x0 || exit 1"
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -212,21 +236,25 @@ IFS=$as_save_IFS
if test "x$CONFIG_SHELL" != x; then :
- # We cannot yet assume a decent shell, so we have to provide a
- # neutralization value for shells without unset; and this also
- # works around shells that cannot unset nonexistent variables.
- # Preserve -v and -x to the replacement shell.
- BASH_ENV=/dev/null
- ENV=/dev/null
- (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
- export CONFIG_SHELL
- case $- in # ((((
- *v*x* | *x*v* ) as_opts=-vx ;;
- *v* ) as_opts=-v ;;
- *x* ) as_opts=-x ;;
- * ) as_opts= ;;
- esac
- exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
fi
if test x$as_have_required = xno; then :
@@ -328,6 +356,14 @@ $as_echo X"$as_dir" |
} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
# as_fn_append VAR VALUE
# ----------------------
# Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -449,6 +485,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
chmod +x "$as_me.lineno" ||
{ $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
@@ -483,16 +523,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
+ # In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@@ -504,28 +544,8 @@ else
as_mkdir_p=false
fi
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in #(
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -715,6 +735,7 @@ with_fifodir
with_flagdir
with_libtirpc
with_dmalloc
+enable_sloppy_mount
with_hesiod
with_openldap
with_sasl
@@ -1187,8 +1208,6 @@ target=$target_alias
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
- $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used" >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
@@ -1341,6 +1360,7 @@ Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-sloppy-mount enable the use of the -s option to mount
--disable-ext-env disable search in environment for substitution variable
--disable-mount-locking disable use of locking when spawning mount command
--enable-force-shutdown enable USR1 signal to force unlink umount of any
@@ -1442,9 +1462,9 @@ test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
configure
-generated by GNU Autoconf 2.68
+generated by GNU Autoconf 2.69
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
@@ -1520,7 +1540,7 @@ $as_echo "$ac_try_echo"; } >&5
test ! -s conftest.err
} && test -s conftest$ac_exeext && {
test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
+ test -x conftest$ac_exeext
}; then :
ac_retval=0
else
@@ -1740,7 +1760,7 @@ This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by $as_me, which was
-generated by GNU Autoconf 2.68. Invocation command line was
+generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2324,7 +2344,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2364,7 +2384,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2417,7 +2437,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2458,7 +2478,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
@@ -2516,7 +2536,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -2560,7 +2580,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3006,8 +3026,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -3209,7 +3228,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_MOUNT="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3269,7 +3288,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_MOUNT_NFS="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3329,7 +3348,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_UMOUNT="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3389,7 +3408,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_E2FSCK="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3448,7 +3467,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_E3FSCK="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3507,7 +3526,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_E4FSCK="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3566,7 +3585,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_MODPROBE="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3626,7 +3645,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_LEX="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3682,7 +3701,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_YACC="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3738,7 +3757,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_RANLIB="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3794,7 +3813,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_RPCGEN="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3858,13 +3877,19 @@ fi
# Newer mounts have the -s (sloppy) option to ignore unknown options,
# good for portability
#
-if test -n "$MOUNT" ; then
+# Check whether --enable-sloppy-mount was given.
+if test "${enable_sloppy_mount+set}" = set; then :
+ enableval=$enable_sloppy_mount;
+else
+ enable_sloppy_mount=auto
+fi
+
+if test x$enable_sloppy_mount = xauto; then
+ if test -n "$MOUNT" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if mount accepts the -s option" >&5
$as_echo_n "checking if mount accepts the -s option... " >&6; }
if "$MOUNT" -s > /dev/null 2>&1 ; then
-
-$as_echo "#define HAVE_SLOPPY_MOUNT 1" >>confdefs.h
-
+ enable_sloppy_mount=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
@@ -3872,6 +3897,12 @@ $as_echo "yes" >&6; }
$as_echo "no" >&6; }
fi
fi
+fi
+if test x$enable_sloppy_mount = xyes; then
+
+$as_echo "#define HAVE_SLOPPY_MOUNT 1" >>confdefs.h
+
+fi
# LDAP SASL auth needs libxml and Kerberos
for ac_prog in xml2-config
@@ -3894,7 +3925,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_XML_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -3969,7 +4000,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_KRB5_CONFIG="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4387,7 +4418,7 @@ do
for ac_prog in grep ggrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+ as_fn_executable_p "$ac_path_GREP" || continue
# Check for GNU ac_path_GREP and select it if it is found.
# Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
@@ -4453,7 +4484,7 @@ do
for ac_prog in egrep; do
for ac_exec_ext in '' $ac_executable_extensions; do
ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+ as_fn_executable_p "$ac_path_EGREP" || continue
# Check for GNU ac_path_EGREP and select it if it is found.
# Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
@@ -4928,7 +4959,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -4968,7 +4999,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="gcc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5021,7 +5052,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5062,7 +5093,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
@@ -5120,7 +5151,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5164,7 +5195,7 @@ do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CC="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
@@ -5360,8 +5391,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -5882,16 +5912,16 @@ if (echo >conf$$.file) 2>/dev/null; then
# ... but there are two gotchas:
# 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
# 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
+ # In both cases, we have to default to `cp -pR'.
ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
elif ln conf$$.file conf$$ 2>/dev/null; then
as_ln_s=ln
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
else
- as_ln_s='cp -p'
+ as_ln_s='cp -pR'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
@@ -5951,28 +5981,16 @@ else
as_mkdir_p=false
fi
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in #(
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -5994,7 +6012,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# values after options handling.
ac_log="
This file was extended by $as_me, which was
-generated by GNU Autoconf 2.68. Invocation command line was
+generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -6056,10 +6074,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
config.status
-configured by $0, generated by GNU Autoconf 2.68,
+configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
@@ -6147,7 +6165,7 @@ fi
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
- set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
shift
\$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
CONFIG_SHELL='$SHELL'
diff --git a/configure.in b/configure.in
index 4029375..559045a 100644
--- a/configure.in
+++ b/configure.in
@@ -157,7 +157,15 @@ AC_SUBST(sssldir)
# Newer mounts have the -s (sloppy) option to ignore unknown options,
# good for portability
#
-AF_SLOPPY_MOUNT()
+AC_ARG_ENABLE(sloppy-mount,
+[ --enable-sloppy-mount enable the use of the -s option to mount],,
+ enable_sloppy_mount=auto)
+if test x$enable_sloppy_mount = xauto; then
+ AF_SLOPPY_MOUNT()
+fi
+if test x$enable_sloppy_mount = xyes; then
+ AC_DEFINE(HAVE_SLOPPY_MOUNT, 1, [define if the mount command supports the -s option])
+fi
# LDAP SASL auth needs libxml and Kerberos
AF_CHECK_LIBXML()

View File

@ -1,23 +0,0 @@
autofs-5.0.7 - add initialization of bind_result in-do_sasl_bind()
From: Ian Kent <raven@themaw.net>
There is an unlikley code path where bind_result could be used uninitialized
so initialize it so it isn't incorrectly used if it has rubish in it.
---
modules/cyrus-sasl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/cyrus-sasl.c b/modules/cyrus-sasl.c
index b456333..68f9242 100644
--- a/modules/cyrus-sasl.c
+++ b/modules/cyrus-sasl.c
@@ -210,7 +210,7 @@ int
do_sasl_bind(unsigned logopt, LDAP *ld, sasl_conn_t *conn, const char **clientout,
unsigned int *clientoutlen, const char *auth_mech, int sasl_result)
{
- int ret, msgid, bind_result;
+ int ret, msgid, bind_result = LDAP_OTHER;
struct berval client_cred, *server_cred, temp_cred;
LDAPMessage *results;
int have_data, expected_data;

View File

@ -1,25 +0,0 @@
autofs-5.0.7 - add map entry null check in do_expire_direct()
From: Ian Kent <raven@themaw.net>
Since we've seen a mount failure for this map entry it should exist
but add a null check in case it's been removed while we waited on
the lock.
---
daemon/direct.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/daemon/direct.c b/daemon/direct.c
index 399ad0a..f85e1b5 100644
--- a/daemon/direct.c
+++ b/daemon/direct.c
@@ -1019,7 +1019,8 @@ static void *do_expire_direct(void *arg)
struct mapent *me;
cache_writelock(mt.mc);
me = cache_lookup_distinct(mt.mc, mt.name);
- me->ioctlfd = -1;
+ if (me)
+ me->ioctlfd = -1;
cache_unlock(mt.mc);
ops->send_ready(ap->logopt, mt.ioctlfd, mt.wait_queue_token);
ops->close(ap->logopt, mt.ioctlfd);

View File

@ -1,24 +0,0 @@
autofs-5.0.7 - add mapent null check in lookup_nisplus.c:lookup_mount()
From: Ian Kent <raven@themaw.net>
malloc(3) could return null under low memory conditions, add a null check
for this case.
---
modules/lookup_nisplus.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modules/lookup_nisplus.c b/modules/lookup_nisplus.c
index 8237a1e..ef942a7 100644
--- a/modules/lookup_nisplus.c
+++ b/modules/lookup_nisplus.c
@@ -584,7 +584,8 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
if (me && (me->source == source || *me->key == '/')) {
mapent_len = strlen(me->mapent);
mapent = malloc(mapent_len + 1);
- strcpy(mapent, me->mapent);
+ if (mapent)
+ strcpy(mapent, me->mapent);
}
}
cache_unlock(mc);

View File

@ -1,23 +0,0 @@
autofs-5.0.7 - add null check in extract_version()
From: Ian Kent <raven@themaw.net>
A space should always be found in the passed in string but a check
should be done in case it isn't.
---
lib/mounts.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/mounts.c b/lib/mounts.c
index 0caa0aa..7b959b8 100644
--- a/lib/mounts.c
+++ b/lib/mounts.c
@@ -168,6 +168,8 @@ unsigned int get_kver_minor(void)
static int extract_version(char *start, struct nfs_mount_vers *vers)
{
char *s_ver = strchr(start, ' ');
+ if (!s_ver)
+ return 0;
while (*s_ver && !isdigit(*s_ver)) {
s_ver++;
if (!*s_ver)

View File

@ -1,26 +0,0 @@
autofs-5.0.7 - add null check in parse_server_string()
From: Ian Kent <raven@themaw.net>
Add an error check for the case there's no ':' server name delimiter in
parse_server_string().
---
modules/lookup_ldap.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
index 17cbe9a..a59de92 100644
--- a/modules/lookup_ldap.c
+++ b/modules/lookup_ldap.c
@@ -1212,6 +1212,11 @@ static int parse_server_string(unsigned logopt, const char *url, struct lookup_c
/* Isolate the server. Include the port spec */
if (*ptr != '[')
q = strchr(ptr, ':');
+ if (!q) {
+ crit(logopt, MODPREFIX
+ "LDAP server name not found in %s", ptr);
+ return 0;
+ }
else {
q = ++ptr;
while (*q == ':' || isxdigit(*q))

View File

@ -1,26 +0,0 @@
autofs-5.0.7 - add null check in read_one()
From: Ian Kent <raven@themaw.net>
The pointter p shouldn't be null here but add a chack anyway.
---
modules/lookup_file.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/modules/lookup_file.c b/modules/lookup_file.c
index 65e5ee6..2836996 100644
--- a/modules/lookup_file.c
+++ b/modules/lookup_file.c
@@ -302,8 +302,10 @@ static int read_one(unsigned logopt, FILE *f, char *key, unsigned int *k_len, ch
if (gotten == got_real || gotten == getting)
goto got_it;
} else if (mapent_len < MAPENT_MAX_LEN) {
- mapent_len++;
- *(p++) = ch;
+ if (p) {
+ mapent_len++;
+ *(p++) = ch;
+ }
nch = getc(f);
if (nch == EOF &&
(gotten == got_real || gotten == getting))

View File

@ -1,23 +0,0 @@
autofs-5.0.7 - add pgrp check in do_spawn()
From: Ian Kent <raven@themaw.net>
The process group should never be negative here but add a check anyway.
---
daemon/spawn.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/daemon/spawn.c b/daemon/spawn.c
index 9b8d5a2..abb353a 100644
--- a/daemon/spawn.c
+++ b/daemon/spawn.c
@@ -201,7 +201,8 @@ static int do_spawn(unsigned logopt, unsigned int wait,
seteuid(0);
setegid(0);
- setpgid(0, pgrp);
+ if (pgrp >= 0)
+ setpgid(0, pgrp);
}
execv(prog, (char *const *) argv);

View File

@ -1,217 +0,0 @@
autofs-5.0.7 - add symlink pseudo option
From: Ian Kent <raven@themaw.net>
Add a "symlink" pseudo option to tell the bind mount module to symlink
instead of bind when mounting mounts other than direct mounts and
non-root indirect mount offset mounts (aka. non-root multi-mount
entries).
---
CHANGELOG | 1 +
include/automount.h | 3 +++
lib/master_parse.y | 8 +++++++-
lib/master_tok.l | 1 +
man/auto.master.5.in | 8 ++++++++
modules/mount_autofs.c | 5 +++++
modules/mount_bind.c | 36 +++++++++++++++++++++++++++++++++++-
7 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index c189483..247d334 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -32,6 +32,7 @@
- fix wildcard multi map regression.
- fix file descriptor leak when reloading the daemon.
- depricate nosymlink pseudo option.
+- add symlink pseudo option.
25/07/2012 autofs-5.0.7
=======================
diff --git a/include/automount.h b/include/automount.h
index 37541f5..e72fa0d 100644
--- a/include/automount.h
+++ b/include/automount.h
@@ -455,6 +455,9 @@ struct kernel_mod_version {
/* Don't use bind mounts even when system supports them */
#define MOUNT_FLAG_NOBIND 0x0020
+/* Use symlinks instead of bind mounting local mounts */
+#define MOUNT_FLAG_SYMLINK 0x0040
+
struct autofs_point {
pthread_t thid;
char *path; /* Mount point name */
diff --git a/lib/master_parse.y b/lib/master_parse.y
index f925b5a..11caf5b 100644
--- a/lib/master_parse.y
+++ b/lib/master_parse.y
@@ -57,6 +57,7 @@ static char *type;
static char *format;
static long timeout;
static long negative_timeout;
+static unsigned symlnk;
static unsigned nobind;
static unsigned ghost;
extern unsigned global_selection_options;
@@ -100,7 +101,7 @@ static int master_fprintf(FILE *, char *, ...);
%token COMMENT
%token MAP
%token OPT_TIMEOUT OPT_NTIMEOUT OPT_NOBIND OPT_NOGHOST OPT_GHOST OPT_VERBOSE
-%token OPT_DEBUG OPT_RANDOM OPT_USE_WEIGHT
+%token OPT_DEBUG OPT_RANDOM OPT_USE_WEIGHT OPT_SYMLINK
%token COLON COMMA NL DDASH
%type <strtype> map
%type <strtype> options
@@ -186,6 +187,7 @@ line:
| PATH OPT_USE_WEIGHT { master_notify($1); YYABORT; }
| PATH OPT_DEBUG { master_notify($1); YYABORT; }
| PATH OPT_TIMEOUT { master_notify($1); YYABORT; }
+ | PATH OPT_SYMLINK { master_notify($1); YYABORT; }
| PATH OPT_NOBIND { master_notify($1); YYABORT; }
| PATH OPT_GHOST { master_notify($1); YYABORT; }
| PATH OPT_NOGHOST { master_notify($1); YYABORT; }
@@ -557,6 +559,7 @@ option: daemon_option
daemon_option: OPT_TIMEOUT NUMBER { timeout = $2; }
| OPT_NTIMEOUT NUMBER { negative_timeout = $2; }
+ | OPT_SYMLINK { symlnk = 1; }
| OPT_NOBIND { nobind = 1; }
| OPT_NOGHOST { ghost = 0; }
| OPT_GHOST { ghost = 1; }
@@ -627,6 +630,7 @@ static void local_init_vars(void)
debug = 0;
timeout = -1;
negative_timeout = 0;
+ symlnk = 0;
nobind = 0;
ghost = defaults_get_browse_mode();
random_selection = global_selection_options & MOUNT_FLAG_RANDOM_SELECT;
@@ -811,6 +815,8 @@ int master_parse_entry(const char *buffer, unsigned int default_timeout, unsigne
entry->ap->flags |= MOUNT_FLAG_RANDOM_SELECT;
if (use_weight)
entry->ap->flags |= MOUNT_FLAG_USE_WEIGHT_ONLY;
+ if (symlnk)
+ entry->ap->flags |= MOUNT_FLAG_SYMLINK;
if (negative_timeout)
entry->ap->negative_timeout = negative_timeout;
diff --git a/lib/master_tok.l b/lib/master_tok.l
index 30abb15..f9b4e55 100644
--- a/lib/master_tok.l
+++ b/lib/master_tok.l
@@ -361,6 +361,7 @@ OPTNTOUT (-n{OPTWS}|-n{OPTWS}={OPTWS}|--negative-timeout{OPTWS}|--negative-timeo
return(NUMBER);
}
+ -?symlink { return(OPT_SYMLINK); }
-?nobind { return(OPT_NOBIND); }
-?nobrowse { return(OPT_NOGHOST); }
-g|--ghost|-?browse { return(OPT_GHOST); }
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
index 8007542..bbea43a 100644
--- a/man/auto.master.5.in
+++ b/man/auto.master.5.in
@@ -159,6 +159,14 @@ on individual map entries of both types. Bind mounting of NFS file
systems can also be prevented for specific map entrys by adding the
"port=" mount option to the entries.
.TP
+.I "symlink"
+This option makes bind mounting use a symlink instead of an actual bind
+mount. It is an autofs specific option that is a pseudo mount option and
+so is given without a leading dash. It may be used with indirect map
+entries only, either in the master map (so it effects all map entries)
+or with individual map entries. The option is ignored for direct mounts
+and non-root offest mount entries.
+.TP
.I "\-r, \-\-random-multimount-selection"
Enables the use of ramdom selection when choosing a host from a
list of replicated servers. This option is applied to this mount
diff --git a/modules/mount_autofs.c b/modules/mount_autofs.c
index ef16020..8c1e600 100644
--- a/modules/mount_autofs.c
+++ b/modules/mount_autofs.c
@@ -51,6 +51,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name,
int argc, status;
int nobind = ap->flags & MOUNT_FLAG_NOBIND;
int ghost = ap->flags & MOUNT_FLAG_GHOST;
+ int symlnk = ap->flags & MOUNT_FLAG_SYMLINK;
time_t timeout = ap->entry->maps->exp_timeout;
unsigned logopt = ap->logopt;
struct map_type_info *info;
@@ -120,6 +121,8 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name,
nobind = 1;
else if (strncmp(cp, "browse", 6) == 0)
ghost = 1;
+ else if (strncmp(cp, "symlink", 7) == 0)
+ symlnk = 1;
else if (strncmp(cp, "timeout=", 8) == 0) {
char *val = strchr(cp, '=');
unsigned tout;
@@ -158,6 +161,8 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name,
}
nap = entry->ap;
nap->parent = ap;
+ if (symlnk)
+ nap->flags |= MOUNT_FLAG_SYMLINK;
argc = 1;
diff --git a/modules/mount_bind.c b/modules/mount_bind.c
index 9bce686..4975294 100644
--- a/modules/mount_bind.c
+++ b/modules/mount_bind.c
@@ -73,10 +73,44 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
char buf[MAX_ERR_BUF];
int err;
int i, len;
+ int symlnk = (*name != '/' && (ap->flags & MOUNT_FLAG_SYMLINK));
if (ap->flags & MOUNT_FLAG_REMOUNT)
return 0;
+ /* Extract "symlink" pseudo-option which forces local filesystems
+ * to be symlinked instead of bound.
+ */
+ if (*name != '/' && !symlnk && options) {
+ const char *comma;
+ int o_len = strlen(options) + 1;
+
+ for (comma = options; *comma != '\0';) {
+ const char *cp;
+ const char *end;
+
+ while (*comma == ',')
+ comma++;
+
+ /* Skip leading white space */
+ while (*comma == ' ' || *comma == '\t')
+ comma++;
+
+ cp = comma;
+ while (*comma != '\0' && *comma != ',')
+ comma++;
+
+ /* Skip trailing white space */
+ end = comma - 1;
+ while (*comma == ' ' || *comma == '\t')
+ end--;
+
+ o_len = end - cp + 1;
+ if (strncmp("symlink", cp, o_len) == 0)
+ symlnk = 1;
+ }
+ }
+
/* Root offset of multi-mount */
len = strlen(root);
if (root[len - 1] == '/') {
@@ -100,7 +134,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
if (options == NULL || *options == '\0')
options = "defaults";
- if (bind_works) {
+ if (!symlnk && bind_works) {
int status, existed = 1;
debug(ap->logopt, MODPREFIX "calling mkdir_path %s", fullpath);

View File

@ -1,42 +0,0 @@
autofs-5.0.7 - add timeout option description to man page
From: Ian Kent <ikent@redhat.com>
The pseudo option used t set the timeout for map entries is one of
the most most frequently used autofs options but is not mentioned
in auto.master(5).
---
CHANGELOG | 1 +
man/auto.master.5.in | 5 +++++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 93b9c26..7b8d185 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,7 @@
- fix parse buffer initialization.
- fix typo in automount(8).
- dont wait forever to restart.
+- add timeout option description to man page.
25/07/2012 autofs-5.0.7
=======================
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
index 54269f8..21d7544 100644
--- a/man/auto.master.5.in
+++ b/man/auto.master.5.in
@@ -167,6 +167,11 @@ server is specified in the map entry. If no server weights are given
then each available server will be tried in the order listed, within
proximity.
.TP
+.I "\-t, \-\-timeout <seconds>"
+Set the expire timeout for map entries. This option can be used to
+override the global default given either on the command line
+or in the configuration.
+.TP
.I "\-n, \-\-negative\-timeout <seconds>"
Set the timeout for caching failed key lookups. This option can be
used to override the global default given either on the command line

View File

@ -1,69 +0,0 @@
autofs-5.0.7 - allow non root user to check status
From: Ian Kent <ikent@redhat.com>
---
CHANGELOG | 1 +
redhat/autofs.init.in | 20 +++++++++++++-------
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 44c9fb2..936c9ab 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -11,6 +11,7 @@
- make description of default MOUNT_WAIT setting clear.
- configure.in: allow cross compilation.
- README: update mailing list subscription info.
+- allow non root user to check status.
25/07/2012 autofs-5.0.7
=======================
diff --git a/redhat/autofs.init.in b/redhat/autofs.init.in
index cd5cb34..fe18b3e 100644
--- a/redhat/autofs.init.in
+++ b/redhat/autofs.init.in
@@ -167,6 +167,19 @@ function usage_message() {
RETVAL=0
+# allow non-root users to read status / usage
+
+case "$1" in
+ status)
+ status -p @@autofspiddir@@/autofs.pid -l autofs $prog
+ exit 0;
+ ;;
+ usage)
+ usage_message
+ exit 0;
+ ;;
+esac
+
# Only the root user may change the service status
if [ `id -u` -ne 0 ] && [ "$1" != "status" ]; then
echo "insufficient privilege to change service status"
@@ -184,9 +197,6 @@ case "$1" in
stop)
stop
;;
- status)
- status -p @@autofspiddir@@/autofs.pid -l autofs $prog
- ;;
restart|force-reload)
restart
;;
@@ -202,10 +212,6 @@ case "$1" in
restart
fi
;;
- usage)
- usage_message
- exit 0
- ;;
*)
usage_message
exit 2

View File

@ -1,50 +0,0 @@
autofs-5.0.7 - Allow nsswitch.conf to not contain "automount:" lines
From: Michael Tokarev <mjt@tls.msk.ru>
Current code does not allow a case when nsswitch.conf
does not mention automount map at all, like all new
installations. It logs a rather unpleasant error
message instead:
syntax error in nsswitch config near [ syntax error ]
this patch has a minimal fix, to allo "file" to be empty.
Whole parser in C is about 25 lines of code, the "grammar"
is trivial, and it is better to ditch all this yacc/lex
stuff, but that will be much more intrusive change.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Cc: 682266@bugs.debian.org
---
CHANGELOG | 1 +
lib/nss_parse.y | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index bd0dd82..16ac2a0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -16,6 +16,7 @@
- increase file map read buffer size.
- handle new location of systemd.
- fix map entry duplicate offset detection.
+- Allow nsswitch.conf to not contain "automount:" lines.
25/07/2012 autofs-5.0.7
=======================
diff --git a/lib/nss_parse.y b/lib/nss_parse.y
index a39fda4..055e9d7 100644
--- a/lib/nss_parse.y
+++ b/lib/nss_parse.y
@@ -72,6 +72,7 @@ file: {
nss_debug = YYDEBUG;
#endif
} sources NL
+ | /* empty */
;
sources: nss_source

View File

@ -1,38 +0,0 @@
autofs-5.0.7 - check for protocol option
From: Ian Kent <raven@themaw.net>
When a specific protocol is requested in the mount options only
that protocol should be probed for.
---
modules/mount_nfs.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
index 9de8a73..3d2ccea 100644
--- a/modules/mount_nfs.c
+++ b/modules/mount_nfs.c
@@ -156,6 +156,12 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
if (port < 0)
port = 0;
port_opt = cp;
+ } else if (strncmp("proto=udp", cp, o_len) == 0 ||
+ strncmp("udp", cp, o_len) == 0) {
+ vers &= ~TCP_SUPPORTED;
+ } else if (strncmp("proto=tcp", cp, o_len) == 0 ||
+ strncmp("tcp", cp, o_len) == 0) {
+ vers &= ~UDP_SUPPORTED;
}
/* Check for options that also make sense
with bind mounts */
@@ -167,6 +173,10 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
}
}
+ /* In case both tcp and udp options were given */
+ if ((vers & NFS_PROTO_MASK) == 0)
+ vers |= NFS_PROTO_MASK;
+
debug(ap->logopt, MODPREFIX
"nfs options=\"%s\", nobind=%d, nosymlink=%d, ro=%d",
nfsoptions, nobind, nosymlink, ro);

View File

@ -1,28 +0,0 @@
autofs-5.0.7 - configure: allow cross compilation update
From: Chris Packham <chris.packham@alliedtelesis.co.nz>
Run "make distclean" to update configure. This should have been included
in 5936c738 when configure.in was updated but it was missed.
---
configure | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index bf62203..ba3bba6 100755
--- a/configure
+++ b/configure
@@ -5378,10 +5378,7 @@ DAEMON_LDFLAGS=
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc -fPIE works" >&5
$as_echo_n "checking whether gcc -fPIE works... " >&6; }
if test "$cross_compiling" = yes; then :
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run test program while cross compiling
-See \`config.log' for more details" "$LINENO" 5; }
+ gcc_supports_pie=no
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

View File

@ -1,41 +0,0 @@
autofs-5.0.7 - configure.in: allow cross compilation
From: Chris Packham <chris.packham@alliedtelesis.co.nz>
The default behaviour of AC_RUN_IFELSE is to stop with an error if cross
compiling. Avoid this by providing the optional 4th argument to set
gcc_supports_pie=no if support for PIE cannot be detected.
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
CHANGELOG | 1 +
configure.in | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 961e340..fe801e8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -9,6 +9,7 @@
- add timeout option description to man page.
- fix null map entry order handling.
- make description of default MOUNT_WAIT setting clear.
+- configure.in: allow cross compilation.
25/07/2012 autofs-5.0.7
=======================
diff --git a/configure.in b/configure.in
index 1a24e34..90bda62 100644
--- a/configure.in
+++ b/configure.in
@@ -307,7 +307,7 @@ DAEMON_CFLAGS=
DAEMON_LDFLAGS=
AC_MSG_CHECKING([whether gcc -fPIE works])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[]], [[int main(void) {return 0;}]])],
- [gcc_supports_pie=yes], [gcc_supports_pie=no])
+ [gcc_supports_pie=yes], [gcc_supports_pie=no], [gcc_supports_pie=no])
AC_MSG_RESULT([$gcc_supports_pie])
if test $gcc_supports_pie = yes ; then
DAEMON_CFLAGS="-fPIE"

View File

@ -1,40 +0,0 @@
autofs-5.0.7 - depricate nosymlink pseudo option
From: Ian Kent <raven@themaw.net>
The undocumented "nosymlink" option was the only way to force local
NFS mounting until the more descriptive "nobind" option was added.
So depricate the "nosymlink" option in favour of the "nobind" option.
---
CHANGELOG | 1 +
modules/mount_nfs.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/CHANGELOG b/CHANGELOG
index a7ed212..c189483 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -31,6 +31,7 @@
- dont fail on master map self include.
- fix wildcard multi map regression.
- fix file descriptor leak when reloading the daemon.
+- depricate nosymlink pseudo option.
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
index bbbb1de..e61320b 100644
--- a/modules/mount_nfs.c
+++ b/modules/mount_nfs.c
@@ -125,6 +125,10 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
o_len = end - cp + 1;
if (strncmp("nosymlink", cp, o_len) == 0) {
+ warn(ap->logopt, MODPREFIX
+ "the \"nosymlink\" option is depricated "
+ "and will soon be removed, "
+ "use the \"nobind\" option instead");
nosymlink = 1;
} else if (strncmp("nobind", cp, o_len) == 0) {
nobind = 1;

View File

@ -1,48 +0,0 @@
autofs-5.0.7 - document allowed map sources in auto.master
From: Ian Kent <raven@themaw.net>
Direct map may have multiple map sources but indirect maps may have
only one map source.
---
CHANGELOG | 1 +
man/auto.master.5.in | 7 +++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 4576d47..61edddf 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -41,6 +41,7 @@
- syncronize handle_mounts() shutdown.
- fix submount tree not all expiring.
- make dump maps check for duplicate indirect mounts.
+- document allowed map sources in auto.master.
25/07/2012 autofs-5.0.7
=======================
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
index c552e56..7907ffa 100644
--- a/man/auto.master.5.in
+++ b/man/auto.master.5.in
@@ -40,7 +40,8 @@ For direct maps the mount point is always specified as:
.P
/-
.P
-and the key used within the direct map is the full path to the mount point.
+and the key used within the direct map is the full path to the mount point. The direct map
+may have multiple entries in the master map.
.P
For indirect maps access is by using the path scheme:
.P
@@ -60,7 +61,9 @@ present in the master map by including a line of the form:
and
.BR automount (8)
will process the map according to the specification described below for
-map entries.
+map entries. Indirect map entries must be unique in the master map so
+second and subsequent entries for an indirect mount point are ignored by
+.BR automount (8).
.SH "FORMAT"
Master map entries have three fields separated by an arbitrary number
of spaces or tabs. Lines beginning with # are comments. The first field

View File

@ -1,46 +0,0 @@
autofs-5.0.7 - document browse option in man page
From: Ian Kent <raven@themaw.net>
The "browse" option has remained undocumented for a long time.
Finally add a section for it to auto.master(5) making special
note of the potential performance implications.
---
CHANGELOG | 1 +
man/auto.master.5.in | 11 +++++++++++
2 files changed, 12 insertions(+)
diff --git a/CHANGELOG b/CHANGELOG
index ecdea0b..d8e4049 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -36,6 +36,7 @@
- fix requires in spec file.
- fix libtirpc build option to require libtirpc-devel if needed.
- fix systemd unidir in spec file.
+- document browse option in man page.
25/07/2012 autofs-5.0.7
=======================
diff --git a/man/auto.master.5.in b/man/auto.master.5.in
index bbea43a..c552e56 100644
--- a/man/auto.master.5.in
+++ b/man/auto.master.5.in
@@ -147,6 +147,17 @@ multiple file systems should be mounted (`multimounts'). If this option
is given, no file system is mounted at all if at least one file system
can't be mounted.
.TP
+.I "[no]browse"
+This is an autofs specific option that is a pseudo mount option and
+so is given without a leading dash. Use of the browse option pre-creates
+mount point directories for indirect mount maps so the map keys can be
+seen in a directory listing without being mounted. Use of this option
+can cause performance problem if the indirect map is large so it should
+be used with caution. The internal program default is to enable browse
+mode for indirect mounts but the default installed configuration overrides
+this by setting BROWSE_MODE to "no" because of the potential performance
+problem.
+.TP
.I "nobind"
This is an autofs specific option that is a pseudo mount option and
so is given without a leading dash. It may be used either in the master

View File

@ -1,59 +0,0 @@
autofs-5.0.7 - dont fail on master map self include
From: Ian Kent <raven@themaw.net>
When reading the master map a self included file map should skip the source
and proceed to the next so, in this case, return an nss status that will
allow the map read to continue. In particular not NSS_STATUS_UNAVAIL which
causes the lookup to record a failure or NSS_STATUS_SUCCESS which indicates
a successful lookup and termintes the reading of sources.
---
CHANGELOG | 1 +
modules/lookup_file.c | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 39388a5..97d6f48 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -28,6 +28,7 @@
- make yellow pages support optional.
- modules/replicated.c: use sin6_addr.s6_addr32.
- workaround missing GNU versionsort extension.
+- dont fail on master map self include.
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/lookup_file.c b/modules/lookup_file.c
index facb305..f37bed9 100644
--- a/modules/lookup_file.c
+++ b/modules/lookup_file.c
@@ -397,8 +397,9 @@ int lookup_read_master(struct master *master, time_t age, void *context)
unsigned int path_len, ent_len;
int entry, cur_state;
+ /* Don't return fail on self include, skip source */
if (master->recurse)
- return NSS_STATUS_UNAVAIL;
+ return NSS_STATUS_TRYAGAIN;
if (master->depth > MAX_INCLUDE_DEPTH) {
error(logopt, MODPREFIX
@@ -443,7 +444,7 @@ int lookup_read_master(struct master *master, time_t age, void *context)
inc = check_master_self_include(master, ctxt);
if (inc)
- master->recurse = 1;;
+ master->recurse = 1;
master->depth++;
status = lookup_nss_read_master(master, age);
if (!status) {
@@ -645,7 +646,7 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context)
mc = source->mc;
if (source->recurse)
- return NSS_STATUS_UNAVAIL;
+ return NSS_STATUS_TRYAGAIN;
if (source->depth > MAX_INCLUDE_DEPTH) {
error(ap->logopt,

View File

@ -1,46 +0,0 @@
autofs-5.0.7 - don't override LDFLAGS in make rules
From: Ian Kent <ikent@redhat.com>
Ensure that externally defined LDFLAGS is not overridden.
---
CHANGELOG | 1 +
Makefile.rules | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 5d90139..37eac72 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -53,6 +53,7 @@
- fix probe each nfs version in turn for singleton mounts.
- misc man page fixes.
- fix add null check in parse_server_string().
+- don't override LDFLAGS in make rules.
25/07/2012 autofs-5.0.7
=======================
diff --git a/Makefile.rules b/Makefile.rules
index f2ba386..6b5b2bd 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -24,16 +24,16 @@ endif
ifdef DEBUG
CFLAGS ?= -g -Wall -DDEBUG
-LDFLAGS = -g
+LDFLAGS ?= -g
STRIP = :
else
ifdef DONTSTRIP
CFLAGS ?= -O2 -g
-LDFLAGS = -g
+LDFLAGS ?= -g
STRIP = :
else
CFLAGS ?= -O2 -Wall
-LDFLAGS = -s
+LDFLAGS ?= -s
STRIP = strip --strip-debug
endif
endif

View File

@ -1,68 +0,0 @@
autofs-5.0.7 - dont probe rdma mounts
From: Ian Kent <raven@themaw.net>
Since the change to pass text nfs mount options drectly to the kernel all autofs
mount requests now probe server availability. This was because of long delays
mounting from servers that aren't responding.
This caused mounts requesting the rdma protocol to fail if udp or tcp was also
not available from the server.
Since, AFAICT the rmda protocol can't be used with RPC fromn userspace, the only
way to work around it is to not probe servers when rdma is requested.
---
CHANGELOG | 1 +
modules/mount_nfs.c | 13 ++++++++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG b/CHANGELOG
index 50e83d7..f9bc987 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -44,6 +44,7 @@
- document allowed map sources in auto.master.
- add enable sloppy mount option to configure.
- fix interface address null check.
+- dont probe rdma mounts.
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
index e61320b..5424d74 100644
--- a/modules/mount_nfs.c
+++ b/modules/mount_nfs.c
@@ -71,6 +71,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
int nosymlink = 0;
int port = -1;
int ro = 0; /* Set if mount bind should be read-only */
+ int rdma = 0;
if (ap->flags & MOUNT_FLAG_REMOUNT)
return 0;
@@ -124,6 +125,11 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
end--;
o_len = end - cp + 1;
+
+ if (strncmp("proto=rdma", cp, o_len) == 0 ||
+ strncmp("rdma", cp, o_len) == 0)
+ rdma = 1;
+
if (strncmp("nosymlink", cp, o_len) == 0) {
warn(ap->logopt, MODPREFIX
"the \"nosymlink\" option is depricated "
@@ -170,7 +176,12 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
info(ap->logopt, MODPREFIX "no hosts available");
return 1;
}
- prune_host_list(ap->logopt, &hosts, vers, port);
+ /*
+ * We can't probe protocol rdma so leave it to mount.nfs(8)
+ * and and suffer the delay if a server isn't available.
+ */
+ if (!rdma)
+ prune_host_list(ap->logopt, &hosts, vers, port);
if (!hosts) {
info(ap->logopt, MODPREFIX "no hosts available");

View File

@ -1,69 +0,0 @@
autofs-5.0.7 - don't schedule new alarms after readmap
From: Leonardo Chiquitto <leonardo.lists@gmail.com>
Currently, a new alarm is scheduled every time the daemon receives
a SIGHUP (map re-read) or SIGUSR1 (forced expiration). Besides that,
map re-reads started on demand when a map is found to be outdated
also generate a new alarm.
Once added, these alarms are never deleted and hence increase the
number of times the daemon wakes up to run the expiration procedure.
After a couple of months, in setups with many mount points, it's
normal to see automount waking up every second to handle the
expiration timer.
This patch removes the alarm scheduling from the readmap cleanup
routine and makes sure the alarm is re-added after the expiration
process only when it was not triggered by SIGUSR1.
I couldn't think of any use case to justify keeping these alarms:
it's critical to have the alarm ticking every timeout/4 seconds,
but more than one periodic alarm running doesn't seem to make
sense.
---
CHANGELOG | 1 +
daemon/state.c | 6 +-----
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index c9be73e..4cf5621 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -22,6 +22,7 @@
- fix init script status return.
- fix use get_proximity() without libtirpc.
- don't use dirent d_type to filter out files in scandir()
+- don't schedule new alarms after readmap.
25/07/2012 autofs-5.0.7
=======================
diff --git a/daemon/state.c b/daemon/state.c
index b451c56..6e23022 100644
--- a/daemon/state.c
+++ b/daemon/state.c
@@ -144,7 +144,7 @@ void expire_cleanup(void *arg)
ap->submount = 2;
}
- if (!ap->submount)
+ if (ap->state == ST_EXPIRE && !ap->submount)
alarm_add(ap, ap->exp_runfreq);
/* FALLTHROUGH */
@@ -330,13 +330,9 @@ static void do_readmap_cleanup(void *arg)
ap = ra->ap;
st_mutex_lock();
-
ap->readmap_thread = 0;
st_set_done(ap);
- if (!ap->submount)
- alarm_add(ap, ap->exp_runfreq);
st_ready(ap);
-
st_mutex_unlock();
free(ra);

View File

@ -1,41 +0,0 @@
autofs-5.0.7 - don't use dirent d_type to filter out files in scandir()
From: Leonardo Chiquitto <leonardo.lists@gmail.com>
The "d_type" field of a dirent structure is not filled in by all
file systems (XFS being one example), so we can't rely on it to
check file types.
---
CHANGELOG | 1 +
modules/lookup_dir.c | 4 ----
2 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 460bd27..c9be73e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -21,6 +21,7 @@
- fix submount offset delete.
- fix init script status return.
- fix use get_proximity() without libtirpc.
+- don't use dirent d_type to filter out files in scandir()
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/lookup_dir.c b/modules/lookup_dir.c
index 658cc29..33901c0 100644
--- a/modules/lookup_dir.c
+++ b/modules/lookup_dir.c
@@ -103,10 +103,6 @@ static int acceptable_dirent_p(const struct dirent *e)
{
size_t namesz;
-
- if (!(e->d_type == DT_REG || e->d_type == DT_LNK))
- return 0;
-
namesz = strlen(e->d_name);
if (!namesz)
return 0;

Some files were not shown because too many files have changed in this diff Show More