- update with upstream fixes.

This commit is contained in:
Ian Kent 2013-03-12 09:20:33 +08:00
parent 799ea50358
commit 92f44e815c
12 changed files with 1103 additions and 11 deletions

View File

@ -0,0 +1,217 @@
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

@ -0,0 +1,40 @@
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

@ -0,0 +1,46 @@
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

@ -0,0 +1,59 @@
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

@ -0,0 +1,24 @@
autofs-5.0.7 - fix automounter support on parisc
From: Helge Deller <deller@gmx.de>
This patch fixes automounter support on the parisc architecture with
64-bit kernel and 32-bit userspace.
Signed-off-by: Helge Deller <deller@gmx.de>
---
daemon/automount.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/daemon/automount.c b/daemon/automount.c
index 4a3eb3d..4c651cf 100644
--- a/daemon/automount.c
+++ b/daemon/automount.c
@@ -610,6 +610,7 @@ static size_t get_kpkt_len(void)
if (strcmp(un.machine, "alpha") == 0 ||
strcmp(un.machine, "ia64") == 0 ||
strcmp(un.machine, "x86_64") == 0 ||
+ strcmp(un.machine, "parisc64") == 0 ||
strcmp(un.machine, "ppc64") == 0)
pkt_len += 4;

View File

@ -0,0 +1,179 @@
autofs-5.0.7 - fix file descriptor leak when reloading the daemon
From: Leonardo Chiquitto <leonardo.lists@gmail.com>
A customer reported that AutoFS may leak file descriptors when some
maps are modified and the daemon reloaded. I'm able to reproduce the
problem on 5.0.7 by following these steps:
1. Configure a simple direct mount:
# cat /etc/auto.master
/- /etc/auto.direct
# cat /etc/auto.direct
/nfs server:/nfs
2. Start the automounter and do NOT trigger the mount
3. Replace /etc/auto.direct with:
# cat /etc/auto.direct
/nfs/1 server:/nfs
/nfs/2 server:/nfs
4. Reload:
# kill -HUP $(pidof automount)
>From now on, every reload will leak a file descriptor:
# ls -la /proc/$(pidof automount)/fd | grep /nfs
lr-x------ 1 root root 64 Aug 14 22:08 11 -> /nfs
lr-x------ 1 root root 64 Aug 14 22:08 12 -> /nfs
lr-x------ 1 root root 64 Aug 14 22:08 13 -> /nfs
lr-x------ 1 root root 64 Aug 14 22:08 14 -> /nfs
lr-x------ 1 root root 64 Aug 14 22:08 5 -> /nfs
I've investigated the problem and discovered that the leak happens in
do_umount_autofs_direct():
- edit imk
The same leak is present in umount_autofs_offset() also.
Updated patch to cover that too.
- end edit
int do_umount_autofs_direct(struct autofs_point *ap, struct mnt_list
*mnts, struct mapent *me)
{
(...)
if (me->ioctlfd != -1) {
if (tree_is_mounted(mnts, me->key, MNTS_REAL)) {
error(ap->logopt,
"attempt to umount busy direct mount %s",
me->key);
return 1;
}
ioctlfd = me->ioctlfd;
} else // ioctlfd == -1
ops->open(ap->logopt, &ioctlfd, me->dev, me->key); <= we open it here
if (ioctlfd >= 0) {
unsigned int status = 1;
rv = ops->askumount(ap->logopt, ioctlfd, &status);
/// at this point, rv == 0 and status == 0
if (rv) {
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
error(ap->logopt, "ioctl failed: %s", estr);
return 1;
} else if (!status) {
/// at this point, ap->state == ST_READMAP
if (ap->state != ST_SHUTDOWN_FORCE) {
error(ap->logopt,
"ask umount returned busy for %s",
me->key);
return 1; <= we return here, without closing the fd
} else {
me->ioctlfd = -1;
ops->catatonic(ap->logopt, ioctlfd);
ops->close(ap->logopt, ioctlfd);
goto force_umount;
}
(...)
---
CHANGELOG | 1 +
daemon/direct.c | 19 ++++++++++++++++---
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 46ef335..a7ed212 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -30,6 +30,7 @@
- workaround missing GNU versionsort extension.
- dont fail on master map self include.
- fix wildcard multi map regression.
+- fix file descriptor leak when reloading the daemon.
25/07/2012 autofs-5.0.7
=======================
diff --git a/daemon/direct.c b/daemon/direct.c
index 3e09c5d..228a666 100644
--- a/daemon/direct.c
+++ b/daemon/direct.c
@@ -86,7 +86,8 @@ int do_umount_autofs_direct(struct autofs_point *ap, struct mnt_list *mnts, stru
{
struct ioctl_ops *ops = get_ioctl_ops();
char buf[MAX_ERR_BUF];
- int ioctlfd, rv, left, retries;
+ int ioctlfd = -1, rv, left, retries;
+ int opened = 0;
left = umount_multi(ap, me->key, 0);
if (left) {
@@ -103,8 +104,10 @@ int do_umount_autofs_direct(struct autofs_point *ap, struct mnt_list *mnts, stru
return 1;
}
ioctlfd = me->ioctlfd;
- } else
+ } else {
ops->open(ap->logopt, &ioctlfd, me->dev, me->key);
+ opened = 1;
+ }
if (ioctlfd >= 0) {
unsigned int status = 1;
@@ -113,12 +116,16 @@ int do_umount_autofs_direct(struct autofs_point *ap, struct mnt_list *mnts, stru
if (rv) {
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
error(ap->logopt, "ioctl failed: %s", estr);
+ if (opened && ioctlfd != -1)
+ ops->close(ap->logopt, ioctlfd);
return 1;
} else if (!status) {
if (ap->state != ST_SHUTDOWN_FORCE) {
error(ap->logopt,
"ask umount returned busy for %s",
me->key);
+ if (opened && ioctlfd != -1)
+ ops->close(ap->logopt, ioctlfd);
return 1;
} else {
me->ioctlfd = -1;
@@ -536,7 +543,8 @@ int umount_autofs_offset(struct autofs_point *ap, struct mapent *me)
{
struct ioctl_ops *ops = get_ioctl_ops();
char buf[MAX_ERR_BUF];
- int ioctlfd, rv = 1, retries;
+ int ioctlfd = -1, rv = 1, retries;
+ int opened = 0;
if (me->ioctlfd != -1) {
if (is_mounted(_PATH_MOUNTED, me->key, MNTS_REAL)) {
@@ -554,6 +562,7 @@ int umount_autofs_offset(struct autofs_point *ap, struct mapent *me)
return 0;
}
ops->open(ap->logopt, &ioctlfd, me->dev, me->key);
+ opened = 1;
}
if (ioctlfd >= 0) {
@@ -563,6 +572,8 @@ int umount_autofs_offset(struct autofs_point *ap, struct mapent *me)
if (rv) {
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
logerr("ioctl failed: %s", estr);
+ if (opened && ioctlfd != -1)
+ ops->close(ap->logopt, ioctlfd);
return 1;
} else if (!status) {
if (ap->state != ST_SHUTDOWN_FORCE) {
@@ -570,6 +581,8 @@ int umount_autofs_offset(struct autofs_point *ap, struct mapent *me)
error(ap->logopt,
"ask umount returned busy for %s",
me->key);
+ if (opened && ioctlfd != -1)
+ ops->close(ap->logopt, ioctlfd);
return 1;
} else {
me->ioctlfd = -1;

View File

@ -0,0 +1,66 @@
autofs-5.0.7 - fix libtirpc build option
From: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
autofs.spec | 17 ++++++++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG b/CHANGELOG
index e848bcd..b6b2679 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -34,6 +34,7 @@
- depricate nosymlink pseudo option.
- add symlink pseudo option.
- fix requires in spec file.
+- fix libtirpc build option to require libtirpc-devel if needed.
25/07/2012 autofs-5.0.7
=======================
diff --git a/autofs.spec b/autofs.spec
index 703f7a9..f77acc1 100644
--- a/autofs.spec
+++ b/autofs.spec
@@ -12,6 +12,10 @@
# disable them.
%define with_systemd %{?_without_systemd: 0} %{?!_without_systemd: 1}
+# Use --without libtirpc in your rpmbuild command or force values to 0 to
+# disable them.
+%define with_libtirpc %{?_without_libtirpc: 0} %{?!_without_libtirpc: 1}
+
Summary: A tool from automatically mounting and umounting filesystems.
Name: autofs
%define version 5.0.7
@@ -25,6 +29,9 @@ Buildroot: %{_tmppath}/%{name}-tmp
%if %{with_systemd}
BuildRequires: systemd-units
%endif
+%if %{with_libtirpc}
+BuildRequires: libtirpc-devel
+%endif
BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, cyrus-sasl-devel
Requires: chkconfig
Requires: /bin/bash mktemp sed textutils sh-utils grep /bin/ps
@@ -72,9 +79,17 @@ echo %{version}-%{release} > .version
%define _unitdir %{?_unitdir:/lib/systemd/system}
%define systemd_configure_arg --with-systemd
%endif
+%if %{with_libtirpc}
+ %define libtirpc_configure_arg --with-libtirpc
+%endif
%build
-CFLAGS="$RPM_OPT_FLAGS -Wall" ./configure --libdir=%{_libdir} --disable-mount-locking --enable-ignore-busy --with-libtirpc %{?systemd_configure_arg:}
+CFLAGS="$RPM_OPT_FLAGS -Wall" \
+./configure --libdir=%{_libdir} \
+ --disable-mount-locking \
+ --enable-ignore-busy \
+ %{?systemd_configure_arg:} \
+ %{?libtirpc_configure_arg:}
CFLAGS="$RPM_OPT_FLAGS -Wall" make initdir=/etc/rc.d/init.d DONTSTRIP=1
%install

View File

@ -0,0 +1,37 @@
autofs-5.0.7 - fix requires in spec file
From: Ian Kent <raven@themaw.net>
Fix the use of depricated reqires in tar spec file.
---
CHANGELOG | 1 +
autofs.spec | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 247d334..e848bcd 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -33,6 +33,7 @@
- fix file descriptor leak when reloading the daemon.
- depricate nosymlink pseudo option.
- add symlink pseudo option.
+- fix requires in spec file.
25/07/2012 autofs-5.0.7
=======================
diff --git a/autofs.spec b/autofs.spec
index b8a3b7a..703f7a9 100644
--- a/autofs.spec
+++ b/autofs.spec
@@ -25,8 +25,8 @@ Buildroot: %{_tmppath}/%{name}-tmp
%if %{with_systemd}
BuildRequires: systemd-units
%endif
-BuildPrereq: autoconf, hesiod-devel, openldap-devel, bison, flex, cyrus-sasl-devel
-Prereq: chkconfig
+BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, cyrus-sasl-devel
+Requires: chkconfig
Requires: /bin/bash mktemp sed textutils sh-utils grep /bin/ps
%if %{with_systemd}
Requires(post): systemd-sysv

View File

@ -0,0 +1,72 @@
autofs-5.0.7 - fix systemd unidir in spec file
From: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
autofs.spec | 16 ++++++++--------
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index b6b2679..ecdea0b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -35,6 +35,7 @@
- add symlink pseudo option.
- fix requires in spec file.
- fix libtirpc build option to require libtirpc-devel if needed.
+- fix systemd unidir in spec file.
25/07/2012 autofs-5.0.7
=======================
diff --git a/autofs.spec b/autofs.spec
index f77acc1..a768e44 100644
--- a/autofs.spec
+++ b/autofs.spec
@@ -76,7 +76,7 @@ inkludera n
%setup -q
echo %{version}-%{release} > .version
%if %{with_systemd}
- %define _unitdir %{?_unitdir:/lib/systemd/system}
+ %define unitdir %{?_unitdir:/lib/systemd/system}
%define systemd_configure_arg --with-systemd
%endif
%if %{with_libtirpc}
@@ -95,7 +95,7 @@ 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}
+install -d -m 755 $RPM_BUILD_ROOT%{unitdir}
%else
mkdir -p -m755 $RPM_BUILD_ROOT/etc/rc.d/init.d
%endif
@@ -109,9 +109,13 @@ make install mandir=%{_mandir} initdir=/etc/rc.d/init.d INSTALLROOT=$RPM_BUILD_R
echo make -C redhat
make -C redhat
%if %{with_systemd}
-install -m 644 redhat/autofs.service $RPM_BUILD_ROOT%{_unitdir}/autofs.service
+# Configure can get this wrong when the unit files appear under /lib and /usr/lib
+find $RPM_BUILD_ROOT -type f -name autofs.service -exec rm -f {} \;
+install -m 644 redhat/autofs.service $RPM_BUILD_ROOT%{unitdir}/autofs.service
+%define init_file_name %{unitdir}/autofs.service
%else
install -m 755 redhat/autofs.init $RPM_BUILD_ROOT/etc/rc.d/init.d/autofs
+%define init_file_name /etc/rc.d/init.d/autofs
%endif
install -m 644 redhat/autofs.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/autofs
@@ -170,11 +174,7 @@ fi
%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 %{init_file_name}
%config(noreplace) /etc/auto.master
%config(noreplace,missingok) /etc/auto.misc
%config(noreplace,missingok) /etc/auto.net

View File

@ -0,0 +1,225 @@
autofs-5.0.7 - fix wildcard multi map regression
From: Ian Kent <raven@themaw.net>
A recent patch that removed code to add the current map entry when
being parsed if it didn't already exist cause wildcard indirect
multi-mount map entries to fail to mount.
Indirect multi-mount map entries need the entry matched by a wildcard
lookup to be added to the map entry cache because subsequent operations
expect a distinct map entry to be present or they will fail. This is
what the code that was removed did but it did so in the wrong place
which caused a deadlock situation.
---
CHANGELOG | 1 +
modules/lookup_file.c | 23 ++++++++++++++++-------
modules/lookup_ldap.c | 19 +++++++++++++++----
modules/lookup_nisplus.c | 21 ++++++++++++++++-----
modules/lookup_sss.c | 17 ++++++++++++++---
modules/lookup_yp.c | 21 ++++++++++++++++-----
6 files changed, 78 insertions(+), 24 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 97d6f48..46ef335 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -29,6 +29,7 @@
- modules/replicated.c: use sin6_addr.s6_addr32.
- workaround missing GNU versionsort extension.
- dont fail on master map self include.
+- fix wildcard multi map regression.
25/07/2012 autofs-5.0.7
=======================
diff --git a/modules/lookup_file.c b/modules/lookup_file.c
index f37bed9..65e5ee6 100644
--- a/modules/lookup_file.c
+++ b/modules/lookup_file.c
@@ -1040,7 +1040,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
return NSS_STATUS_UNAVAIL;
}
- cache_readlock(mc);
+ cache_writelock(mc);
me = cache_lookup_first(mc);
if (me && st.st_mtime <= me->age) {
/*
@@ -1082,7 +1082,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
}
}
- cache_readlock(mc);
+ cache_writelock(mc);
do_cache_lookup:
me = cache_lookup(mc, key);
/*
@@ -1098,11 +1098,20 @@ do_cache_lookup:
if (!me)
me = cache_lookup_distinct(mc, "*");
}
- if (me && me->mapent && (me->source == source || *me->key == '/')) {
- pthread_cleanup_push(cache_lock_cleanup, mc);
- strcpy(mapent_buf, me->mapent);
- mapent = mapent_buf;
- pthread_cleanup_pop(0);
+ if (me && me->mapent) {
+ /*
+ * Add wildcard match for later validation checks and
+ * negative cache lookups.
+ */
+ if (ap->type == LKP_INDIRECT && *me->key == '*') {
+ ret = cache_update(mc, source, key, me->mapent, me->age);
+ if (!(ret & (CHE_OK | CHE_UPDATED)))
+ me = NULL;
+ }
+ if (me && (me->source == source || *me->key == '/')) {
+ strcpy(mapent_buf, me->mapent);
+ mapent = mapent_buf;
+ }
}
cache_unlock(mc);
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
index 431e50d..83e3215 100644
--- a/modules/lookup_ldap.c
+++ b/modules/lookup_ldap.c
@@ -2969,7 +2969,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
return status;
}
- cache_readlock(mc);
+ cache_writelock(mc);
me = cache_lookup(mc, key);
/* Stale mapent => check for entry in alternate source or wildcard */
if (me && !me->mapent) {
@@ -2979,9 +2979,20 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
if (!me)
me = cache_lookup_distinct(mc, "*");
}
- if (me && me->mapent && (me->source == source || *me->key == '/')) {
- strcpy(mapent_buf, me->mapent);
- mapent = mapent_buf;
+ if (me && me->mapent) {
+ /*
+ * Add wildcard match for later validation checks and
+ * negative cache lookups.
+ */
+ if (ap->type == LKP_INDIRECT && *me->key == '*') {
+ ret = cache_update(mc, source, key, me->mapent, me->age);
+ if (!(ret & (CHE_OK | CHE_UPDATED)))
+ me = NULL;
+ }
+ if (me && (me->source == source || *me->key == '/')) {
+ strcpy(mapent_buf, me->mapent);
+ mapent = mapent_buf;
+ }
}
cache_unlock(mc);
diff --git a/modules/lookup_nisplus.c b/modules/lookup_nisplus.c
index 9fced96..8237a1e 100644
--- a/modules/lookup_nisplus.c
+++ b/modules/lookup_nisplus.c
@@ -561,7 +561,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
return status;
}
- cache_readlock(mc);
+ cache_writelock(mc);
me = cache_lookup(mc, key);
/* Stale mapent => check for entry in alternate source or wildcard */
if (me && !me->mapent) {
@@ -571,10 +571,21 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
if (!me)
me = cache_lookup_distinct(mc, "*");
}
- if (me && me->mapent && (me->source == source || *me->key == '/')) {
- mapent_len = strlen(me->mapent);
- mapent = malloc(mapent_len + 1);
- strcpy(mapent, me->mapent);
+ if (me && me->mapent) {
+ /*
+ * Add wildcard match for later validation checks and
+ * negative cache lookups.
+ */
+ if (ap->type == LKP_INDIRECT && *me->key == '*') {
+ ret = cache_update(mc, source, key, me->mapent, me->age);
+ if (!(ret & (CHE_OK | CHE_UPDATED)))
+ me = NULL;
+ }
+ if (me && (me->source == source || *me->key == '/')) {
+ mapent_len = strlen(me->mapent);
+ mapent = malloc(mapent_len + 1);
+ strcpy(mapent, me->mapent);
+ }
}
cache_unlock(mc);
diff --git a/modules/lookup_sss.c b/modules/lookup_sss.c
index e0b84cc..5c2ed0a 100644
--- a/modules/lookup_sss.c
+++ b/modules/lookup_sss.c
@@ -645,9 +645,20 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
if (!me)
me = cache_lookup_distinct(mc, "*");
}
- if (me && me->mapent && (me->source == source || *me->key == '/')) {
- strcpy(mapent_buf, me->mapent);
- mapent = mapent_buf;
+ if (me && me->mapent) {
+ /*
+ * Add wildcard match for later validation checks and
+ * negative cache lookups.
+ */
+ if (ap->type == LKP_INDIRECT && *me->key == '*') {
+ ret = cache_update(mc, source, key, me->mapent, me->age);
+ if (!(ret & (CHE_OK | CHE_UPDATED)))
+ me = NULL;
+ }
+ if (me && (me->source == source || *me->key == '/')) {
+ strcpy(mapent_buf, me->mapent);
+ mapent = mapent_buf;
+ }
}
cache_unlock(mc);
diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c
index 720df2e..a716e1f 100644
--- a/modules/lookup_yp.c
+++ b/modules/lookup_yp.c
@@ -662,7 +662,7 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
return status;
}
- cache_readlock(mc);
+ cache_writelock(mc);
me = cache_lookup(mc, key);
/* Stale mapent => check for entry in alternate source or wildcard */
if (me && !me->mapent) {
@@ -672,10 +672,21 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
if (!me)
me = cache_lookup_distinct(mc, "*");
}
- if (me && me->mapent && (me->source == source || *me->key == '/')) {
- mapent_len = strlen(me->mapent);
- mapent = alloca(mapent_len + 1);
- strcpy(mapent, me->mapent);
+ if (me && me->mapent) {
+ /*
+ * Add wildcard match for later validation checks and
+ * negative cache lookups.
+ */
+ if (ap->type == LKP_INDIRECT && *me->key == '*') {
+ ret = cache_update(mc, source, key, me->mapent, me->age);
+ if (!(ret & (CHE_OK | CHE_UPDATED)))
+ me = NULL;
+ }
+ if (me && (me->source == source || *me->key == '/')) {
+ mapent_len = strlen(me->mapent);
+ mapent = alloca(mapent_len + 1);
+ strcpy(mapent, me->mapent);
+ }
}
cache_unlock(mc);

View File

@ -0,0 +1,92 @@
autofs-5.0.7 - update kernel include files
From: Ian Kent <raven@themaw.net>
Update autofs include files to include the latest changes.
---
include/linux/auto_fs.h | 33 ++++++++++-----------------------
include/linux/auto_fs4.h | 3 ++-
2 files changed, 12 insertions(+), 24 deletions(-)
diff --git a/include/linux/auto_fs.h b/include/linux/auto_fs.h
index 91d414f..64df1a6 100644
--- a/include/linux/auto_fs.h
+++ b/include/linux/auto_fs.h
@@ -14,13 +14,8 @@
#ifndef _LINUX_AUTO_FS_H
#define _LINUX_AUTO_FS_H
-#ifdef __KERNEL__
-#include <linux/fs.h>
-#include <linux/limits.h>
#include <linux/types.h>
-#include <linux/ioctl.h>
-#else
-#include <asm/types.h>
+#ifndef __KERNEL__
#include <sys/ioctl.h>
#endif /* __KERNEL__ */
@@ -32,25 +27,16 @@
#define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION
/*
- * Architectures where both 32- and 64-bit binaries can be executed
- * on 64-bit kernels need this. This keeps the structure format
- * uniform, and makes sure the wait_queue_token isn't too big to be
- * passed back down to the kernel.
- *
- * This assumes that on these architectures:
- * mode 32 bit 64 bit
- * -------------------------
- * int 32 bit 32 bit
- * long 32 bit 64 bit
- *
- * If so, 32-bit user-space code should be backwards compatible.
+ * The wait_queue_token (autofs_wqt_t) is part of a structure which is passed
+ * back to the kernel via ioctl from userspace. On architectures where 32- and
+ * 64-bit userspace binaries can be executed it's important that the size of
+ * autofs_wqt_t stays constant between 32- and 64-bit Linux kernels so that we
+ * do not break the binary ABI interface by changing the structure size.
*/
-
-#if defined(__sparc__) || defined(__mips__) || defined(__x86_64__) \
- || defined(__powerpc__) || defined(__s390__)
-typedef unsigned int autofs_wqt_t;
-#else
+#if defined(__ia64__) || defined(__alpha__) /* pure 64bit architectures */
typedef unsigned long autofs_wqt_t;
+#else
+typedef unsigned int autofs_wqt_t;
#endif
/* Packet types */
@@ -81,6 +67,7 @@ struct autofs_packet_expire {
#define AUTOFS_IOC_FAIL _IO(0x93,0x61)
#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62)
#define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int)
+#define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,compat_ulong_t)
#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long)
#define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire)
diff --git a/include/linux/auto_fs4.h b/include/linux/auto_fs4.h
index 55fa478..e02982f 100644
--- a/include/linux/auto_fs4.h
+++ b/include/linux/auto_fs4.h
@@ -12,6 +12,7 @@
#define _LINUX_AUTO_FS4_H
/* Include common v3 definitions */
+#include <linux/types.h>
#include <linux/auto_fs.h>
/* autofs v4 definitions */
@@ -23,7 +24,7 @@
#define AUTOFS_MIN_PROTO_VERSION 3
#define AUTOFS_MAX_PROTO_VERSION 5
-#define AUTOFS_PROTO_SUBVERSION 1
+#define AUTOFS_PROTO_SUBVERSION 2
/* Mask for expire behaviour */
#define AUTOFS_EXP_IMMEDIATE 1

View File

@ -8,7 +8,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.0.7
Release: 11%{?dist}
Release: 12%{?dist}
Epoch: 1
License: GPLv2+
Group: System Environment/Daemons
@ -43,6 +43,17 @@ Patch27: autofs-5.0.7-lib-defaults-use-WITH_LDAP-conditional-around-LDAP-types.p
Patch28: autofs-5.0.7-make-yellow-pages-support-optional.patch
Patch29: autofs-5.0.7-modules-replicated-use-sin6.addr-s6_addr32.patch
Patch30: autofs-5.0.7-workaround-missing-GNU-versionsort-extension.patch
Patch31: autofs-5.0.7-dont-fail-on-master-map-self-include.patch
Patch32: autofs-5.0.7-fix-wildcard-multi-map-regression.patch
Patch33: autofs-5.0.7-fix-file-descriptor-leak-when-reloading-the-daemon.patch
Patch34: autofs-5.0.7-depricate-nosymlink-pseudo-option.patch
Patch35: autofs-5.0.7-add-symlink-pseudo-option.patch
Patch36: autofs-5.0.7-update-kernel-include-files.patch
Patch37: autofs-5.0.7-fix-requires-in-spec-file.patch
Patch38: autofs-5.0.7-fix-libtirpc-build-option.patch
Patch39: autofs-5.0.7-fix-systemd-unidir-in-spec-file.patch
Patch40: autofs-5.0.7-document-browse-option-in-man-page.patch
Patch41: autofs-5.0.7-fix-automounter-support-on-parisc.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%if %{with_systemd}
BuildRequires: systemd-units
@ -96,7 +107,7 @@ inkludera nätfilsystem, CD-ROM, floppydiskar, och så vidare.
%setup -q
echo %{version}-%{release} > .version
%if %{with_systemd}
%define _unitdir %{?_unitdir:/lib/systemd/system}
%define unitdir %{?_unitdir:/lib/systemd/system}
%define systemd_configure_arg --with-systemd
%endif
%patch1 -p1
@ -129,16 +140,27 @@ echo %{version}-%{release} > .version
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1
%patch41 -p1
%build
#CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
%configure --disable-mount-locking --enable-ignore-busy --with-libtirpc --disable-mount-move %{?systemd_configure_arg:}
%configure --disable-mount-locking --enable-ignore-busy --with-libtirpc %{?systemd_configure_arg:}
make initdir=%{_initrddir} DONTSTRIP=1
%install
rm -rf $RPM_BUILD_ROOT
%if %{with_systemd}
install -d -m 755 $RPM_BUILD_ROOT%{_unitdir}
install -d -m 755 $RPM_BUILD_ROOT%{unitdir}
%else
mkdir -p -m755 $RPM_BUILD_ROOT%{_initrddir}
%endif
@ -148,14 +170,18 @@ 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=%{_initrddir} systemddir=%{_unitdir} INSTALLROOT=$RPM_BUILD_ROOT
make install mandir=%{_mandir} initdir=%{_initrddir} systemddir=%{unitdir} INSTALLROOT=$RPM_BUILD_ROOT
echo make -C redhat
make -C redhat
install -m 755 -d $RPM_BUILD_ROOT/misc
%if %{with_systemd}
install -m 644 redhat/autofs.service $RPM_BUILD_ROOT%{_unitdir}/autofs.service
# Configure can get this wrong when the unit files appear under /lib and /usr/lib
find $RPM_BUILD_ROOT -type f -name autofs.service -exec rm -f {} \;
install -m 644 redhat/autofs.service $RPM_BUILD_ROOT%{unitdir}/autofs.service
%define init_file_name %{unitdir}/autofs.service
%else
install -m 755 redhat/autofs.init $RPM_BUILD_ROOT%{_initrddir}/autofs
%define init_file_name /etc/rc.d/init.d/autofs
%endif
install -m 644 redhat/autofs.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/autofs
@ -203,11 +229,7 @@ fi
%files
%defattr(-,root,root,-)
%doc CREDITS INSTALL COPY* README* patches/* samples/ldap* samples/autofs.schema
%if %{with_systemd}
%{_unitdir}/autofs.service
%else
%{_initrddir}/autofs
%endif
%config %{init_file_name}
%config(noreplace,missingok) /etc/auto.master
%config(noreplace,missingok) /etc/auto.misc
%config(noreplace,missingok) /etc/auto.net
@ -220,6 +242,19 @@ fi
%dir /etc/auto.master.d
%changelog
* Tue Mar 12 2013 Ian Kent <ikent@redhat.com> - 1:5.0.7-12
- dont fail on master map self include.
- fix wildcard multi map regression.
- fix file descriptor leak when reloading the daemon.
- depricate nosymlink pseudo option.
- add symlink pseudo option.
- update kernel include files.
- fix requires in spec file.
- fix libtirpc build option.
- fix systemd unidir in spec file.
- document browse option in man page.
- fix automounter support on parisc.
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1:5.0.7-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild