From ba86ff2f3b27a96838af0226a8a46704203453bb Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Wed, 22 Dec 2021 04:20:21 +0000 Subject: [PATCH] import autofs-5.1.4-77.el8 --- ...5.1.6-fix-double-quoting-in-auto.smb.patch | 36 ++++ ...ing-of-ampersand-in-auto.smb-as-well.patch | 35 ++++ ...fix-kernel-mount-status-notification.patch | 135 ++++++++++++++ ...autofs-5.1.8-fix-set-open-file-limit.patch | 57 ++++++ ...rove-descriptor-open-error-reporting.patch | 165 ++++++++++++++++++ SPECS/autofs.spec | 32 +++- 6 files changed, 459 insertions(+), 1 deletion(-) create mode 100644 SOURCES/autofs-5.1.6-fix-double-quoting-in-auto.smb.patch create mode 100644 SOURCES/autofs-5.1.6-fix-double-quoting-of-ampersand-in-auto.smb-as-well.patch create mode 100644 SOURCES/autofs-5.1.8-fix-kernel-mount-status-notification.patch create mode 100644 SOURCES/autofs-5.1.8-fix-set-open-file-limit.patch create mode 100644 SOURCES/autofs-5.1.8-improve-descriptor-open-error-reporting.patch diff --git a/SOURCES/autofs-5.1.6-fix-double-quoting-in-auto.smb.patch b/SOURCES/autofs-5.1.6-fix-double-quoting-in-auto.smb.patch new file mode 100644 index 0000000..44e655a --- /dev/null +++ b/SOURCES/autofs-5.1.6-fix-double-quoting-in-auto.smb.patch @@ -0,0 +1,36 @@ +autofs-5.1.6 - fix double quoting in auto.smb + +From: Ian Kent + +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 +--- + 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. diff --git a/SOURCES/autofs-5.1.6-fix-double-quoting-of-ampersand-in-auto.smb-as-well.patch b/SOURCES/autofs-5.1.6-fix-double-quoting-of-ampersand-in-auto.smb-as-well.patch new file mode 100644 index 0000000..f76ccbe --- /dev/null +++ b/SOURCES/autofs-5.1.6-fix-double-quoting-of-ampersand-in-auto.smb-as-well.patch @@ -0,0 +1,35 @@ +autofs-5.1.6 - fix double quoting of ampersand in auto.smb as well + +From: Ian Kent + +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 +--- + 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. diff --git a/SOURCES/autofs-5.1.8-fix-kernel-mount-status-notification.patch b/SOURCES/autofs-5.1.8-fix-kernel-mount-status-notification.patch new file mode 100644 index 0000000..544b5b2 --- /dev/null +++ b/SOURCES/autofs-5.1.8-fix-kernel-mount-status-notification.patch @@ -0,0 +1,135 @@ +autofs-5.1.8 - fix kernel mount status notification + +From: Ian Kent + +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 +--- + 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); + } diff --git a/SOURCES/autofs-5.1.8-fix-set-open-file-limit.patch b/SOURCES/autofs-5.1.8-fix-set-open-file-limit.patch new file mode 100644 index 0000000..c5084b3 --- /dev/null +++ b/SOURCES/autofs-5.1.8-fix-set-open-file-limit.patch @@ -0,0 +1,57 @@ +autofs-5.1.8 - fix set open file limit + +From: Ian Kent + +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 +--- + 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) diff --git a/SOURCES/autofs-5.1.8-improve-descriptor-open-error-reporting.patch b/SOURCES/autofs-5.1.8-improve-descriptor-open-error-reporting.patch new file mode 100644 index 0000000..7ebf7b7 --- /dev/null +++ b/SOURCES/autofs-5.1.8-improve-descriptor-open-error-reporting.patch @@ -0,0 +1,165 @@ +autofs-5.1.8 - improve descriptor open error reporting + +From: Ian Kent + +Add error message reporting to the descriptor open functions. + +Signed-off-by: Ian Kent +--- + 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]); diff --git a/SPECS/autofs.spec b/SPECS/autofs.spec index a69b0c3..47b99f9 100644 --- a/SPECS/autofs.spec +++ b/SPECS/autofs.spec @@ -8,7 +8,7 @@ Summary: A tool for automatically mounting and unmounting filesystems Name: autofs Version: 5.1.4 -Release: 74%{?dist} +Release: 77%{?dist} Epoch: 1 License: GPLv2+ Group: System Environment/Daemons @@ -247,6 +247,12 @@ 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 + %if %{with_systemd} BuildRequires: systemd-units BuildRequires: systemd-devel @@ -535,6 +541,12 @@ echo %{version}-%{release} > .version %patch222 -p1 %patch223 -p1 +%patch224 -p1 +%patch225 -p1 +%patch226 -p1 +%patch227 -p1 +%patch228 -p1 + %build LDFLAGS=-Wl,-z,now %configure --disable-mount-locking --enable-ignore-busy --with-libtirpc --without-hesiod %{?systemd_configure_arg:} @@ -629,6 +641,24 @@ fi %dir /etc/auto.master.d %changelog +* Fri Dec 03 2021 Ian Kent - 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 - 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 - 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 - 5.1.4-74 - bz1974309 - Removal of default intr mount option while using -hosts and host.net