import autofs-5.1.7-27.el9

This commit is contained in:
CentOS Sources 2022-02-01 13:15:44 -05:00 committed by Stepan Oksanichenko
parent 0d112ed46f
commit 9341ee799d
5 changed files with 426 additions and 1 deletions

View File

@ -0,0 +1,39 @@
autofs-5.1.8 - fix fedfs build flags
From: Ian Kent <raven@themaw.net>
Dynamic executables should be compiled with -fPIE and linked with -pie.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
fedfs/Makefile | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
--- autofs-5.1.7.orig/CHANGELOG
+++ autofs-5.1.7/CHANGELOG
@@ -81,6 +81,7 @@
- eliminate some more alloca usage.
- use default stack size for threads.
- fix kernel mount status notification.
+- fix fedfs build flags.
25/01/2021 autofs-5.1.7
- make bind mounts propagation slave by default.
--- autofs-5.1.7.orig/fedfs/Makefile
+++ autofs-5.1.7/fedfs/Makefile
@@ -23,12 +23,12 @@ LDFLAGS += -rdynamic
all: mount.fedfs fedfs-map-nfs4
mount.fedfs: $(mount_fedfs_OBJ) $(fedfs-getsrvinfo_OBJ) $(HDRS)
- $(CC) -o mount.fedfs \
+ $(CC) $(DAEMON_LDFLAGS) -o mount.fedfs \
$(mount_fedfs_OBJ) $(fedfs-getsrvinfo_OBJ) \
$(LDFLAGS) $(LIBRESOLV) $(LIBS)
fedfs-map-nfs4: $(fedfs-map-nfs4_OBJ) $(fedfs-getsrvinfo_OBJ) $(HDRS)
- $(CC) -o fedfs-map-nfs4 \
+ $(CC) $(DAEMON_LDFLAGS) -o fedfs-map-nfs4 \
$(fedfs-map-nfs4_OBJ) $(fedfs-getsrvinfo_OBJ) \
$(LDFLAGS) $(LIBRESOLV) $(LIBS)

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.7.orig/CHANGELOG
+++ autofs-5.1.7/CHANGELOG
@@ -80,6 +80,7 @@
- fix concat_options() error handling.
- eliminate some more alloca usage.
- use default stack size for threads.
+- fix kernel mount status notification.
25/01/2021 autofs-5.1.7
- make bind mounts propagation slave by default.
--- autofs-5.1.7.orig/daemon/direct.c
+++ autofs-5.1.7/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.7.orig/daemon/indirect.c
+++ autofs-5.1.7/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,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.7.orig/CHANGELOG
+++ autofs-5.1.7/CHANGELOG
@@ -82,6 +82,7 @@
- use default stack size for threads.
- fix kernel mount status notification.
- fix fedfs build flags.
+- fix set open file limit.
25/01/2021 autofs-5.1.7
- make bind mounts propagation slave by default.
--- autofs-5.1.7.orig/daemon/automount.c
+++ autofs-5.1.7/daemon/automount.c
@@ -94,7 +94,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);
@@ -2483,9 +2483,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,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.7.orig/CHANGELOG
+++ autofs-5.1.7/CHANGELOG
@@ -83,6 +83,7 @@
- fix kernel mount status notification.
- fix fedfs build flags.
- fix set open file limit.
+- improve descriptor open error reporting.
25/01/2021 autofs-5.1.7
- make bind mounts propagation slave by default.
--- autofs-5.1.7.orig/daemon/automount.c
+++ autofs-5.1.7/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.7.orig/daemon/spawn.c
+++ autofs-5.1.7/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.7.orig/lib/mounts.c
+++ autofs-5.1.7/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.7.orig/modules/lookup_program.c
+++ autofs-5.1.7/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

@ -12,7 +12,7 @@
Summary: A tool for automatically mounting and unmounting filesystems Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs Name: autofs
Version: 5.1.7 Version: 5.1.7
Release: 24%{?dist} Release: 27%{?dist}
Epoch: 1 Epoch: 1
License: GPLv2+ License: GPLv2+
Source: https://www.kernel.org/pub/linux/daemons/autofs/v5/autofs-%{version}-2.tar.gz Source: https://www.kernel.org/pub/linux/daemons/autofs/v5/autofs-%{version}-2.tar.gz
@ -102,6 +102,11 @@ Patch79: autofs-5.1.7-fix-concat_options-error-handling.patch
Patch80: autofs-5.1.7-eliminate-some-more-alloca-usage.patch Patch80: autofs-5.1.7-eliminate-some-more-alloca-usage.patch
Patch81: autofs-5.1.7-use-default-stack-size-for-threads.patch Patch81: autofs-5.1.7-use-default-stack-size-for-threads.patch
Patch82: autofs-5.1.8-fix-kernel-mount-status-notification.patch
Patch83: autofs-5.1.8-fix-fedfs-build-flags.patch
Patch84: autofs-5.1.8-fix-set-open-file-limit.patch
Patch85: autofs-5.1.8-improve-descriptor-open-error-reporting.patch
%if %{with_systemd} %if %{with_systemd}
BuildRequires: systemd-units BuildRequires: systemd-units
BuildRequires: systemd-devel BuildRequires: systemd-devel
@ -249,6 +254,11 @@ echo %{version}-%{release} > .version
%patch80 -p1 %patch80 -p1
%patch81 -p1 %patch81 -p1
%patch82 -p1
%patch83 -p1
%patch84 -p1
%patch85 -p1
%build %build
LDFLAGS=-Wl,-z,now LDFLAGS=-Wl,-z,now
%configure \ %configure \
@ -356,6 +366,25 @@ fi
%dir /etc/auto.master.d %dir /etc/auto.master.d
%changelog %changelog
* Sun Jan 09 2022 Ian Kent <ikent@redhat.com> - 1:5.1.7-27
- bz2028746 - 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#2028746
* Tue Dec 21 2021 Ian Kent <ikent@redhat.com> - 1:5.1.7-26
- bz2028301 - autofs: send FAIL cmd/ioctl mess when encountering problems with
mount trigger
- fix fedfs build flags.
- Related: rhbz#2028301
* Mon Dec 20 2021 Ian Kent <ikent@redhat.com> - 1:5.1.7-25
- bz2028301 - autofs: send FAIL cmd/ioctl mess when encountering problems with
mount trigger
- fix kernel mount status notification.
- Resolves: rhbz#2028301
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> * Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com>
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688 Related: rhbz#1991688