import autofs-5.1.4-82.el8

This commit is contained in:
CentOS Sources 2022-05-10 03:19:01 -04:00 committed by Stepan Oksanichenko
parent 06023428b4
commit 0099111f2f
18 changed files with 1177 additions and 1 deletions

View File

@ -0,0 +1,41 @@
autofs-5.1.4 - make umount_ent() recognise forced umount
From: Ian Kent <raven@themaw.net>
When doing a forced shutdown umount_ent() tries a normal expire
first resulting in a fair amount of unnecessary log noise.
Change umount_ent() to do a forced expire when a forced shutdown
has been requested to avoid the log noise.
Signed-off-by: Ian Kent <raven@themaw.net>
---
lib/mounts.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -2984,14 +2984,16 @@ int umount_ent(struct autofs_point *ap,
{
int rv;
- rv = spawn_umount(ap->logopt, path, NULL);
- /* We are doing a forced shutcwdown down so unlink busy mounts */
- if (rv && (ap->state == ST_SHUTDOWN_FORCE || ap->state == ST_SHUTDOWN)) {
- if (ap->state == ST_SHUTDOWN_FORCE) {
- info(ap->logopt, "forcing umount of %s", path);
- rv = spawn_umount(ap->logopt, "-l", path, NULL);
- }
+ if (ap->state != ST_SHUTDOWN_FORCE)
+ rv = spawn_umount(ap->logopt, path, NULL);
+ else {
+ /* We are doing a forced shutdown so unlink busy
+ * mounts */
+ info(ap->logopt, "forcing umount of %s", path);
+ rv = spawn_umount(ap->logopt, "-l", path, NULL);
+ }
+ if (rv && (ap->state == ST_SHUTDOWN_FORCE || ap->state == ST_SHUTDOWN)) {
/*
* Verify that we actually unmounted the thing. This is a
* belt and suspenders approach to not eating user data.

View File

@ -0,0 +1,36 @@
autofs-5.1.6 - fix double quoting in auto.smb
From: Ian Kent <raven@themaw.net>
The example program mount script installed to /etc/auto.smb incorrectly
adds a quote for the trailing dollar of special Windows mounts. But they
are already surrounded by double quotes. This may have been handled by
mount.cifs at some point but it's failing now.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
samples/auto.smb | 2 --
2 files changed, 1 insertion(+), 2 deletions(-)
--- autofs-5.1.4.orig/samples/auto.smb
+++ autofs-5.1.4/samples/auto.smb
@@ -75,8 +75,6 @@ $SMBCLIENT $smbopts -gL "$key" 2>/dev/nu
dir = $2
loc = $2
# Enclose mount dir and location in quotes
- # Double quote "$" in location as it is special
- gsub(/\$$/, "\\$", loc);
gsub(/\&/,"\\\\&",loc)
print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""
}
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -81,6 +81,7 @@
- fix kernel mount status notification.
- fix set open file limit.
- improve descriptor open error reporting.
+- fix double quoting in auto.smb.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.

View File

@ -0,0 +1,35 @@
autofs-5.1.6 - fix double quoting of ampersand in auto.smb as well
From: Ian Kent <raven@themaw.net>
The example program mount script installed to /etc/auto.smb incorrectly
adds a quote for the & character that causes mount failures. But the
produced map entry is already surrounded by double quotes. This may have
been handled by mount.cifs at some point but it's failing now.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
samples/auto.smb | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
--- autofs-5.1.4.orig/samples/auto.smb
+++ autofs-5.1.4/samples/auto.smb
@@ -75,7 +75,6 @@ $SMBCLIENT $smbopts -gL "$key" 2>/dev/nu
dir = $2
loc = $2
# Enclose mount dir and location in quotes
- gsub(/\&/,"\\\\&",loc)
print " \\\n\t \"/" dir "\"", "\"://" key "/" loc "\""
}
END { if (!first) print "\n"; else exit 1 }
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -82,6 +82,7 @@
- fix set open file limit.
- improve descriptor open error reporting.
- fix double quoting in auto.smb.
+- fix double quoting of ampersand in auto.smb as well.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.

View File

@ -0,0 +1,35 @@
autofs-5.1.8 - avoid calling pthread_getspecific() with NULL key_thread_attempt_id
From: Ian Kent <raven@themaw.net>
Don't call pthread_getspecific() if key_thread_attempt_id is NULL in
case the pthread_getspecific() implementation doesn't check for this.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
lib/log.c | 3 +++
2 files changed, 4 insertions(+)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -90,6 +90,7 @@
- simplify cache_add() a little.
- fix use after free in tree_mapent_delete_offset_tree().
- fix memory leak in xdr_exports().
+- avoid calling pthread_getspecific() with NULL key_thread_attempt_id.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/lib/log.c
+++ autofs-5.1.4/lib/log.c
@@ -38,6 +38,9 @@ static char *prepare_attempt_prefix(cons
char buffer[ATTEMPT_ID_SIZE + 1];
char *prefixed_msg = NULL;
+ if (!key_thread_attempt_id)
+ return NULL;
+
attempt_id = pthread_getspecific(key_thread_attempt_id);
if (attempt_id) {
int len = sizeof(buffer) + 1 + strlen(msg) + 1;

View File

@ -0,0 +1,46 @@
autofs-5.1.8 - dont fail on duplicate host export entry
From: Ian Kent <raven@themaw.net>
If we encounter a duplicate host export entry don't fail, just ignore
it and return the duplicate.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
lib/mounts.c | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -85,6 +85,7 @@
- fix double quoting of ampersand in auto.smb as well.
- fix root offset error handling.
- fix nonstrict fail handling of last offset mount.
+- dont fail on duplicate offset entry tree add.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -1341,7 +1341,7 @@ static struct tree_node *tree_add_node(s
}
if (!eq)
- error(LOGOPT_ANY, "cannot add duplicate entry to tree");
+ return p;
else {
if (eq < 0)
return tree_add_left(p, ptr);
@@ -1515,8 +1515,10 @@ static int tree_host_cmp(struct tree_nod
int eq;
eq = strcmp(exp->dir, n_exp->dir);
- if (!eq)
+ if (!eq) {
+ error(LOGOPT_ANY, "duplicate entry %s ignored", exp->dir);
return 0;
+ }
return (exp_len < n_exp_len) ? -1 : 1;
}

View File

@ -0,0 +1,110 @@
autofs-5.1.8 - fix handling of incorrect return from umount_ent()
From: Ian Kent <raven@themaw.net>
Commit 0210535df4b ("autofs-5.1.0 - gaurd against incorrect umount
return") guards against umount_ent() returning a fail when the mount
has actually been umounted.
But we also see umount_ent() return success when in fact the mount has
not been umounted leading to incorrect handling of automounts.
So checking the return of umount_ent() isn't always giving the correct
result in more than just one case, consequently we should ignore the
result from the spawned umount(8) and check if the mount has in fact
been umounted.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/automount.c | 3 +--
lib/mounts.c | 19 ++++++++++---------
3 files changed, 12 insertions(+), 11 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -93,6 +93,7 @@
- avoid calling pthread_getspecific() with NULL key_thread_attempt_id.
- fix sysconf(3) return handling.
- remove nonstrict parameter from tree_mapent_umount_offsets().
+- fix handling of incorrect return from umount_ent().
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/automount.c
+++ autofs-5.1.4/daemon/automount.c
@@ -606,8 +606,7 @@ static int umount_subtree_mounts(struct
struct mnt_list *mnt;
debug(ap->logopt, "unmounting dir = %s", path);
- if (umount_ent(ap, path) &&
- is_mounted(path, MNTS_REAL)) {
+ if (umount_ent(ap, path)) {
warn(ap->logopt, "could not umount dir %s", path);
left++;
goto done;
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -1869,8 +1869,7 @@ static int tree_mapent_umount_offset(str
*/
if (oe->ioctlfd != -1 ||
is_mounted(oe->key, MNTS_REAL)) {
- if (umount_ent(ap, oe->key) &&
- is_mounted(oe->key, MNTS_REAL)) {
+ if (umount_ent(ap, oe->key)) {
debug(ap->logopt,
"offset %s has active mount, invalidate",
oe->key);
@@ -2010,8 +2009,7 @@ int tree_mapent_umount_offsets(struct ma
*/
if (is_mounted(mp, MNTS_REAL)) {
info(ap->logopt, "unmounting dir = %s", mp);
- if (umount_ent(ap, mp) &&
- is_mounted(mp, MNTS_REAL)) {
+ if (umount_ent(ap, mp)) {
if (!tree_mapent_mount_offsets(oe, 1))
warn(ap->logopt,
"failed to remount offset triggers");
@@ -2982,6 +2980,7 @@ void set_direct_mount_tree_catatonic(str
int umount_ent(struct autofs_point *ap, const char *path)
{
+ unsigned int mounted;
int rv;
if (ap->state != ST_SHUTDOWN_FORCE)
@@ -2993,6 +2992,8 @@ int umount_ent(struct autofs_point *ap,
rv = spawn_umount(ap->logopt, "-l", path, NULL);
}
+ mounted = is_mounted(path, MNTS_REAL);
+
if (rv && (ap->state == ST_SHUTDOWN_FORCE || ap->state == ST_SHUTDOWN)) {
/*
* Verify that we actually unmounted the thing. This is a
@@ -3004,20 +3005,20 @@ int umount_ent(struct autofs_point *ap,
* so that we do not try to call rmdir_path on the
* directory.
*/
- if (is_mounted(path, MNTS_REAL)) {
+ if (mounted) {
crit(ap->logopt,
"the umount binary reported that %s was "
"unmounted, but there is still something "
"mounted on this path.", path);
- rv = -1;
+ mounted = -1;
}
}
- /* On success, check for mounted mount and remove it if found */
- if (!rv)
+ /* If mount is gone remove it from mounted mounts list. */
+ if (!mounted)
mnts_remove_mount(path, MNTS_MOUNTED);
- return rv;
+ return mounted;
}
int umount_amd_ext_mount(struct autofs_point *ap, const char *path)

View File

@ -0,0 +1,135 @@
autofs-5.1.8 - fix kernel mount status notification
From: Ian Kent <raven@themaw.net>
The status return for attempted mount notification is not done
correctly in some cases leading to a status being sent to the
kernel multiple times or the send causing an error.
We must send a status to the kernel but it needs to be the correct
one. It definitely shouldn't be sent twice for the same mount attempt
and shouldn't be failing.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/direct.c | 19 +++++++++++--------
daemon/indirect.c | 19 +++++++++++--------
3 files changed, 23 insertions(+), 16 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -78,6 +78,7 @@
- fix empty mounts list return from unlink_mount_tree().
- fix nonstrict offset mount fail handling.
- remove intr hosts map mount option.
+- fix kernel mount status notification.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/direct.c
+++ autofs-5.1.4/daemon/direct.c
@@ -1143,12 +1143,18 @@ int handle_packet_expire_direct(struct a
return 0;
}
-static void mount_send_fail(void *arg)
+static void mount_send_status(void *arg)
{
struct ioctl_ops *ops = get_ioctl_ops();
struct pending_args *mt = arg;
struct autofs_point *ap = mt->ap;
- ops->send_fail(ap->logopt, mt->ioctlfd, mt->wait_queue_token, -ENOENT);
+
+ if (mt->status)
+ ops->send_fail(ap->logopt, mt->ioctlfd,
+ mt->wait_queue_token, mt->status);
+ else
+ ops->send_ready(ap->logopt,
+ mt->ioctlfd, mt->wait_queue_token);
ops->close(ap->logopt, mt->ioctlfd);
}
@@ -1177,7 +1183,8 @@ static void *do_mount_direct(void *arg)
pending_mutex_unlock(args);
- pthread_cleanup_push(mount_send_fail, &mt);
+ mt.status = 0;
+ pthread_cleanup_push(mount_send_status, &mt);
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state);
@@ -1191,9 +1198,7 @@ static void *do_mount_direct(void *arg)
if (status == -1) {
error(ap->logopt,
"can't stat direct mount trigger %s", mt.name);
- ops->send_fail(ap->logopt,
- mt.ioctlfd, mt.wait_queue_token, -ENOENT);
- ops->close(ap->logopt, mt.ioctlfd);
+ mt.status = -ENOENT;
pthread_setcancelstate(state, NULL);
pthread_exit(NULL);
}
@@ -1203,8 +1208,6 @@ static void *do_mount_direct(void *arg)
error(ap->logopt,
"direct trigger not valid or already mounted %s",
mt.name);
- ops->send_ready(ap->logopt, mt.ioctlfd, mt.wait_queue_token);
- ops->close(ap->logopt, mt.ioctlfd);
pthread_setcancelstate(state, NULL);
pthread_exit(NULL);
}
--- autofs-5.1.4.orig/daemon/indirect.c
+++ autofs-5.1.4/daemon/indirect.c
@@ -674,13 +674,18 @@ int handle_packet_expire_indirect(struct
return 0;
}
-static void mount_send_fail(void *arg)
+static void mount_send_status(void *arg)
{
struct ioctl_ops *ops = get_ioctl_ops();
struct pending_args *mt = arg;
struct autofs_point *ap = mt->ap;
- ops->send_fail(ap->logopt,
- ap->ioctlfd, mt->wait_queue_token, -ENOENT);
+
+ if (mt->status)
+ ops->send_fail(ap->logopt, ap->ioctlfd,
+ mt->wait_queue_token, mt->status);
+ else
+ ops->send_ready(ap->logopt,
+ ap->ioctlfd, mt->wait_queue_token);
}
static void *do_mount_indirect(void *arg)
@@ -709,7 +714,8 @@ static void *do_mount_indirect(void *arg
pending_mutex_unlock(args);
- pthread_cleanup_push(mount_send_fail, &mt);
+ mt.status = 0;
+ pthread_cleanup_push(mount_send_status, &mt);
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state);
@@ -722,9 +728,7 @@ static void *do_mount_indirect(void *arg
len = ncat_path(buf, sizeof(buf), ap->path, mt.name, mt.len);
if (!len) {
crit(ap->logopt, "path to be mounted is to long");
- ops->send_fail(ap->logopt,
- ap->ioctlfd, mt.wait_queue_token,
- -ENAMETOOLONG);
+ mt.status = -ENAMETOOLONG;
pthread_setcancelstate(state, NULL);
pthread_exit(NULL);
}
@@ -733,7 +737,6 @@ static void *do_mount_indirect(void *arg
if (status != -1 && !(S_ISDIR(st.st_mode) && st.st_dev == mt.dev)) {
error(ap->logopt,
"indirect trigger not valid or already mounted %s", buf);
- ops->send_ready(ap->logopt, ap->ioctlfd, mt.wait_queue_token);
pthread_setcancelstate(state, NULL);
pthread_exit(NULL);
}

View File

@ -0,0 +1,36 @@
autofs-5.1.8 - fix loop under run in cache_get_offset_parent()
From: Frank Sorenson <sorenson@redhat.com>
To avoid reading memory outside of the the string
allocated for parent, tail needs to stop when it
reaches or passes parent, even if it doesn't
actually equal parent.
Signed-off-by: Frank Sorenson <sorenson@redhat.com>
---
CHANGELOG | 1 +
lib/cache.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -86,6 +86,7 @@
- fix root offset error handling.
- fix nonstrict fail handling of last offset mount.
- dont fail on duplicate offset entry tree add.
+- fix loop under run in cache_get_offset_parent().
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/lib/cache.c
+++ autofs-5.1.4/lib/cache.c
@@ -680,7 +680,7 @@ struct mapent *cache_get_offset_parent(s
*tail = 0;
tail--;
- if (tail == parent)
+ if (tail <= parent)
break;
me = cache_lookup_distinct(mc, parent);

View File

@ -0,0 +1,40 @@
autofs-5.1.8 - fix memory leak in xdr_exports()
From: Ian Kent <raven@themaw.net>
Converting xdr_exports() to not be recursive introduced a memory leak
if an error is encountered, fix it.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
lib/rpc_subs.c | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -89,6 +89,7 @@
- fix loop under run in cache_get_offset_parent().
- simplify cache_add() a little.
- fix use after free in tree_mapent_delete_offset_tree().
+- fix memory leak in xdr_exports().
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/lib/rpc_subs.c
+++ autofs-5.1.4/lib/rpc_subs.c
@@ -1151,8 +1151,13 @@ bool_t xdr_exports(XDR *xdrs, struct exp
export = (char **) exports;
while (1) {
- if (!xdr_pointer(xdrs, export, size, (xdrproc_t) xdr_export))
+ if (!xdr_pointer(xdrs, export, size, (xdrproc_t) xdr_export)) {
+ if (*exports) {
+ rpc_exports_free(*exports);
+ *exports = NULL;
+ }
return FALSE;
+ }
if (!*export)
break;
export = (char **) &((struct exportinfo *) *export)->next;

View File

@ -0,0 +1,38 @@
autofs-5.1.8 - fix nonstrict fail handling of last offset mount
From: Ian Kent <raven@themaw.net>
When mounting a list of multi-mount offsets the offset mount should
succeed even if there's a mount failure for the non-strict case (the
default).
But currently if the last offset mount fails the multi-mount fails
regardless of whether the mount is non-strict or not.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
lib/mounts.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -84,6 +84,7 @@
- fix double quoting in auto.smb.
- fix double quoting of ampersand in auto.smb as well.
- fix root offset error handling.
+- fix nonstrict fail handling of last offset mount.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -1940,7 +1940,7 @@ static int tree_mapent_mount_offsets_wor
tree_mapent_mount_offsets(oe, !ctxt->strict);
}
- return ret;
+ return (ctxt->strict ? ret : 1);
}
int tree_mapent_mount_offsets(struct mapent *oe, int nonstrict)

View File

@ -0,0 +1,86 @@
autofs-5.1.8 - fix root offset error handling
From: Ian Kent <raven@themaw.net>
If mounting the root or offsets of a multi-mount root fails any mounts
done so far need to be umounted and the multi-mount offset tree deleted
so it can be created cleanly and possibly mounted the next time it's
triggered.
Also, if a subtree that is not the multi-mount root fails the expire
alarm needs to be re-instated so other subtrees (at least the root)
will continue to expire.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/direct.c | 11 ++++++++++-
modules/parse_sun.c | 6 ++++++
3 files changed, 17 insertions(+), 1 deletion(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -83,6 +83,7 @@
- improve descriptor open error reporting.
- fix double quoting in auto.smb.
- fix double quoting of ampersand in auto.smb as well.
+- fix root offset error handling.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/direct.c
+++ autofs-5.1.4/daemon/direct.c
@@ -1163,6 +1163,7 @@ static void *do_mount_direct(void *arg)
struct ioctl_ops *ops = get_ioctl_ops();
struct pending_args *args, mt;
struct autofs_point *ap;
+ struct mapent *me;
struct stat st;
int status, state;
@@ -1226,7 +1227,6 @@ static void *do_mount_direct(void *arg)
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state);
if (status) {
struct mnt_list *sbmnt;
- struct mapent *me;
struct statfs fs;
unsigned int close_fd = 0;
unsigned int flags = MNTS_DIRECT|MNTS_MOUNTED;
@@ -1267,6 +1267,15 @@ static void *do_mount_direct(void *arg)
mt.ioctlfd, mt.wait_queue_token, -ENOENT);
ops->close(ap->logopt, mt.ioctlfd);
info(ap->logopt, "failed to mount %s", mt.name);
+
+ /* If this is a multi-mount subtree mount failure
+ * ensure the tree continues to expire.
+ */
+ cache_readlock(mt.mc);
+ me = cache_lookup_distinct(mt.mc, mt.name);
+ if (me && IS_MM(me) && !IS_MM_ROOT(me))
+ conditional_alarm_add(ap, ap->exp_runfreq);
+ cache_unlock(mt.mc);
}
pthread_setcancelstate(state, NULL);
--- autofs-5.1.4.orig/modules/parse_sun.c
+++ autofs-5.1.4/modules/parse_sun.c
@@ -1125,6 +1125,9 @@ static int mount_subtree(struct autofs_p
if (!len) {
warn(ap->logopt, "path loo long");
cache_unlock(mc);
+ cache_writelock(mc);
+ tree_mapent_delete_offsets(mc, name);
+ cache_unlock(mc);
return 1;
}
key[len] = '/';
@@ -1169,6 +1172,9 @@ static int mount_subtree(struct autofs_p
cache_unlock(mc);
error(ap->logopt, MODPREFIX
"failed to mount offset triggers");
+ cache_writelock(mc);
+ tree_mapent_delete_offsets(mc, name);
+ cache_unlock(mc);
return 1;
}
}

View File

@ -0,0 +1,57 @@
autofs-5.1.8 - fix set open file limit
From: Ian Kent <raven@themaw.net>
The check of whether the open file limit needs to be changed is not
right, it checks the hard open file limit against what autofs wants
to set it to which is always less than this value. Consequently the
open file limit isn't changed.
autofs should be changing only the soft open file limit but it is
setting both the hard and soft limits. The system hard limit is much
higer than the autofs maximum open files so the hard limit should be
left alone.
While we are here increase the requested maximum soft open file limit
to 20k.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/automount.c | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -79,6 +79,7 @@
- fix nonstrict offset mount fail handling.
- remove intr hosts map mount option.
- fix kernel mount status notification.
+- fix set open file limit.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/automount.c
+++ autofs-5.1.4/daemon/automount.c
@@ -95,7 +95,7 @@ struct startup_cond suc = {
pthread_key_t key_thread_stdenv_vars;
pthread_key_t key_thread_attempt_id = (pthread_key_t) 0L;
-#define MAX_OPEN_FILES 10240
+#define MAX_OPEN_FILES 20480
int aquire_flag_file(void);
void release_flag_file(void);
@@ -2475,9 +2475,10 @@ int main(int argc, char *argv[])
}
res = getrlimit(RLIMIT_NOFILE, &rlim);
- if (res == -1 || rlim.rlim_max <= MAX_OPEN_FILES) {
+ if (res == -1 || rlim.rlim_cur <= MAX_OPEN_FILES) {
rlim.rlim_cur = MAX_OPEN_FILES;
- rlim.rlim_max = MAX_OPEN_FILES;
+ if (rlim.rlim_max < MAX_OPEN_FILES)
+ rlim.rlim_max = MAX_OPEN_FILES;
}
res = setrlimit(RLIMIT_NOFILE, &rlim);
if (res)

View File

@ -0,0 +1,64 @@
autofs-5.1.8 - fix sysconf(3) return handling
From: Fabian Groffen <grobian@gentoo.org>
The sysconf(3) return handling doesn't handle a -1 return with errno
not changed which indicated a maximum or minimum limit that's not
known.
Add handling of this case.
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
lib/mounts.c | 13 +++++++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -91,6 +91,7 @@
- fix use after free in tree_mapent_delete_offset_tree().
- fix memory leak in xdr_exports().
- avoid calling pthread_getspecific() with NULL key_thread_attempt_id.
+- fix sysconf(3) return handling.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -2385,11 +2385,17 @@ void set_tsd_user_vars(unsigned int logo
/* Try to get passwd info */
+ /* sysconf may return -1 with unchanged errno to indicate unlimited
+ * size, same for the call for _SC_GETGR_R_SIZE_MAX below
+ */
+ errno = 0;
tmplen = sysconf(_SC_GETPW_R_SIZE_MAX);
- if (tmplen < 0) {
+ if (tmplen < 0 && errno != 0) {
error(logopt, "failed to get buffer size for getpwuid_r");
goto free_tsv;
}
+ if (tmplen < 0)
+ tmplen = 1024; /* assume something reasonable */
pw_tmp = malloc(tmplen + 1);
if (!pw_tmp) {
@@ -2422,11 +2428,14 @@ void set_tsd_user_vars(unsigned int logo
/* Try to get group info */
+ errno = 0;
grplen = sysconf(_SC_GETGR_R_SIZE_MAX);
- if (grplen < 0) {
+ if (grplen < 0 && errno != 0) {
error(logopt, "failed to get buffer size for getgrgid_r");
goto free_tsv_home;
}
+ if (grplen < 0)
+ grplen = 1024;
gr_tmp = NULL;
status = ERANGE;

View File

@ -0,0 +1,55 @@
autofs-5.1.8 - fix use after free in tree_mapent_delete_offset_tree()
From: Ian Kent <raven@themaw.net>
The key field of the map entry of the root of the map entry tree to be
deleted can't be used for the key parameter, fix it.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
lib/mounts.c | 16 +++++++++++++---
2 files changed, 14 insertions(+), 3 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -88,6 +88,7 @@
- dont fail on duplicate offset entry tree add.
- fix loop under run in cache_get_offset_parent().
- simplify cache_add() a little.
+- fix use after free in tree_mapent_delete_offset_tree().
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -1666,16 +1666,26 @@ static int tree_mapent_delete_offset_tre
*/
if (MAPENT_ROOT(me) != MAPENT_NODE(me)) {
struct tree_node *root = MAPENT_ROOT(me);
+ char *key;
- debug(logopt, "deleting offset key %s", me->key);
+ key = strdup(me->key);
+ if (!key) {
+ char buf[MAX_ERR_BUF];
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
+ error(logopt, "strdup: %s", estr);
+ return 0;
+ }
+
+ debug(logopt, "deleting offset key %s", key);
/* cache_delete won't delete an active offset */
MAPENT_SET_ROOT(me, NULL);
- ret = cache_delete(me->mc, me->key);
+ ret = cache_delete(me->mc, key);
if (ret != CHE_OK) {
MAPENT_SET_ROOT(me, root);
- warn(logopt, "failed to delete offset %s", me->key);
+ warn(logopt, "failed to delete offset %s", key);
}
+ free(key);
} else {
MAPENT_SET_ROOT(me, NULL);
MAPENT_SET_PARENT(me, NULL);

View File

@ -0,0 +1,165 @@
autofs-5.1.8 - improve descriptor open error reporting
From: Ian Kent <raven@themaw.net>
Add error message reporting to the descriptor open functions.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/automount.c | 3 ---
daemon/spawn.c | 29 +++++++++++++++++++++++++++++
lib/mounts.c | 10 ++--------
modules/lookup_program.c | 5 +----
5 files changed, 33 insertions(+), 15 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -80,6 +80,7 @@
- remove intr hosts map mount option.
- fix kernel mount status notification.
- fix set open file limit.
+- improve descriptor open error reporting.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/automount.c
+++ autofs-5.1.4/daemon/automount.c
@@ -864,9 +864,6 @@ static int create_logpri_fifo(struct aut
fd = open_fd(fifo_name, O_RDWR|O_NONBLOCK);
if (fd < 0) {
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
- crit(ap->logopt,
- "Failed to open %s: %s", fifo_name, estr);
unlink(fifo_name);
ret = -1;
goto out_free;
--- autofs-5.1.4.orig/daemon/spawn.c
+++ autofs-5.1.4/daemon/spawn.c
@@ -94,7 +94,12 @@ int open_fd(const char *path, int flags)
#endif
fd = open(path, flags);
if (fd == -1) {
+ char buf[MAX_ERR_BUF];
+ char *estr;
+
open_mutex_unlock();
+ estr = strerror_r(errno, buf, sizeof(buf));
+ logerr("failed to open file: %s", estr);
return -1;
}
check_cloexec(fd);
@@ -113,7 +118,12 @@ int open_fd_mode(const char *path, int f
#endif
fd = open(path, flags, mode);
if (fd == -1) {
+ char buf[MAX_ERR_BUF];
+ char *estr;
+
open_mutex_unlock();
+ estr = strerror_r(errno, buf, sizeof(buf));
+ logerr("failed to open file: %s", estr);
return -1;
}
check_cloexec(fd);
@@ -123,6 +133,8 @@ int open_fd_mode(const char *path, int f
int open_pipe(int pipefd[2])
{
+ char buf[MAX_ERR_BUF];
+ char *estr;
int ret;
open_mutex_lock();
@@ -145,6 +157,8 @@ done:
return 0;
err:
open_mutex_unlock();
+ estr = strerror_r(errno, buf, sizeof(buf));
+ logerr("failed to open pipe: %s", estr);
return -1;
}
@@ -159,7 +173,12 @@ int open_sock(int domain, int type, int
#endif
fd = socket(domain, type, protocol);
if (fd == -1) {
+ char buf[MAX_ERR_BUF];
+ char *estr;
+
open_mutex_unlock();
+ estr = strerror_r(errno, buf, sizeof(buf));
+ logerr("failed to open socket: %s", estr);
return -1;
}
check_cloexec(fd);
@@ -184,7 +203,12 @@ FILE *open_fopen_r(const char *path)
#endif
f = fopen(path, "r");
if (f == NULL) {
+ char buf[MAX_ERR_BUF];
+ char *estr;
+
open_mutex_unlock();
+ estr = strerror_r(errno, buf, sizeof(buf));
+ logerr("failed to open file: %s", estr);
return NULL;
}
check_cloexec(fileno(f));
@@ -209,7 +233,12 @@ FILE *open_setmntent_r(const char *table
#endif
tab = fopen(table, "r");
if (tab == NULL) {
+ char buf[MAX_ERR_BUF];
+ char *estr;
+
open_mutex_unlock();
+ estr = strerror_r(errno, buf, sizeof(buf));
+ logerr("failed to open mount table: %s", estr);
return NULL;
}
check_cloexec(fileno(tab));
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -2169,11 +2169,8 @@ struct mnt_list *get_mnt_list(const char
return NULL;
tab = open_fopen_r(_PROC_MOUNTS);
- if (!tab) {
- char *estr = strerror_r(errno, buf, PATH_MAX - 1);
- logerr("fopen: %s", estr);
+ if (!tab)
return NULL;
- }
while ((mnt = local_getmntent_r(tab, &mnt_wrk, buf, PATH_MAX * 3))) {
len = strlen(mnt->mnt_dir);
@@ -2280,11 +2277,8 @@ static int table_is_mounted(const char *
return 0;
tab = open_fopen_r(_PROC_MOUNTS);
- if (!tab) {
- char *estr = strerror_r(errno, buf, PATH_MAX - 1);
- logerr("fopen: %s", estr);
+ if (!tab)
return 0;
- }
while ((mnt = local_getmntent_r(tab, &mnt_wrk, buf, PATH_MAX * 3))) {
size_t len = strlen(mnt->mnt_dir);
--- autofs-5.1.4.orig/modules/lookup_program.c
+++ autofs-5.1.4/modules/lookup_program.c
@@ -214,11 +214,8 @@ static char *lookup_one(struct autofs_po
* want to send stderr to the syslog, and we don't use spawnl()
* because we need the pipe hooks
*/
- if (open_pipe(pipefd)) {
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
- logerr(MODPREFIX "pipe: %s", estr);
+ if (open_pipe(pipefd))
goto out_error;
- }
if (open_pipe(epipefd)) {
close(pipefd[0]);
close(pipefd[1]);

View File

@ -0,0 +1,77 @@
autofs-5.1.8 - remove nonstrict parameter from tree_mapent_umount_offsets()
From: Ian Kent <raven@themaw.net>
The nonstrict parameter of tree_mapent_umount_offsets() ins't useful
because if a real mount at the base of a sub-tree fails to umount all
we can do is re-instate the offset mounts under it which must succeed
for the mount tree to remain useful.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/automount.c | 2 +-
include/mounts.h | 2 +-
lib/mounts.c | 6 +++---
4 files changed, 6 insertions(+), 5 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -92,6 +92,7 @@
- fix memory leak in xdr_exports().
- avoid calling pthread_getspecific() with NULL key_thread_attempt_id.
- fix sysconf(3) return handling.
+- remove nonstrict parameter from tree_mapent_umount_offsets().
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/automount.c
+++ autofs-5.1.4/daemon/automount.c
@@ -555,7 +555,7 @@ static int umount_subtree_mounts(struct
struct mapent *tmp;
int ret;
- ret = tree_mapent_umount_offsets(me, 1);
+ ret = tree_mapent_umount_offsets(me);
if (!ret) {
warn(ap->logopt,
"some offset mounts still present under %s", path);
--- autofs-5.1.4.orig/include/mounts.h
+++ autofs-5.1.4/include/mounts.h
@@ -182,7 +182,7 @@ int tree_mapent_add_node(struct mapent_c
int tree_mapent_delete_offsets(struct mapent_cache *mc, const char *key);
void tree_mapent_cleanup_offsets(struct mapent *oe);
int tree_mapent_mount_offsets(struct mapent *oe, int nonstrict);
-int tree_mapent_umount_offsets(struct mapent *oe, int nonstrict);
+int tree_mapent_umount_offsets(struct mapent *oe);
int unlink_mount_tree(struct autofs_point *ap, const char *mp);
void free_mnt_list(struct mnt_list *list);
int is_mounted(const char *mp, unsigned int type);
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -1843,7 +1843,7 @@ static int tree_mapent_umount_offset(str
* Check for and umount subtree offsets resulting from
* nonstrict mount fail.
*/
- ret = tree_mapent_umount_offsets(oe, ctxt->strict);
+ ret = tree_mapent_umount_offsets(oe);
if (!ret)
return 0;
@@ -1975,14 +1975,14 @@ static int tree_mapent_umount_offsets_wo
return tree_mapent_umount_offset(oe, ptr);
}
-int tree_mapent_umount_offsets(struct mapent *oe, int nonstrict)
+int tree_mapent_umount_offsets(struct mapent *oe)
{
struct tree_node *base = MAPENT_NODE(oe);
struct autofs_point *ap = oe->mc->ap;
struct traverse_subtree_context ctxt = {
.ap = ap,
.base = base,
- .strict = !nonstrict,
+ .strict = 1,
};
int ret;

View File

@ -0,0 +1,44 @@
autofs-5.1.8 - simplify cache_add() a little
From: Ian Kent <raven@themaw.net>
If a map entry is being added to an existing hash chain there's an
unneccessarily complicted setting of ->next of the last entry.
Just initialize the map entry ->next field instead and remove the
confusing assignment.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
lib/cache.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -87,6 +87,7 @@
- fix nonstrict fail handling of last offset mount.
- dont fail on duplicate offset entry tree add.
- fix loop under run in cache_get_offset_parent().
+- simplify cache_add() a little.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/lib/cache.c
+++ autofs-5.1.4/lib/cache.c
@@ -564,6 +564,7 @@ int cache_add(struct mapent_cache *mc, s
me->dev = (dev_t) -1;
me->ino = (ino_t) -1;
me->flags = 0;
+ me->next = NULL;
/*
* We need to add to the end if values exist in order to
@@ -583,7 +584,6 @@ int cache_add(struct mapent_cache *mc, s
existing = next;
}
- me->next = existing->next;
existing->next = me;
}
return CHE_OK;

View File

@ -8,7 +8,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.1.4
Release: 74%{?dist}
Release: 82%{?dist}
Epoch: 1
License: GPLv2+
Group: System Environment/Daemons
@ -247,6 +247,25 @@ Patch221: autofs-5.1.6-fix-empty-mounts-list-return-from-unlink_mount_tree.patch
Patch222: autofs-5.1.7-fix-nonstrict-offset-mount-fail-handling.patch
Patch223: autofs-5.1.6-remove-intr-hosts-map-mount-option.patch
Patch224: autofs-5.1.8-fix-kernel-mount-status-notification.patch
Patch225: autofs-5.1.8-fix-set-open-file-limit.patch
Patch226: autofs-5.1.8-improve-descriptor-open-error-reporting.patch
Patch227: autofs-5.1.6-fix-double-quoting-in-auto.smb.patch
Patch228: autofs-5.1.6-fix-double-quoting-of-ampersand-in-auto.smb-as-well.patch
Patch229: autofs-5.1.8-fix-root-offset-error-handling.patch
Patch230: autofs-5.1.8-fix-nonstrict-fail-handling-of-last-offset-mount.patch
Patch231: autofs-5.1.8-dont-fail-on-duplicate-host-export-entry.patch
Patch232: autofs-5.1.8-fix-loop-under-run-in-cache_get_offset_parent.patch
Patch233: autofs-5.1.8-simplify-cache_add-a-little.patch
Patch234: autofs-5.1.8-fix-use-after-free-in-tree_mapent_delete_offset_tree.patch
Patch235: autofs-5.1.8-fix-memory-leak-in-xdr_exports.patch
Patch236: autofs-5.1.8-avoid-calling-pthread_getspecific-with-NULL-key_thread_attempt_id.patch
Patch237: autofs-5.1.8-fix-sysconf-return-handling.patch
Patch238: autofs-5.1.4-make-umount_ent-recognise-forced-umount.patch
Patch239: autofs-5.1.8-remove-nonstrict-parameter-from-tree_mapent_umount_offsets.patch
Patch240: autofs-5.1.8-fix-handling-of-incorrect-return-from-umount_ent.patch
%if %{with_systemd}
BuildRequires: systemd-units
BuildRequires: systemd-devel
@ -535,6 +554,25 @@ echo %{version}-%{release} > .version
%patch222 -p1
%patch223 -p1
%patch224 -p1
%patch225 -p1
%patch226 -p1
%patch227 -p1
%patch228 -p1
%patch229 -p1
%patch230 -p1
%patch231 -p1
%patch232 -p1
%patch233 -p1
%patch234 -p1
%patch235 -p1
%patch236 -p1
%patch237 -p1
%patch238 -p1
%patch239 -p1
%patch240 -p1
%build
LDFLAGS=-Wl,-z,now
%configure --disable-mount-locking --enable-ignore-busy --with-libtirpc --without-hesiod %{?systemd_configure_arg:}
@ -629,6 +667,44 @@ fi
%dir /etc/auto.master.d
%changelog
* Tue Feb 15 2022 Ian Kent <ikent@redhat.com> - 5.1.4-82
- bz2052122 - autofs attempts unmount on directory in use
- make umount_ent() recognise forced umount.
- remove nonstrict parameter from tree_mapent_umount_offsets().
- fix handling of incorrect return from umount_ent().
- Resolves: rhbz#2052122
* Mon Feb 14 2022 Ian Kent <ikent@redhat.com> - 5.1.4-81
- bz2033552 - Using -hosts option does not work after upgrading from 8.4 to 8.5
- fix root offset error handling.
- fix nonstrict fail handling of last offset mount.
- dont fail on duplicate offset entry tree add.
- fix loop under run in cache_get_offset_parent().
- simplify cache_add() a little.
- fix use after free in tree_mapent_delete_offset_tree().
- fix memory leak in xdr_exports().
- avoid calling pthread_getspecific() with NULL key_thread_attempt_id.
- fix sysconf(3) return handling.
- Resolves: rhbz#2033552
* Fri Dec 03 2021 Ian Kent <ikent@redhat.com> - 5.1.4-77
- bz2025509 - Autofs auto.smb awk script fails on shares with dollar signs
- fix double quoting in auto.smb.
- fix double quoting of ampersand in auto.smb as well.
- Resolves: rhbz#2025509
* Thu Dec 02 2021 Ian Kent <ikent@redhat.com> - 5.1.4-76
- bz2025963 - autofs service has not proper limits set to be able to handle many mounts
- fix set open file limit.
- improve descriptor open error reporting.
- Resolves: rhbz#2025963
* Wed Dec 01 2021 Ian Kent <ikent@redhat.com> - 5.1.4-75
- bz2023740 - autofs: send FAIL cmd/ioctl mess when encountering problems
with mount trigger
- fix kernel mount status notification.
- Resolves: rhbz#2023740
* Tue Jun 22 2021 Ian Kent <ikent@redhat.com> - 5.1.4-74
- bz1974309 - Removal of default intr mount option while using -hosts
and host.net