- Update to autofs 5.1.9 release.
This commit is contained in:
parent
ec00597554
commit
275e982b52
1
.gitignore
vendored
1
.gitignore
vendored
@ -13,3 +13,4 @@ autofs-5.0.5.tar.bz2
|
||||
/autofs-5.1.6.tar.gz
|
||||
/autofs-5.1.7.tar.gz
|
||||
/autofs-5.1.8.tar.gz
|
||||
/autofs-5.1.9.tar.gz
|
||||
|
@ -1,310 +0,0 @@
|
||||
autofs-5.1.8 - add command pipe handling functions
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
In order to use a single file handle for a command pipe the pipe needs
|
||||
to be independent of the kernel message packet handling function.
|
||||
|
||||
Add most of the functions needed for this as preperation.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1
|
||||
daemon/automount.c | 269 +++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 270 insertions(+)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -44,6 +44,7 @@
|
||||
- eliminate last remaining state_pipe usage.
|
||||
- add function master_find_mapent_by_devid().
|
||||
- use device id to locate autofs_point when setting log priotity.
|
||||
+- add command pipe handling functions.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/automount.c
|
||||
+++ autofs-5.1.8/daemon/automount.c
|
||||
@@ -60,6 +60,14 @@ unsigned int nfs_mount_uses_string_optio
|
||||
static struct nfs_mount_vers vers, check = {1, 1, 1};
|
||||
|
||||
#define FIFO_BUF_SIZE 25
|
||||
+static int cmd_pipe_fifo = -1;
|
||||
+
|
||||
+/* autofs cmd fifo name */
|
||||
+#define FIFO_NAME "autofs.cmd.fifo"
|
||||
+const char *cmd_pipe_name = AUTOFS_FIFO_DIR "/" FIFO_NAME;
|
||||
+
|
||||
+int start_cmd_pipe_handler(void);
|
||||
+void finish_cmd_pipe_handler(void);
|
||||
|
||||
/* autofs fifo name prefix */
|
||||
#define FIFO_NAME_PREFIX "autofs.fifo"
|
||||
@@ -1662,6 +1670,267 @@ static void *signal_handler(void *arg)
|
||||
}
|
||||
}
|
||||
|
||||
+static pthread_mutex_t cmd_pipe_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
+static unsigned int done = 0;
|
||||
+static pthread_t cmd_pipe_thid;
|
||||
+
|
||||
+void cmd_pipe_mutex_lock(void)
|
||||
+{
|
||||
+ int status = pthread_mutex_lock(&cmd_pipe_mutex);
|
||||
+ if (status)
|
||||
+ fatal(status);
|
||||
+}
|
||||
+
|
||||
+void cmd_pipe_mutex_unlock(void)
|
||||
+{
|
||||
+ int status = pthread_mutex_unlock(&cmd_pipe_mutex);
|
||||
+ if (status)
|
||||
+ fatal(status);
|
||||
+}
|
||||
+
|
||||
+static int create_cmd_pipe_fifo(void)
|
||||
+{
|
||||
+ char buf[MAX_ERR_BUF];
|
||||
+ int ret = -1;
|
||||
+ int fd;
|
||||
+
|
||||
+ if (cmd_pipe_fifo != -1)
|
||||
+ return 0;
|
||||
+
|
||||
+ ret = unlink(cmd_pipe_name);
|
||||
+ if (ret != 0 && errno != ENOENT) {
|
||||
+ fprintf(stderr,
|
||||
+ "%s: failed to unlink command pipe. Is the "
|
||||
+ "automount daemon already running?", program);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = mkfifo(cmd_pipe_name, S_IRUSR|S_IWUSR);
|
||||
+ if (ret != 0 && errno != EEXIST) {
|
||||
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
+ fprintf(stderr, "%s: mkfifo for %s failed: %s",
|
||||
+ program, cmd_pipe_name, estr);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ fd = open_fd(cmd_pipe_name, O_RDWR|O_NONBLOCK);
|
||||
+ if (fd < 0) {
|
||||
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
+ unlink(cmd_pipe_name);
|
||||
+ fprintf(stderr, "%s: failed to open cwcommand pipe %s: %s",
|
||||
+ program, cmd_pipe_name, estr);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ cmd_pipe_fifo = fd;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int destroy_cmd_pipe_fifo(void)
|
||||
+{
|
||||
+ char buf[MAX_ERR_BUF];
|
||||
+ int ret = -1;
|
||||
+
|
||||
+ if (cmd_pipe_fifo == -1)
|
||||
+ return 0;
|
||||
+
|
||||
+ ret = close(cmd_pipe_fifo);
|
||||
+ if (ret != 0) {
|
||||
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
+ warn(LOGOPT_ANY,
|
||||
+ "close for command pipe %s: %s", cmd_pipe_name, estr);
|
||||
+ }
|
||||
+
|
||||
+ cmd_pipe_fifo = -1;
|
||||
+
|
||||
+ ret = unlink(cmd_pipe_name);
|
||||
+ if (ret != 0) {
|
||||
+ warn(LOGOPT_ANY,
|
||||
+ "failed to unlink FIFO. Was the fifo created OK?");
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void handle_cmd_pipe_fifo_message(int fd)
|
||||
+{
|
||||
+ struct autofs_point *ap;
|
||||
+ char buffer[PIPE_BUF];
|
||||
+ char *end, *sep;
|
||||
+ char buf[MAX_ERR_BUF];
|
||||
+ dev_t devid;
|
||||
+ int ret;
|
||||
+ long pri;
|
||||
+
|
||||
+ memset(buffer, 0, sizeof(buffer));
|
||||
+ ret = read(fd, &buffer, sizeof(buffer));
|
||||
+ if (ret < 0) {
|
||||
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
+ warn(LOGOPT_ANY,
|
||||
+ "read on command pipe returned error: %s", estr);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ sep = strrchr(buffer, ' ');
|
||||
+ if (!sep) {
|
||||
+ error(LOGOPT_ANY,
|
||||
+ "incorrect command pipe message format %s.", buffer);
|
||||
+ return;
|
||||
+ }
|
||||
+ sep++;
|
||||
+
|
||||
+ errno = 0;
|
||||
+ devid = strtol(buffer, &end, 10);
|
||||
+ if ((devid == LONG_MIN || devid == LONG_MAX) && errno == ERANGE) {
|
||||
+ debug(LOGOPT_ANY, "strtol reported a range error.");
|
||||
+ error(LOGOPT_ANY, "invalid command pipe message format %s.", buffer);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if ((devid == 0 && errno == EINVAL) || end == buffer) {
|
||||
+ debug(LOGOPT_ANY, "devid id is expected to be a integer.");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ ap = master_find_mapent_by_devid(master_list, devid);
|
||||
+ if (!ap) {
|
||||
+ error(LOGOPT_ANY, "can't locate autofs_point for device id %ld.", devid);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ errno = 0;
|
||||
+ pri = strtol(sep, &end, 10);
|
||||
+ if ((pri == LONG_MIN || pri == LONG_MAX) && errno == ERANGE) {
|
||||
+ error(ap->logopt, "failed to set log priority.");
|
||||
+ error(ap->logopt, "strtol reported an %s.",
|
||||
+ pri == LONG_MIN ? "underflow" : "overflow");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if ((pri == 0 && errno == EINVAL) || end == sep) {
|
||||
+ debug(ap->logopt, "priority is expected to be an integer "
|
||||
+ "in the range 0-7 inclusive.");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (pri > LOG_DEBUG || pri < LOG_EMERG) {
|
||||
+ debug(ap->logopt,
|
||||
+ "invalid log priority (%ld) received on fifo", pri);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * OK, the message passed all of the sanity checks. The
|
||||
+ * automounter actually only supports three log priorities.
|
||||
+ * Everything is logged at log level debug, deamon messages
|
||||
+ * and everything except debug messages are logged with the
|
||||
+ * verbose setting and only error and critical messages are
|
||||
+ * logged when debugging isn't enabled.
|
||||
+ */
|
||||
+ if (pri >= LOG_WARNING) {
|
||||
+ if (pri == LOG_DEBUG) {
|
||||
+ set_log_debug_ap(ap);
|
||||
+ info(ap->logopt, "debug logging set for %s", ap->path);
|
||||
+ } else {
|
||||
+ set_log_verbose_ap(ap);
|
||||
+ info(ap->logopt, "verbose logging set for %s", ap->path);
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (ap->logopt & LOGOPT_ANY)
|
||||
+ info(ap->logopt, "basic logging set for %s", ap->path);
|
||||
+ set_log_norm_ap(ap);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void cmd_pipe_dummy(int sig)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+static void *cmd_pipe_handler(void *arg)
|
||||
+{
|
||||
+ struct sigaction sa;
|
||||
+ sigset_t signalset;
|
||||
+ struct pollfd fds[1];
|
||||
+ int pollfds = 1;
|
||||
+ char buf[MAX_ERR_BUF];
|
||||
+ char *estr;
|
||||
+
|
||||
+ if (create_cmd_pipe_fifo())
|
||||
+ return NULL;
|
||||
+
|
||||
+ fds[0].fd = cmd_pipe_fifo;
|
||||
+ fds[0].events = POLLIN;
|
||||
+
|
||||
+ sa.sa_handler = cmd_pipe_dummy;
|
||||
+ sigemptyset(&sa.sa_mask);
|
||||
+ sa.sa_flags = 0;
|
||||
+ if (sigaction(SIGPIPE, &sa, NULL) == -1) {
|
||||
+ error(LOGOPT_ANY, "failed to set signal handler %d", errno);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ sigfillset(&signalset);
|
||||
+ sigdelset(&signalset, SIGPIPE);
|
||||
+
|
||||
+ while (1) {
|
||||
+ cmd_pipe_mutex_lock();
|
||||
+ if (done) {
|
||||
+ cmd_pipe_mutex_unlock();
|
||||
+ break;
|
||||
+ }
|
||||
+ cmd_pipe_mutex_unlock();
|
||||
+
|
||||
+ errno = 0;
|
||||
+ if (ppoll(fds, pollfds, NULL, &signalset) == -1) {
|
||||
+ if (errno == EINTR)
|
||||
+ continue;
|
||||
+ estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
+ logerr("poll failed: %s", estr);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ if (fds[0].revents & POLLIN) {
|
||||
+ debug(LOGOPT_ANY, "message pending on control fifo.");
|
||||
+ handle_cmd_pipe_fifo_message(fds[0].fd);
|
||||
+ }
|
||||
+ }
|
||||
+ destroy_cmd_pipe_fifo();
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+int start_cmd_pipe_handler(void)
|
||||
+{
|
||||
+ pthread_t thid;
|
||||
+ pthread_attr_t attrs;
|
||||
+ pthread_attr_t *pattrs = &attrs;
|
||||
+ int status;
|
||||
+
|
||||
+ status = pthread_attr_init(pattrs);
|
||||
+ if (status)
|
||||
+ pattrs = NULL;
|
||||
+ else
|
||||
+ pthread_attr_setdetachstate(pattrs, PTHREAD_CREATE_DETACHED);
|
||||
+
|
||||
+ status = pthread_create(&thid, pattrs, cmd_pipe_handler, NULL);
|
||||
+
|
||||
+ if (pattrs)
|
||||
+ pthread_attr_destroy(pattrs);
|
||||
+
|
||||
+ if (!status)
|
||||
+ cmd_pipe_thid = thid;
|
||||
+
|
||||
+ return !status;
|
||||
+}
|
||||
+
|
||||
+void finish_cmd_pipe_handler(void)
|
||||
+{
|
||||
+ cmd_pipe_mutex_lock();
|
||||
+ done = 1;
|
||||
+ pthread_kill(cmd_pipe_thid, SIGPIPE);
|
||||
+ cmd_pipe_mutex_unlock();
|
||||
+}
|
||||
+
|
||||
static void return_start_status(void *arg)
|
||||
{
|
||||
struct startup_cond *sc;
|
@ -1,125 +0,0 @@
|
||||
autofs-5.1.8 - add function master_find_mapent_by_devid()
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Add a helper function that can locate an automount given its device id.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
daemon/master.c | 28 ++++++++++++++++++++++++++++
|
||||
include/master.h | 1 +
|
||||
include/mounts.h | 1 +
|
||||
lib/mounts.c | 34 ++++++++++++++++++++++++++++++++++
|
||||
5 files changed, 65 insertions(+)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -42,6 +42,7 @@
|
||||
- rename statemachine() to signal_handler().
|
||||
- make signal handling consistent.
|
||||
- eliminate last remaining state_pipe usage.
|
||||
+- add function master_find_mapent_by_devid().
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/master.c
|
||||
+++ autofs-5.1.8/daemon/master.c
|
||||
@@ -745,6 +745,34 @@ struct master_mapent *master_find_mapent
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+struct autofs_point *master_find_mapent_by_devid(struct master *master, dev_t devid)
|
||||
+{
|
||||
+ struct autofs_point *ap = NULL;
|
||||
+ struct list_head *head, *p;
|
||||
+
|
||||
+ master_mutex_lock();
|
||||
+
|
||||
+ head = &master->mounts;
|
||||
+ list_for_each(p, head) {
|
||||
+ struct master_mapent *entry;
|
||||
+
|
||||
+ entry = list_entry(p, struct master_mapent, list);
|
||||
+
|
||||
+ if (entry->ap->dev == devid) {
|
||||
+ ap = entry->ap;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ ap = mnt_find_submount_by_devid(&entry->ap->submounts, devid);
|
||||
+ if (ap)
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ master_mutex_unlock();
|
||||
+
|
||||
+ return ap;
|
||||
+}
|
||||
+
|
||||
static unsigned int master_partial_match_amd_mapent(struct master *master, const char *path)
|
||||
{
|
||||
struct list_head *head, *p;
|
||||
--- autofs-5.1.8.orig/include/master.h
|
||||
+++ autofs-5.1.8/include/master.h
|
||||
@@ -110,6 +110,7 @@ void master_source_lock_cleanup(void *);
|
||||
void master_source_current_wait(struct master_mapent *);
|
||||
void master_source_current_signal(struct master_mapent *);
|
||||
struct master_mapent *master_find_mapent(struct master *, const char *);
|
||||
+struct autofs_point *master_find_mapent_by_devid(struct master *master, dev_t devid);
|
||||
struct master_mapent *master_new_mapent(struct master *, const char *, time_t);
|
||||
void master_add_mapent(struct master *, struct master_mapent *);
|
||||
void master_remove_mapent(struct master_mapent *);
|
||||
--- autofs-5.1.8.orig/include/mounts.h
|
||||
+++ autofs-5.1.8/include/mounts.h
|
||||
@@ -160,6 +160,7 @@ int ext_mount_inuse(const char *);
|
||||
struct mnt_list *mnts_lookup_mount(const char *mp);
|
||||
void mnts_put_mount(struct mnt_list *mnt);
|
||||
struct mnt_list *mnts_find_submount(const char *path);
|
||||
+struct autofs_point *mnt_find_submount_by_devid(struct list_head *submounts, dev_t devid);
|
||||
struct mnt_list *mnts_add_submount(struct autofs_point *ap);
|
||||
void mnts_remove_submount(const char *mp);
|
||||
struct mnt_list *mnts_find_amdmount(const char *path);
|
||||
--- autofs-5.1.8.orig/lib/mounts.c
|
||||
+++ autofs-5.1.8/lib/mounts.c
|
||||
@@ -1059,6 +1059,40 @@ struct mnt_list *mnts_find_submount(cons
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+static struct autofs_point *__mnt_find_submount_by_devid(struct list_head *submounts, dev_t devid)
|
||||
+{
|
||||
+ struct autofs_point *ap = NULL;
|
||||
+ struct list_head *p;
|
||||
+
|
||||
+ list_for_each(p, submounts) {
|
||||
+ struct mnt_list *this;
|
||||
+
|
||||
+ this = list_entry(p, struct mnt_list, submount);
|
||||
+
|
||||
+ if (this->ap->dev == devid) {
|
||||
+ ap = this->ap;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ ap = mnt_find_submount_by_devid(&this->ap->submounts, devid);
|
||||
+ if (ap)
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return ap;
|
||||
+}
|
||||
+
|
||||
+struct autofs_point *mnt_find_submount_by_devid(struct list_head *submounts, dev_t devid)
|
||||
+{
|
||||
+ struct autofs_point *ap = NULL;
|
||||
+
|
||||
+ mnts_hash_mutex_lock();
|
||||
+ ap = __mnt_find_submount_by_devid(submounts, devid);
|
||||
+ mnts_hash_mutex_unlock();
|
||||
+
|
||||
+ return ap;
|
||||
+}
|
||||
+
|
||||
struct mnt_list *mnts_add_submount(struct autofs_point *ap)
|
||||
{
|
||||
struct mnt_list *this;
|
@ -1,39 +0,0 @@
|
||||
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(+)
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 9d57a21b..dacc2fa0 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -12,6 +12,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.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
diff --git a/lib/log.c b/lib/log.c
|
||||
index 0cb47d7e..d1edef28 100644
|
||||
--- a/lib/log.c
|
||||
+++ b/lib/log.c
|
||||
@@ -38,6 +38,9 @@ static char *prepare_attempt_prefix(const char *msg)
|
||||
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;
|
@ -1,38 +0,0 @@
|
||||
autofs-5.1.8 - bailout on rpc systemerror
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
If there's a system error (eg. oversize packet received) just give up
|
||||
since redoing the call would likely end up with the same error.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
lib/rpc_subs.c | 2 ++
|
||||
2 files changed, 3 insertions(+)
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index b4b064ff..575f186d 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -7,6 +7,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().
|
||||
+- bailout on rpc systemerror.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
|
||||
index 7b8162b4..ee7f94b9 100644
|
||||
--- a/lib/rpc_subs.c
|
||||
+++ b/lib/rpc_subs.c
|
||||
@@ -1195,6 +1195,8 @@ static int rpc_get_exports_proto(struct conn_info *info, struct exportinfo **exp
|
||||
info->timeout);
|
||||
if (status == RPC_SUCCESS)
|
||||
break;
|
||||
+ if (status == RPC_SYSTEMERROR)
|
||||
+ break;
|
||||
if (++vers_entry > 2)
|
||||
break;
|
||||
CLNT_CONTROL(client, CLSET_VERS,
|
@ -1,90 +0,0 @@
|
||||
Posted upstream: https://marc.info/?l=autofs&m=167840444620402
|
||||
|
||||
[Subsequently tweaked to change the type of the ct variable.]
|
||||
|
||||
Author: Arjun Shankar <arjun@redhat.com>
|
||||
Date: Fri Mar 10 00:00:55 2023 +0100
|
||||
|
||||
autofs-5.1.8 - define LDAP_DEPRECATED during LDAP configure check
|
||||
|
||||
This commit defines LDAP_DEPRECATED as 1 during a configure check for
|
||||
ldap_parse_page_control. This is in line with how lookup_ldap.c is
|
||||
compiled at build time.
|
||||
|
||||
The configure script is regenerated with autoconf 2.69.
|
||||
|
||||
The regeneration of the configure script also includes changes due to
|
||||
commit 69fda4f090e3. That commit intended to run checks with implicit
|
||||
function declaration warnings enabled in order to recognize missing
|
||||
libldap functions. However, the in-tree copy of the configure script
|
||||
was not regenerated at that time.
|
||||
|
||||
Signed-off-by: Arjun Shankar <arjun@redhat.com>
|
||||
|
||||
diff --git a/aclocal.m4 b/aclocal.m4
|
||||
index 33561aaeb9f5eaa4..1920672d37d25a27 100644
|
||||
--- a/aclocal.m4
|
||||
+++ b/aclocal.m4
|
||||
@@ -368,9 +368,10 @@ af_check_ldap_parse_page_control_save_libs="$LIBS"
|
||||
LIBS="$LIBS -lldap"
|
||||
|
||||
AC_TRY_LINK(
|
||||
- [ #include <ldap.h> ],
|
||||
+ [ #define LDAP_DEPRECATED 1
|
||||
+ #include <ldap.h> ],
|
||||
[ LDAP *ld;
|
||||
- ber_int_t ct;
|
||||
+ ber_int_t *ct;
|
||||
struct berval *c;
|
||||
int ret;
|
||||
LDAPControl **clp;
|
||||
diff --git a/configure b/configure
|
||||
index 394a8d55121c12ed..c84ef2a94d1df1b4 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -5407,6 +5407,8 @@ $as_echo_n "checking for ldap_create_page_control in -lldap... " >&6; }
|
||||
# save current libs
|
||||
af_check_ldap_create_page_control_save_libs="$LIBS"
|
||||
LIBS="$LIBS -lldap"
|
||||
+af_check_ldap_create_page_control_save_cflags="$CFLAGS"
|
||||
+CFLAGS="$CFLAGS -Werror=implicit-function-declaration"
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
@@ -5443,6 +5445,7 @@ fi
|
||||
|
||||
# restore libs
|
||||
LIBS="$af_check_ldap_create_page_control_save_libs"
|
||||
+CFLAGS="$af_check_ldap_create_page_control_save_cflags"
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_parse_page_control in -lldap" >&5
|
||||
$as_echo_n "checking for ldap_parse_page_control in -lldap... " >&6; }
|
||||
@@ -5450,15 +5453,18 @@ $as_echo_n "checking for ldap_parse_page_control in -lldap... " >&6; }
|
||||
# save current libs
|
||||
af_check_ldap_parse_page_control_save_libs="$LIBS"
|
||||
LIBS="$LIBS -lldap"
|
||||
+af_check_ldap_parse_page_control_save_cflags="$CFLAGS"
|
||||
+CFLAGS="$CFLAGS -Werror=implicit-function-declaration"
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
- #include <ldap.h>
|
||||
+ #define LDAP_DEPRECATED 1
|
||||
+ #include <ldap.h>
|
||||
int
|
||||
main ()
|
||||
{
|
||||
LDAP *ld;
|
||||
- ber_int_t ct;
|
||||
+ ber_int_t *ct;
|
||||
struct berval *c;
|
||||
int ret;
|
||||
LDAPControl **clp;
|
||||
@@ -5486,6 +5492,7 @@ fi
|
||||
|
||||
# restore libs
|
||||
LIBS="$af_check_ldap_parse_page_control_save_libs"
|
||||
+CFLAGS="$af_check_ldap_parse_page_control_save_cflags"
|
||||
|
||||
fi
|
||||
|
@ -1,32 +0,0 @@
|
||||
autofs-5.1.8 - coverity fix for invalid access
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Fix invalid access in modules/parse_amd.c:do_host_mount().
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
modules/parse_amd.c | 1 -
|
||||
2 files changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -22,6 +22,7 @@
|
||||
- fix autofs regression due to positive_timeout.
|
||||
- fix parse module instance mutex naming.
|
||||
- serialise lookup module open and reinit.
|
||||
+- coverity fix for invalid access.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/modules/parse_amd.c
|
||||
+++ autofs-5.1.8/modules/parse_amd.c
|
||||
@@ -1366,7 +1366,6 @@ static int do_host_mount(struct autofs_p
|
||||
if (!instance) {
|
||||
error(ap->logopt, MODPREFIX
|
||||
"failed to create source instance for hosts map");
|
||||
- close_lookup(lookup);
|
||||
goto out;
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
autofs-5.1.8 - don't close lookup at umount
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Since map sources are reference counted they persist beyond autofs
|
||||
submounts.
|
||||
|
||||
Now the map source moudule lookup gets closed at submount umount and
|
||||
if we are unlucky enough to be using the same map in other submounts
|
||||
and a lookup is underway at the time of the umount a crash can occur.
|
||||
|
||||
To resolve this it's much better to just not close the lookup at
|
||||
submount umount and rely on the map source free to close the module
|
||||
lookup and instances when the map source is no longer referenced.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
daemon/automount.c | 7 -------
|
||||
2 files changed, 1 insertion(+), 7 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -35,6 +35,7 @@
|
||||
- improve handling of ENOENT in sss setautomntent().
|
||||
- don't immediately call function when waiting.
|
||||
- fix return status of mount_autofs().
|
||||
+- don't close lookup at umount.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/automount.c
|
||||
+++ autofs-5.1.8/daemon/automount.c
|
||||
@@ -742,13 +742,6 @@ static int umount_autofs(struct autofs_p
|
||||
if (ap->state == ST_INIT)
|
||||
return -1;
|
||||
|
||||
- /*
|
||||
- * Since lookup.c is lazy about closing lookup modules
|
||||
- * to prevent unneeded opens, we need to clean them up
|
||||
- * before umount.
|
||||
- */
|
||||
- lookup_close_lookup(ap);
|
||||
-
|
||||
if (ap->type == LKP_INDIRECT) {
|
||||
umount_all(ap);
|
||||
ret = umount_autofs_indirect(ap, root);
|
@ -1,94 +0,0 @@
|
||||
autofs-5.1.8 - dont delay expire
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
There's a delay on expire of submounts that can be as much as the
|
||||
expire timeout. This was originally an attempt to reduce re-reading
|
||||
the map but it can cause very long delays on expire.
|
||||
|
||||
So get rid of the delay and allow submounts to expire normally.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
daemon/master.c | 9 ++++-----
|
||||
daemon/state.c | 30 ++++--------------------------
|
||||
3 files changed, 9 insertions(+), 31 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -37,6 +37,7 @@
|
||||
- fix return status of mount_autofs().
|
||||
- don't close lookup at umount.
|
||||
- fix deadlock in lookups.
|
||||
+- dont delay expire.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/master.c
|
||||
+++ autofs-5.1.8/daemon/master.c
|
||||
@@ -1256,17 +1256,16 @@ int master_notify_submount(struct autofs
|
||||
st_wait_task(this->ap, state, 0);
|
||||
|
||||
/*
|
||||
- * If our submount gets to state ST_SHUTDOWN, ST_SHUTDOWN_PENDING or
|
||||
- * ST_SHUTDOWN_FORCE we need to wait until it goes away or changes
|
||||
- * to ST_READY.
|
||||
+ * If our submount gets to state ST_SHUTDOWN_PENDING or
|
||||
+ * ST_SHUTDOWN_FORCE we need to wait until it goes away
|
||||
+ * or changes to state ST_SHUTDOWN or ST_READY.
|
||||
*/
|
||||
st_mutex_lock();
|
||||
while ((sbmnt = mnts_find_submount(path))) {
|
||||
struct timespec t = { 0, 300000000 };
|
||||
struct timespec r;
|
||||
|
||||
- if (sbmnt->ap->state != ST_SHUTDOWN &&
|
||||
- sbmnt->ap->state != ST_SHUTDOWN_PENDING &&
|
||||
+ if (sbmnt->ap->state != ST_SHUTDOWN_PENDING &&
|
||||
sbmnt->ap->state != ST_SHUTDOWN_FORCE) {
|
||||
ret = 0;
|
||||
mnts_put_mount(sbmnt);
|
||||
--- autofs-5.1.8.orig/daemon/state.c
|
||||
+++ autofs-5.1.8/daemon/state.c
|
||||
@@ -99,36 +99,14 @@ void expire_cleanup(void *arg)
|
||||
/*
|
||||
* If we're a submount and we've just pruned or
|
||||
* expired everything away, try to shut down.
|
||||
- *
|
||||
- * Since we use the the fact that a mount will not
|
||||
- * expire for at least ap->exp_timeout to avoid a
|
||||
- * mount <-> expire race we need to wait before
|
||||
- * letting a submount expire away. We also need
|
||||
- * them to go away fairly quickly so the owner
|
||||
- * mount expires in a reasonable time. Just skip
|
||||
- * one expire check after it's no longer busy before
|
||||
- * allowing it to shutdown.
|
||||
- *
|
||||
- * But if this mount point is an amd format map it
|
||||
- * is better to keep the mount around longer. This
|
||||
- * is because of the common heavy reuse of maps in
|
||||
- * amd maps and we want to try and avoid constantly
|
||||
- * re-reading large maps.
|
||||
*/
|
||||
if (ap->submount && !success) {
|
||||
rv = ops->askumount(ap->logopt, ap->ioctlfd, &idle);
|
||||
- if (!rv && idle && ap->submount > 1) {
|
||||
- struct map_source *map = ap->entry->maps;
|
||||
-
|
||||
- if (ap->submount > 4 ||
|
||||
- !(map->flags & MAP_FLAG_FORMAT_AMD)) {
|
||||
- next = ST_SHUTDOWN_PENDING;
|
||||
- break;
|
||||
- }
|
||||
+ if (!rv && idle) {
|
||||
+ next = ST_SHUTDOWN_PENDING;
|
||||
+ break;
|
||||
}
|
||||
- ap->submount++;
|
||||
- } else if (ap->submount > 1)
|
||||
- ap->submount = 1;
|
||||
+ }
|
||||
|
||||
if (ap->state == ST_EXPIRE)
|
||||
conditional_alarm_add(ap, ap->exp_runfreq);
|
@ -1,50 +0,0 @@
|
||||
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(-)
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index bd1f672c..aaf20cd6 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -5,6 +5,7 @@
|
||||
- fix root offset error handling.
|
||||
- fix fix root offset error handling.
|
||||
- fix nonstrict fail handling of last offset mount.
|
||||
+- dont fail on duplicate offset entry tree add.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
diff --git a/lib/mounts.c b/lib/mounts.c
|
||||
index b4229908..451849a6 100644
|
||||
--- a/lib/mounts.c
|
||||
+++ b/lib/mounts.c
|
||||
@@ -1341,7 +1341,7 @@ static struct tree_node *tree_add_node(struct tree_node *root, void *ptr)
|
||||
}
|
||||
|
||||
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_node *n, void *ptr)
|
||||
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;
|
||||
}
|
||||
|
@ -1,101 +0,0 @@
|
||||
autofs-5.1.8 - dont immediately call function when waiting
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
When autofs needs to wait for a sss connection the connection function
|
||||
is immediately called a second time without first waiting. Adjust the
|
||||
calling so that there's a wait before the next call.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
modules/lookup_sss.c | 24 ++++++++++++------------
|
||||
2 files changed, 13 insertions(+), 12 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -33,6 +33,7 @@
|
||||
- include addtional log info for mounts.
|
||||
- fail on empty replicated host name.
|
||||
- improve handling of ENOENT in sss setautomntent().
|
||||
+- don't immediately call function when waiting.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/modules/lookup_sss.c
|
||||
+++ autofs-5.1.8/modules/lookup_sss.c
|
||||
@@ -338,10 +338,13 @@ static int setautomntent_wait(unsigned i
|
||||
"can't connect to sssd, retry for %d seconds",
|
||||
retries);
|
||||
|
||||
- while (++retry <= retries) {
|
||||
+ while (++retry < retries) {
|
||||
struct timespec t = { SSS_WAIT_INTERVAL, 0 };
|
||||
struct timespec r;
|
||||
|
||||
+ while (nanosleep(&t, &r) == -1 && errno == EINTR)
|
||||
+ memcpy(&t, &r, sizeof(struct timespec));
|
||||
+
|
||||
ret = ctxt->setautomntent(ctxt->mapname, sss_ctxt);
|
||||
if (proto_version(ctxt) == 0) {
|
||||
if (ret != ENOENT)
|
||||
@@ -355,9 +358,6 @@ static int setautomntent_wait(unsigned i
|
||||
free(*sss_ctxt);
|
||||
*sss_ctxt = NULL;
|
||||
}
|
||||
-
|
||||
- while (nanosleep(&t, &r) == -1 && errno == EINTR)
|
||||
- memcpy(&t, &r, sizeof(struct timespec));
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
@@ -475,10 +475,13 @@ static int getautomntent_wait(unsigned i
|
||||
"can't contact sssd to to get map entry, retry for %d seconds",
|
||||
retries);
|
||||
|
||||
- while (++retry <= retries) {
|
||||
+ while (++retry < retries) {
|
||||
struct timespec t = { SSS_WAIT_INTERVAL, 0 };
|
||||
struct timespec r;
|
||||
|
||||
+ while (nanosleep(&t, &r) == -1 && errno == EINTR)
|
||||
+ memcpy(&t, &r, sizeof(struct timespec));
|
||||
+
|
||||
ret = ctxt->getautomntent_r(key, value, sss_ctxt);
|
||||
if (proto_version(ctxt) == 0) {
|
||||
if (ret != ENOENT)
|
||||
@@ -487,9 +490,6 @@ static int getautomntent_wait(unsigned i
|
||||
if (ret != EHOSTDOWN)
|
||||
break;
|
||||
}
|
||||
-
|
||||
- while (nanosleep(&t, &r) == -1 && errno == EINTR)
|
||||
- memcpy(&t, &r, sizeof(struct timespec));
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
@@ -600,10 +600,13 @@ static int getautomntbyname_wait(unsigne
|
||||
"can't contact sssd to to lookup key value, retry for %d seconds",
|
||||
retries);
|
||||
|
||||
- while (++retry <= retries) {
|
||||
+ while (++retry < retries) {
|
||||
struct timespec t = { SSS_WAIT_INTERVAL, 0 };
|
||||
struct timespec r;
|
||||
|
||||
+ while (nanosleep(&t, &r) == -1 && errno == EINTR)
|
||||
+ memcpy(&t, &r, sizeof(struct timespec));
|
||||
+
|
||||
ret = ctxt->getautomntbyname_r(key, value, sss_ctxt);
|
||||
if (proto_version(ctxt) == 0) {
|
||||
if (ret != ENOENT)
|
||||
@@ -612,9 +615,6 @@ static int getautomntbyname_wait(unsigne
|
||||
if (ret != EHOSTDOWN)
|
||||
break;
|
||||
}
|
||||
-
|
||||
- while (nanosleep(&t, &r) == -1 && errno == EINTR)
|
||||
- memcpy(&t, &r, sizeof(struct timespec));
|
||||
}
|
||||
|
||||
if (!ret)
|
@ -1,135 +0,0 @@
|
||||
autofs-5.1.8 - dont use initgroups() at spawn
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
The initgroups(3) function isn't safe to use between fork() and
|
||||
exec() in a threaded program.
|
||||
|
||||
Using it this way often leads to a hang for even moderate work
|
||||
loads.
|
||||
|
||||
But the getgrouplist()/setgroups() combination can be used safely
|
||||
in this case and this patch changes autofs to use these (the safety
|
||||
of using of setgroups() is yet to to be documented).
|
||||
|
||||
A large portion of the work on this patch has been contributed
|
||||
by Roberto Bergantinos <rbergant@redhat.com>.
|
||||
|
||||
Reported-by: Roberto Bergantinos <rbergant@redhat.com>
|
||||
Fixes: 6343a3292020 ("autofs-5.1.3 - fix ordering of seteuid/setegid in do_spawn()")
|
||||
Signed-off-by: Roberto Bergantinos <rbergant@redhat.com>
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
daemon/spawn.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++----
|
||||
2 files changed, 48 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 72a5aa59..e1214323 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -16,6 +16,7 @@
|
||||
- fix sysconf(3) return handling.
|
||||
- remove nonstrict parameter from tree_mapent_umount_offsets().
|
||||
- fix handling of incorrect return from umount_ent().
|
||||
+- dont use initgroups() at spawn.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
diff --git a/daemon/spawn.c b/daemon/spawn.c
|
||||
index 914e5288..6f8856a9 100644
|
||||
--- a/daemon/spawn.c
|
||||
+++ b/daemon/spawn.c
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <sys/wait.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/mount.h>
|
||||
+#include <pwd.h>
|
||||
|
||||
#include "automount.h"
|
||||
|
||||
@@ -335,6 +336,10 @@ static int do_spawn(unsigned logopt, unsigned int wait,
|
||||
struct thread_stdenv_vars *tsv;
|
||||
pid_t euid = 0;
|
||||
gid_t egid = 0;
|
||||
+ gid_t *groups = NULL;
|
||||
+ gid_t *saved_groups = NULL;
|
||||
+ int ngroups = 0;
|
||||
+ int nsaved_groups = 0;
|
||||
|
||||
if (open_pipe(pipefd))
|
||||
return -1;
|
||||
@@ -357,6 +362,31 @@ static int do_spawn(unsigned logopt, unsigned int wait,
|
||||
}
|
||||
|
||||
open_mutex_lock();
|
||||
+
|
||||
+ if (euid) {
|
||||
+ struct passwd *pwd;
|
||||
+
|
||||
+ pwd = getpwuid(getuid());
|
||||
+ if (!pwd)
|
||||
+ fprintf(stderr,
|
||||
+ "warning: getpwuid: can't get current username\n");
|
||||
+ else {
|
||||
+ /* get number of groups for current gid */
|
||||
+ getgrouplist(pwd->pw_name, getgid(), NULL, &nsaved_groups);
|
||||
+ saved_groups = malloc(nsaved_groups * sizeof(gid_t));
|
||||
+
|
||||
+ /* get current gid groups list */
|
||||
+ getgrouplist(pwd->pw_name, getgid(), saved_groups, &nsaved_groups);
|
||||
+ }
|
||||
+
|
||||
+ /* get number of groups of mount triggering process */
|
||||
+ getgrouplist(tsv->user, egid, NULL, &ngroups);
|
||||
+ groups = malloc(ngroups * sizeof(gid_t));
|
||||
+
|
||||
+ /* get groups list of mount triggering process */
|
||||
+ getgrouplist(tsv->user, egid, groups, &ngroups);
|
||||
+ }
|
||||
+
|
||||
f = fork();
|
||||
if (f == 0) {
|
||||
char **pargv = (char **) argv;
|
||||
@@ -398,10 +428,13 @@ static int do_spawn(unsigned logopt, unsigned int wait,
|
||||
if (!tsv->user)
|
||||
fprintf(stderr,
|
||||
"warning: can't init groups\n");
|
||||
- else if (initgroups(tsv->user, egid) == -1)
|
||||
- fprintf(stderr,
|
||||
- "warning: initgroups: %s\n",
|
||||
- strerror(errno));
|
||||
+ else if (groups) {
|
||||
+ if (setgroups(ngroups, groups) == -1)
|
||||
+ fprintf(stderr,
|
||||
+ "warning: setgroups: %s\n",
|
||||
+ strerror(errno));
|
||||
+ free(groups);
|
||||
+ }
|
||||
|
||||
if (setegid(egid) == -1)
|
||||
fprintf(stderr,
|
||||
@@ -436,6 +469,11 @@ static int do_spawn(unsigned logopt, unsigned int wait,
|
||||
strerror(errno));
|
||||
if (pgrp >= 0)
|
||||
setpgid(0, pgrp);
|
||||
+ /* Reset groups for trigger of trailing mount */
|
||||
+ if (euid && saved_groups) {
|
||||
+ setgroups(nsaved_groups, saved_groups);
|
||||
+ free(saved_groups);
|
||||
+ }
|
||||
|
||||
/*
|
||||
* The kernel leaves mount type autofs alone because
|
||||
@@ -474,6 +512,11 @@ done:
|
||||
pthread_sigmask(SIG_SETMASK, &tmpsig, NULL);
|
||||
open_mutex_unlock();
|
||||
|
||||
+ if (groups)
|
||||
+ free(groups);
|
||||
+ if (saved_groups)
|
||||
+ free(saved_groups);
|
||||
+
|
||||
close(pipefd[1]);
|
||||
|
||||
if (f < 0) {
|
@ -1,292 +0,0 @@
|
||||
autofs-5.1.8 - eliminate last remaining state_pipe usage
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Eliminate the last remaining usage autofs mount struct state_pipe that
|
||||
is used when changing state to ST_SHUTDOWN at submount exit. Ths single
|
||||
usage consumes a pipe file handle pair for every autofs file system
|
||||
mount.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1
|
||||
daemon/automount.c | 78 ++++++++++++++++++++--------------------------------
|
||||
daemon/direct.c | 2 -
|
||||
daemon/indirect.c | 7 ----
|
||||
daemon/master.c | 21 ++------------
|
||||
daemon/state.c | 16 +++-------
|
||||
include/automount.h | 1
|
||||
include/state.h | 1
|
||||
8 files changed, 40 insertions(+), 87 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -41,6 +41,7 @@
|
||||
- make amd mapent search function name clear.
|
||||
- rename statemachine() to signal_handler().
|
||||
- make signal handling consistent.
|
||||
+- eliminate last remaining state_pipe usage.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/automount.c
|
||||
+++ autofs-5.1.8/daemon/automount.c
|
||||
@@ -1068,58 +1068,51 @@ static int set_log_priority(const char *
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static void dummy(int sig)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
static int get_pkt(struct autofs_point *ap, union autofs_v5_packet_union *pkt)
|
||||
{
|
||||
- struct pollfd fds[3];
|
||||
- int pollfds = 3;
|
||||
+ struct sigaction sa;
|
||||
+ sigset_t signalset;
|
||||
+ struct pollfd fds[2];
|
||||
+ int pollfds = 2;
|
||||
char buf[MAX_ERR_BUF];
|
||||
size_t read;
|
||||
char *estr;
|
||||
|
||||
fds[0].fd = ap->pipefd;
|
||||
fds[0].events = POLLIN;
|
||||
- fds[1].fd = ap->state_pipe[0];
|
||||
+ fds[1].fd = ap->logpri_fifo;
|
||||
fds[1].events = POLLIN;
|
||||
- fds[2].fd = ap->logpri_fifo;
|
||||
- fds[2].events = POLLIN;
|
||||
- if (fds[2].fd == -1)
|
||||
+ if (fds[1].fd == -1)
|
||||
pollfds--;
|
||||
|
||||
- for (;;) {
|
||||
- if (poll(fds, pollfds, -1) == -1) {
|
||||
- if (errno == EINTR)
|
||||
- continue;
|
||||
- estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- logerr("poll failed: %s", estr);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- if (fds[1].revents & POLLIN) {
|
||||
- enum states next_state;
|
||||
- size_t read_size = sizeof(next_state);
|
||||
- int state_pipe;
|
||||
+ sa.sa_handler = dummy;
|
||||
+ sigemptyset(&sa.sa_mask);
|
||||
+ sa.sa_flags = 0;
|
||||
+ if (sigaction(SIGCONT, &sa, NULL) == -1)
|
||||
+ error(LOGOPT_ANY, "failed to set signal handler %d", errno);
|
||||
|
||||
- next_state = ST_INVAL;
|
||||
+ sigfillset(&signalset);
|
||||
+ sigdelset(&signalset, SIGCONT);
|
||||
|
||||
- st_mutex_lock();
|
||||
-
|
||||
- state_pipe = ap->state_pipe[0];
|
||||
-
|
||||
- read = fullread(state_pipe, &next_state, read_size);
|
||||
- if (read) {
|
||||
- estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- error(ap->logopt,
|
||||
- "read error on state pipe, "
|
||||
- "read %lu, error %s",
|
||||
- read, estr);
|
||||
+ for (;;) {
|
||||
+ errno = 0;
|
||||
+ if (ppoll(fds, pollfds, NULL, &signalset) == -1) {
|
||||
+ if (errno == EINTR) {
|
||||
+ st_mutex_lock();
|
||||
+ if (ap->state == ST_SHUTDOWN) {
|
||||
+ st_mutex_unlock();
|
||||
+ return -1;
|
||||
+ }
|
||||
st_mutex_unlock();
|
||||
continue;
|
||||
}
|
||||
-
|
||||
- st_mutex_unlock();
|
||||
-
|
||||
- if (next_state == ST_SHUTDOWN)
|
||||
- return -1;
|
||||
+ estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
+ logerr("poll failed: %s", estr);
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
if (fds[0].revents & POLLIN) {
|
||||
@@ -1134,9 +1127,9 @@ static int get_pkt(struct autofs_point *
|
||||
return read;
|
||||
}
|
||||
|
||||
- if (fds[2].fd != -1 && fds[2].revents & POLLIN) {
|
||||
+ if (fds[1].fd != -1 && fds[1].revents & POLLIN) {
|
||||
debug(ap->logopt, "message pending on control fifo.");
|
||||
- handle_fifo_message(ap, fds[2].fd);
|
||||
+ handle_fifo_message(ap, fds[1].fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1199,15 +1192,6 @@ static int autofs_init_ap(struct autofs_
|
||||
ap->pipefd = pipefd[0];
|
||||
ap->kpipefd = pipefd[1];
|
||||
|
||||
- /* Pipe state changes from signal handler to main loop */
|
||||
- if (open_pipe(ap->state_pipe) < 0) {
|
||||
- crit(ap->logopt,
|
||||
- "failed create state pipe for autofs path %s", ap->path);
|
||||
- close(ap->pipefd);
|
||||
- close(ap->kpipefd); /* Close kernel pipe end */
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
if (create_logpri_fifo(ap) < 0) {
|
||||
logmsg("could not create FIFO for path %s\n", ap->path);
|
||||
logmsg("dynamic log level changes not available for %s", ap->path);
|
||||
--- autofs-5.1.8.orig/daemon/direct.c
|
||||
+++ autofs-5.1.8/daemon/direct.c
|
||||
@@ -263,8 +263,6 @@ done:
|
||||
}
|
||||
pthread_cleanup_pop(1);
|
||||
|
||||
- close(ap->state_pipe[0]);
|
||||
- close(ap->state_pipe[1]);
|
||||
if (ap->pipefd >= 0)
|
||||
close(ap->pipefd);
|
||||
if (ap->kpipefd >= 0) {
|
||||
--- autofs-5.1.8.orig/daemon/indirect.c
|
||||
+++ autofs-5.1.8/daemon/indirect.c
|
||||
@@ -152,8 +152,6 @@ out_rmdir:
|
||||
out_err:
|
||||
if (options)
|
||||
free(options);
|
||||
- close(ap->state_pipe[0]);
|
||||
- close(ap->state_pipe[1]);
|
||||
close(ap->pipefd);
|
||||
close(ap->kpipefd);
|
||||
|
||||
@@ -216,11 +214,6 @@ void close_mount_fds(struct autofs_point
|
||||
if (ap->submount)
|
||||
lookup_source_close_ioctlfd(ap->parent, ap->path);
|
||||
|
||||
- close(ap->state_pipe[0]);
|
||||
- close(ap->state_pipe[1]);
|
||||
- ap->state_pipe[0] = -1;
|
||||
- ap->state_pipe[1] = -1;
|
||||
-
|
||||
if (ap->pipefd >= 0)
|
||||
close(ap->pipefd);
|
||||
|
||||
--- autofs-5.1.8.orig/daemon/master.c
|
||||
+++ autofs-5.1.8/daemon/master.c
|
||||
@@ -113,8 +113,6 @@ int master_add_autofs_point(struct maste
|
||||
|
||||
ap->state = ST_INIT;
|
||||
|
||||
- ap->state_pipe[0] = -1;
|
||||
- ap->state_pipe[1] = -1;
|
||||
ap->logpri_fifo = -1;
|
||||
|
||||
ap->path = strdup(entry->path);
|
||||
@@ -1396,7 +1394,7 @@ static int master_do_mount(struct master
|
||||
handle_mounts_startup_cond_destroy(&suc);
|
||||
return 0;
|
||||
}
|
||||
- entry->thid = thid;
|
||||
+ entry->thid = ap->thid = thid;
|
||||
|
||||
handle_mounts_startup_cond_destroy(&suc);
|
||||
|
||||
@@ -1480,9 +1478,6 @@ int master_mount_mounts(struct master *m
|
||||
struct master_mapent *this;
|
||||
struct autofs_point *ap;
|
||||
struct mapent *ne, *nested;
|
||||
- struct stat st;
|
||||
- int state_pipe, save_errno;
|
||||
- int ret;
|
||||
|
||||
this = list_entry(p, struct master_mapent, list);
|
||||
p = p->next;
|
||||
@@ -1539,19 +1534,9 @@ int master_mount_mounts(struct master *m
|
||||
}
|
||||
cache_unlock(nc);
|
||||
cont:
|
||||
- st_mutex_lock();
|
||||
-
|
||||
- state_pipe = this->ap->state_pipe[1];
|
||||
-
|
||||
- /* No pipe so mount is needed */
|
||||
- ret = fstat(state_pipe, &st);
|
||||
- save_errno = errno;
|
||||
-
|
||||
- st_mutex_unlock();
|
||||
-
|
||||
- if (!ret)
|
||||
+ if (ap->thid && is_mounted(this->path, MNTS_AUTOFS))
|
||||
check_update_map_sources(this, master->readall);
|
||||
- else if (ret == -1 && save_errno == EBADF) {
|
||||
+ else {
|
||||
if (!master_do_mount(this)) {
|
||||
list_del_init(&this->list);
|
||||
master_free_mapent_sources(ap->entry, 1);
|
||||
--- autofs-5.1.8.orig/daemon/state.c
|
||||
+++ autofs-5.1.8/daemon/state.c
|
||||
@@ -52,16 +52,6 @@ void st_mutex_unlock(void)
|
||||
fatal(status);
|
||||
}
|
||||
|
||||
-void nextstate(int statefd, enum states next)
|
||||
-{
|
||||
- char buf[MAX_ERR_BUF];
|
||||
-
|
||||
- if (write(statefd, &next, sizeof(next)) != sizeof(next)) {
|
||||
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- logerr("write failed %s", estr);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
/*
|
||||
* Handle expire thread cleanup and return the next state the system
|
||||
* should enter as a result.
|
||||
@@ -631,12 +621,16 @@ static unsigned int st_force_shutdown(st
|
||||
|
||||
static unsigned int st_shutdown(struct autofs_point *ap)
|
||||
{
|
||||
+ int ret;
|
||||
+
|
||||
debug(ap->logopt, "state %d path %s", ap->state, ap->path);
|
||||
|
||||
assert(ap->state == ST_SHUTDOWN_PENDING || ap->state == ST_SHUTDOWN_FORCE);
|
||||
|
||||
ap->state = ST_SHUTDOWN;
|
||||
- nextstate(ap->state_pipe[1], ST_SHUTDOWN);
|
||||
+ ret = pthread_kill(ap->thid, SIGCONT);
|
||||
+ if (ret)
|
||||
+ error(LOGOPT_ANY, "error %d sending shutdown signal", ret);
|
||||
|
||||
return 0;
|
||||
}
|
||||
--- autofs-5.1.8.orig/include/automount.h
|
||||
+++ autofs-5.1.8/include/automount.h
|
||||
@@ -565,7 +565,6 @@ struct autofs_point {
|
||||
pthread_t exp_thread; /* Thread that is expiring */
|
||||
pthread_t readmap_thread; /* Thread that is reading maps */
|
||||
enum states state; /* Current state */
|
||||
- int state_pipe[2]; /* State change router pipe */
|
||||
struct autofs_point *parent; /* Owner of mounts list for submount */
|
||||
struct list_head mounts; /* List of autofs mounts at current level */
|
||||
unsigned int submount; /* Is this a submount */
|
||||
--- autofs-5.1.8.orig/include/state.h
|
||||
+++ autofs-5.1.8/include/state.h
|
||||
@@ -86,7 +86,6 @@ void st_mutex_unlock(void);
|
||||
|
||||
void expire_cleanup(void *);
|
||||
void expire_proc_cleanup(void *);
|
||||
-void nextstate(int, enum states);
|
||||
|
||||
int st_add_task(struct autofs_point *, enum states);
|
||||
int __st_add_task(struct autofs_point *, enum states);
|
@ -1,57 +0,0 @@
|
||||
autofs-5.1.8 - fail on empty replicated host name
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
If a mount location host (or hosts) has an empty host name it has to be
|
||||
a mistake so fail the automount request.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
modules/parse_sun.c | 18 ++++++++++++++++++
|
||||
2 files changed, 19 insertions(+)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -31,6 +31,7 @@
|
||||
- fix additional tsv invalid access.
|
||||
- fix use_ignore_mount_option description.
|
||||
- include addtional log info for mounts.
|
||||
+- fail on empty replicated host name.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/modules/parse_sun.c
|
||||
+++ autofs-5.1.8/modules/parse_sun.c
|
||||
@@ -935,6 +935,12 @@ static int validate_location(unsigned in
|
||||
if (*ptr == ':')
|
||||
return 1;
|
||||
|
||||
+ /* Fail on replicated entry with empty first host name */
|
||||
+ if (*ptr == ',') {
|
||||
+ error(logopt, "missing first host name in location %s", loc);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* If a ':/' is present now it must be a host name, except
|
||||
* for those special file systems like sshfs which use "#"
|
||||
@@ -971,6 +977,18 @@ static int validate_location(unsigned in
|
||||
"found in location %s", *ptr, loc);
|
||||
return 0;
|
||||
}
|
||||
+
|
||||
+ /* Fail on replicated entry with empty host name */
|
||||
+ if (*ptr == ',') {
|
||||
+ char next = *(ptr + 1);
|
||||
+
|
||||
+ if (next == ',' || next == ':') {
|
||||
+ error(logopt,
|
||||
+ "missing host name in location %s", loc);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
ptr++;
|
||||
}
|
||||
|
@ -1,44 +0,0 @@
|
||||
autofs-5.1.8 - fix additional tsv invalid access
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
When using the --dumpmaps option of automount(8) a SEGV can occur
|
||||
because a thread specific data variable accessed in the code hasn't
|
||||
yet been created.
|
||||
|
||||
There is another thread specific data variable that is accessed when
|
||||
dumping the maps so it needs to be created too.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
daemon/automount.c | 8 ++++++++
|
||||
2 files changed, 9 insertions(+)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -28,6 +28,7 @@
|
||||
- fix memory leak in update_hosts_mounts().
|
||||
- fix minus only option handling in concat_options().
|
||||
- fix incorrect path for is_mounted() in try_remount().
|
||||
+- fix additional tsv invalid access.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/automount.c
|
||||
+++ autofs-5.1.8/daemon/automount.c
|
||||
@@ -2538,6 +2538,14 @@ int main(int argc, char *argv[])
|
||||
exit(1);
|
||||
}
|
||||
|
||||
+ status = pthread_key_create(&key_thread_attempt_id, free);
|
||||
+ if (status) {
|
||||
+ logerr("%s: failed to create thread data key for attempt ID!",
|
||||
+ program);
|
||||
+ macro_free_global_table();
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
if (master)
|
||||
master_list = master_new(NULL, timeout, flags);
|
||||
else
|
@ -1,284 +0,0 @@
|
||||
autofs-5.1.8 - fix autofs regression due to positive_timeout
|
||||
|
||||
From: Alexandre Merlin <alexandre.merlin@inria.fr>
|
||||
|
||||
Because of our use of a script-based map that dynamically creates
|
||||
exports server-side based on user's rights, we see a regression since
|
||||
commit 2f562f63a (autofs-5.1.6 - use a valid timeout in
|
||||
lookup_prune_one_cache()).
|
||||
|
||||
Creating an option for a configurable positive_timeout, as mentioned in
|
||||
the commit comment, would solve this problem for us.
|
||||
|
||||
We use autofs to mount these filesystems on the fly, using a map based
|
||||
on a script which checks that the user is granted, and which asks for
|
||||
the creation of the appropriate export file on the corresponding NFS
|
||||
server.
|
||||
|
||||
When the reservation is done, we signal the node's automount daemon
|
||||
using the USR1 and HUP signals in order to forget what was automounted
|
||||
by the user (as compute nodes may be shared by different users, we want
|
||||
to ensure that the previously mounted resource is no more in the
|
||||
running configuration).
|
||||
|
||||
For this to work, our granting access script must be called each time a
|
||||
user request to access a mounted point. But since the commit [2f562f63a]
|
||||
introducing the positive timeout, when a user tries to access a mounted
|
||||
point, the cache is used if a another user used the same mounted point
|
||||
within the positive timeout timeframe (120s).
|
||||
|
||||
So we need a way to disable the cache to be sure that our granting script
|
||||
is called. It can be done for the NEGATIVE_TIMEOUT but not yet for the
|
||||
POSITIVE_TIMEOUT.
|
||||
|
||||
Signed-off-by: Alexandre Merlin <alexandre.merlin@inria.fr>
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
daemon/automount.c | 10 +++++++++-
|
||||
daemon/lookup.c | 6 ++++--
|
||||
daemon/master.c | 6 ++++++
|
||||
daemon/master_parse.y | 4 +++-
|
||||
include/automount.h | 1 +
|
||||
include/defaults.h | 2 ++
|
||||
lib/defaults.c | 12 ++++++++++++
|
||||
man/autofs.conf.5.in | 6 ++++++
|
||||
redhat/autofs.conf.default.in | 5 +++++
|
||||
samples/autofs.conf.default.in | 5 +++++
|
||||
11 files changed, 54 insertions(+), 4 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -19,6 +19,7 @@
|
||||
- dont use initgroups() at spawn.
|
||||
- fix missing unlock in sasl_do_kinit_ext_cc().
|
||||
- fix invalid tsv access.
|
||||
+- fix autofs regression due to positive_timeout.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/automount.c
|
||||
+++ autofs-5.1.8/daemon/automount.c
|
||||
@@ -69,6 +69,7 @@ static char *pid_file = NULL; /* File i
|
||||
unsigned int global_selection_options;
|
||||
|
||||
long global_negative_timeout = -1;
|
||||
+long global_positive_timeout = -1;
|
||||
int do_force_unlink = 0; /* Forceably unlink mount tree at startup */
|
||||
|
||||
static int start_pipefd[2] = {-1, -1};
|
||||
@@ -2019,6 +2020,8 @@ static void usage(void)
|
||||
" dump automounter maps and exit\n"
|
||||
" -n --negative-timeout n\n"
|
||||
" set the timeout for failed key lookups.\n"
|
||||
+ " -P --positive-timeout n\n"
|
||||
+ " set the positive timeout for key lookups.\n"
|
||||
" -O --global-options\n"
|
||||
" specify global mount options\n"
|
||||
" -l --set-log-priority priority path [path,...]\n"
|
||||
@@ -2277,7 +2280,7 @@ int main(int argc, char *argv[])
|
||||
time_t timeout;
|
||||
time_t age = monotonic_time(NULL);
|
||||
struct rlimit rlim;
|
||||
- const char *options = "+hp:t:vmdD:SfVrO:l:n:CFUM:";
|
||||
+ const char *options = "+hp:t:vmdD:SfVrO:l:n:P:CFUM:";
|
||||
static const struct option long_options[] = {
|
||||
{"help", 0, 0, 'h'},
|
||||
{"pid-file", 1, 0, 'p'},
|
||||
@@ -2289,6 +2292,7 @@ int main(int argc, char *argv[])
|
||||
{"foreground", 0, 0, 'f'},
|
||||
{"random-multimount-selection", 0, 0, 'r'},
|
||||
{"negative-timeout", 1, 0, 'n'},
|
||||
+ {"positive-timeout", 1, 0, 'P'},
|
||||
{"dumpmaps", 0, 0, 'm'},
|
||||
{"global-options", 1, 0, 'O'},
|
||||
{"version", 0, 0, 'V'},
|
||||
@@ -2379,6 +2383,10 @@ int main(int argc, char *argv[])
|
||||
global_negative_timeout = getnumopt(optarg, opt);
|
||||
break;
|
||||
|
||||
+ case 'P':
|
||||
+ global_positive_timeout = getnumopt(optarg, opt);
|
||||
+ break;
|
||||
+
|
||||
case 'm':
|
||||
flags |= DAEMON_FLAGS_DUMP_MAPS;
|
||||
break;
|
||||
--- autofs-5.1.8.orig/daemon/lookup.c
|
||||
+++ autofs-5.1.8/daemon/lookup.c
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "automount.h"
|
||||
#include "nsswitch.h"
|
||||
|
||||
+extern long global_positive_timeout;
|
||||
+
|
||||
static void nsslist_cleanup(void *arg)
|
||||
{
|
||||
struct list_head *nsslist = (struct list_head *) arg;
|
||||
@@ -1362,11 +1364,11 @@ void lookup_prune_one_cache(struct autof
|
||||
|
||||
/* If the map hasn't been read (nobrowse
|
||||
* indirect mounts) then keep cached entries
|
||||
- * for POSITIVE_TIMEOUT.
|
||||
+ * for ap->positive_timeout.
|
||||
*/
|
||||
if (!(ap->flags & (MOUNT_FLAG_GHOST |
|
||||
MOUNT_FLAG_AMD_CACHE_ALL))) {
|
||||
- time_t until = me->age + POSITIVE_TIMEOUT;
|
||||
+ time_t until = me->age + ap->positive_timeout;
|
||||
if ((long) age - (long) until < 0) {
|
||||
me = cache_enumerate(mc, me);
|
||||
continue;
|
||||
--- autofs-5.1.8.orig/daemon/master.c
|
||||
+++ autofs-5.1.8/daemon/master.c
|
||||
@@ -32,6 +32,7 @@ struct master *master_list = NULL;
|
||||
|
||||
extern const char *global_options;
|
||||
extern long global_negative_timeout;
|
||||
+extern long global_positive_timeout;
|
||||
|
||||
/* Attribute to create a joinable thread */
|
||||
extern pthread_attr_t th_attr;
|
||||
@@ -94,11 +95,16 @@ int master_add_autofs_point(struct maste
|
||||
/*
|
||||
* Program command line option overrides config.
|
||||
* We can't use 0 negative timeout so use default.
|
||||
+ * We can't use <0 positive timeout so use default.
|
||||
*/
|
||||
if (global_negative_timeout <= 0)
|
||||
ap->negative_timeout = defaults_get_negative_timeout();
|
||||
else
|
||||
ap->negative_timeout = global_negative_timeout;
|
||||
+ if (global_positive_timeout < 0)
|
||||
+ ap->positive_timeout = defaults_get_positive_timeout();
|
||||
+ else
|
||||
+ ap->positive_timeout = global_positive_timeout;
|
||||
ap->exp_timeout = defaults_get_timeout();
|
||||
ap->exp_runfreq = 0;
|
||||
ap->flags = 0;
|
||||
--- autofs-5.1.8.orig/daemon/master_parse.y
|
||||
+++ autofs-5.1.8/daemon/master_parse.y
|
||||
@@ -58,6 +58,7 @@ static char *type;
|
||||
static char *format;
|
||||
static long timeout;
|
||||
static long negative_timeout;
|
||||
+static long positive_timeout;
|
||||
static unsigned symlnk;
|
||||
static unsigned strictexpire;
|
||||
static unsigned nobind;
|
||||
@@ -112,7 +113,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_TIMEOUT OPT_NTIMEOUT OPT_PTIMEOUT OPT_NOBIND OPT_NOGHOST OPT_GHOST OPT_VERBOSE
|
||||
%token OPT_DEBUG OPT_RANDOM OPT_USE_WEIGHT OPT_SYMLINK OPT_MODE
|
||||
%token OPT_STRICTEXPIRE OPT_SHARED OPT_SLAVE OPT_PRIVATE
|
||||
%token COLON COMMA NL DDASH
|
||||
@@ -635,6 +636,7 @@ option: daemon_option
|
||||
|
||||
daemon_option: OPT_TIMEOUT NUMBER { timeout = $2; }
|
||||
| OPT_NTIMEOUT NUMBER { negative_timeout = $2; }
|
||||
+ | OPT_PTIMEOUT NUMBER { positive_timeout = $2; }
|
||||
| OPT_SYMLINK { symlnk = 1; }
|
||||
| OPT_STRICTEXPIRE { strictexpire = 1; }
|
||||
| OPT_SHARED { propagation = PROPAGATION_SHARED; }
|
||||
--- autofs-5.1.8.orig/include/automount.h
|
||||
+++ autofs-5.1.8/include/automount.h
|
||||
@@ -559,6 +559,7 @@ struct autofs_point {
|
||||
time_t exp_timeout; /* Indirect mount expire timeout */
|
||||
time_t exp_runfreq; /* Frequency for polling for timeouts */
|
||||
time_t negative_timeout; /* timeout in secs for failed mounts */
|
||||
+ time_t positive_timeout; /* timeout in secs for using cache for map entries */
|
||||
unsigned int flags; /* autofs mount flags */
|
||||
unsigned int logopt; /* Per map logging */
|
||||
pthread_t exp_thread; /* Thread that is expiring */
|
||||
--- autofs-5.1.8.orig/include/defaults.h
|
||||
+++ autofs-5.1.8/include/defaults.h
|
||||
@@ -27,6 +27,7 @@
|
||||
#define DEFAULT_TIMEOUT "600"
|
||||
#define DEFAULT_MASTER_WAIT "10"
|
||||
#define DEFAULT_NEGATIVE_TIMEOUT "60"
|
||||
+#define DEFAULT_POSITIVE_TIMEOUT "120"
|
||||
#define DEFAULT_MOUNT_VERBOSE "0"
|
||||
#define DEFAULT_MOUNT_WAIT "-1"
|
||||
#define DEFAULT_UMOUNT_WAIT "12"
|
||||
@@ -160,6 +161,7 @@ int defaults_master_set(void);
|
||||
unsigned int defaults_get_timeout(void);
|
||||
int defaults_get_master_wait(void);
|
||||
unsigned int defaults_get_negative_timeout(void);
|
||||
+unsigned int defaults_get_positive_timeout(void);
|
||||
unsigned int defaults_get_browse_mode(void);
|
||||
unsigned int defaults_get_logging(void);
|
||||
unsigned int defaults_force_std_prog_map_env(void);
|
||||
--- autofs-5.1.8.orig/lib/defaults.c
|
||||
+++ autofs-5.1.8/lib/defaults.c
|
||||
@@ -50,6 +50,7 @@
|
||||
#define NAME_TIMEOUT "timeout"
|
||||
#define NAME_MASTER_WAIT "master_wait"
|
||||
#define NAME_NEGATIVE_TIMEOUT "negative_timeout"
|
||||
+#define NAME_POSITIVE_TIMEOUT "positive_timeout"
|
||||
#define NAME_BROWSE_MODE "browse_mode"
|
||||
#define NAME_LOGGING "logging"
|
||||
#define NAME_FORCE_STD_PROG_MAP_ENV "force_standard_program_map_env"
|
||||
@@ -1703,6 +1704,17 @@ unsigned int defaults_get_negative_timeo
|
||||
return (unsigned int) n_timeout;
|
||||
}
|
||||
|
||||
+unsigned int defaults_get_positive_timeout(void)
|
||||
+{
|
||||
+ long p_timeout;
|
||||
+
|
||||
+ p_timeout = conf_get_number(autofs_gbl_sec, NAME_POSITIVE_TIMEOUT);
|
||||
+ if (p_timeout <= 0)
|
||||
+ p_timeout = atol(DEFAULT_POSITIVE_TIMEOUT);
|
||||
+
|
||||
+ return (unsigned int) p_timeout;
|
||||
+}
|
||||
+
|
||||
unsigned int defaults_get_browse_mode(void)
|
||||
{
|
||||
int res;
|
||||
--- autofs-5.1.8.orig/man/autofs.conf.5.in
|
||||
+++ autofs-5.1.8/man/autofs.conf.5.in
|
||||
@@ -43,6 +43,12 @@ Set the default timeout for caching fail
|
||||
60). If the equivalent command line option is given it will override this
|
||||
setting.
|
||||
.TP
|
||||
+.B positive_timeout
|
||||
+.br
|
||||
+Set the default timeout for using cached map entries (program default
|
||||
+120). If the equivalent command line option is given it will override this
|
||||
+setting.
|
||||
+.TP
|
||||
.B mount_verbose
|
||||
.br
|
||||
Use the verbose flag when spawning mount(8), and log some process info
|
||||
--- autofs-5.1.8.orig/redhat/autofs.conf.default.in
|
||||
+++ autofs-5.1.8/redhat/autofs.conf.default.in
|
||||
@@ -29,6 +29,11 @@ timeout = 300
|
||||
#
|
||||
#negative_timeout = 60
|
||||
#
|
||||
+# positive_timeout - set the default positive timeout for
|
||||
+# using cached map entries (default 120).
|
||||
+#
|
||||
+#positive_timeout = 120
|
||||
+#
|
||||
# mount_verbose - use the -v flag when calling mount(8) and log some
|
||||
# process information about the requestor and its
|
||||
# parent.
|
||||
--- autofs-5.1.8.orig/samples/autofs.conf.default.in
|
||||
+++ autofs-5.1.8/samples/autofs.conf.default.in
|
||||
@@ -29,6 +29,11 @@ timeout = 300
|
||||
#
|
||||
#negative_timeout = 60
|
||||
#
|
||||
+# positive_timeout - set the default positive timeout for
|
||||
+# using cached map entries (default 120).
|
||||
+#
|
||||
+#positive_timeout = 120
|
||||
+#
|
||||
# mount_verbose - use the -v flag when calling mount(8) and log some
|
||||
# process information about the requestor and its
|
||||
# parent.
|
@ -1,141 +0,0 @@
|
||||
autofs-5.1.8 - fix deadlock in lookups
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
After adding locking to fix a crash during lookups we're seeing a
|
||||
deadlock becuase of recursive calls.
|
||||
|
||||
But once the lookup is open we shouldn't need to open it again during
|
||||
the recursive call, fix it based on that.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1
|
||||
daemon/lookup.c | 62 +++++++++++++++++++++++++++++++++-------------------
|
||||
daemon/master.c | 8 ++++++
|
||||
include/master.h | 1
|
||||
modules/parse_amd.c | 2 -
|
||||
5 files changed, 51 insertions(+), 23 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -36,6 +36,7 @@
|
||||
- don't immediately call function when waiting.
|
||||
- fix return status of mount_autofs().
|
||||
- don't close lookup at umount.
|
||||
+- fix deadlock in lookups.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/lookup.c
|
||||
+++ autofs-5.1.8/daemon/lookup.c
|
||||
@@ -320,31 +320,49 @@ static int do_read_map(struct autofs_poi
|
||||
struct lookup_mod *lookup;
|
||||
int status;
|
||||
|
||||
- pthread_cleanup_push(map_module_lock_cleanup, map);
|
||||
- map_module_writelock(map);
|
||||
- if (!map->lookup) {
|
||||
- status = open_lookup(map->type, "", map->format,
|
||||
- map->argc, map->argv, &lookup);
|
||||
- if (status == NSS_STATUS_SUCCESS)
|
||||
- map->lookup = lookup;
|
||||
- else
|
||||
- debug(ap->logopt,
|
||||
- "lookup module %s open failed", map->type);
|
||||
- } else {
|
||||
- status = map->lookup->lookup_reinit(map->format,
|
||||
- map->argc, map->argv,
|
||||
- &map->lookup->context);
|
||||
- if (status)
|
||||
- warn(ap->logopt,
|
||||
- "lookup module %s reinit failed", map->type);
|
||||
- }
|
||||
- pthread_cleanup_pop(1);
|
||||
- if (status != NSS_STATUS_SUCCESS)
|
||||
- return status;
|
||||
-
|
||||
if (!map->stale)
|
||||
return NSS_STATUS_SUCCESS;
|
||||
|
||||
+ /* If this readmap is the result of trying to mount a submount
|
||||
+ * the readlock may already be held if the map is the same as
|
||||
+ * that of the caller. In that case the map has already been
|
||||
+ * read so just skip the map open/reinit.
|
||||
+ */
|
||||
+ status = map_module_try_writelock(map);
|
||||
+ if (status) {
|
||||
+ if (!map->lookup) {
|
||||
+ error(ap->logopt, "map module lock not held as expected");
|
||||
+ return NSS_STATUS_UNAVAIL;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (!map->lookup) {
|
||||
+ pthread_cleanup_push(map_module_lock_cleanup, map);
|
||||
+ status = open_lookup(map->type, "", map->format,
|
||||
+ map->argc, map->argv, &lookup);
|
||||
+ pthread_cleanup_pop(0);
|
||||
+ if (status != NSS_STATUS_SUCCESS) {
|
||||
+ map_module_unlock(map);
|
||||
+ debug(ap->logopt,
|
||||
+ "lookup module %s open failed", map->type);
|
||||
+ return status;
|
||||
+ }
|
||||
+ map->lookup = lookup;
|
||||
+ } else {
|
||||
+ pthread_cleanup_push(map_module_lock_cleanup, map);
|
||||
+ status = map->lookup->lookup_reinit(map->format,
|
||||
+ map->argc, map->argv,
|
||||
+ &map->lookup->context);
|
||||
+ pthread_cleanup_pop(0);
|
||||
+ if (status) {
|
||||
+ map_module_unlock(map);
|
||||
+ warn(ap->logopt,
|
||||
+ "lookup module %s reinit failed", map->type);
|
||||
+ return status;
|
||||
+ }
|
||||
+ }
|
||||
+ map_module_unlock(map);
|
||||
+ }
|
||||
+
|
||||
master_source_current_wait(ap->entry);
|
||||
ap->entry->current = map;
|
||||
|
||||
--- autofs-5.1.8.orig/daemon/master.c
|
||||
+++ autofs-5.1.8/daemon/master.c
|
||||
@@ -73,6 +73,14 @@ void map_module_writelock(struct map_sou
|
||||
fatal(status);
|
||||
}
|
||||
|
||||
+int map_module_try_writelock(struct map_source *map)
|
||||
+{
|
||||
+ int status = pthread_rwlock_trywrlock(&map->module_lock);
|
||||
+ if (status && status != EBUSY && status != EDEADLK)
|
||||
+ fatal(status);
|
||||
+ return status;
|
||||
+}
|
||||
+
|
||||
void map_module_readlock(struct map_source *map)
|
||||
{
|
||||
int status = pthread_rwlock_rdlock(&map->module_lock);
|
||||
--- autofs-5.1.8.orig/include/master.h
|
||||
+++ autofs-5.1.8/include/master.h
|
||||
@@ -128,6 +128,7 @@ int master_list_empty(struct master *);
|
||||
int master_done(struct master *);
|
||||
int master_kill(struct master *);
|
||||
void map_module_writelock(struct map_source *map);
|
||||
+int map_module_try_writelock(struct map_source *map);
|
||||
void map_module_readlock(struct map_source *map);
|
||||
void map_module_unlock(struct map_source *map);
|
||||
void map_module_lock_cleanup(void *arg);
|
||||
--- autofs-5.1.8.orig/modules/parse_amd.c
|
||||
+++ autofs-5.1.8/modules/parse_amd.c
|
||||
@@ -1391,7 +1391,7 @@ static int do_host_mount(struct autofs_p
|
||||
cache_unlock(source->mc);
|
||||
|
||||
master_source_current_wait(ap->entry);
|
||||
- ap->entry->current = source;
|
||||
+ ap->entry->current = instance;
|
||||
|
||||
map_module_readlock(instance);
|
||||
lookup = instance->lookup;
|
@ -1,169 +0,0 @@
|
||||
autofs-5.1.8 - fix deadlock with hosts map reload
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
When reloading maps the hosts map calls lookup method ->parse_mount()
|
||||
for each multi-mount root entry in the map (each host) while holding
|
||||
the cache read lock which leads to a cache lock deadlock.
|
||||
|
||||
Remove the need to hold the cache read lock by creating an independent
|
||||
list of entries for the update so the lock doesn't need to be taken.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1
|
||||
modules/lookup_hosts.c | 100 ++++++++++++++++++++++++++++++++++++++++---------
|
||||
2 files changed, 83 insertions(+), 18 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -24,6 +24,7 @@
|
||||
- serialise lookup module open and reinit.
|
||||
- coverity fix for invalid access.
|
||||
- fix hosts map deadlock on restart.
|
||||
+- fix deadlock with hosts map reload.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/modules/lookup_hosts.c
|
||||
+++ autofs-5.1.8/modules/lookup_hosts.c
|
||||
@@ -201,10 +201,72 @@ static int do_parse_mount(struct autofs_
|
||||
return NSS_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
+struct update_context {
|
||||
+ char *key;
|
||||
+ int key_len;
|
||||
+ char *entry;
|
||||
+ struct update_context *next;
|
||||
+};
|
||||
+
|
||||
+static int add_update_entry(struct update_context **entries, struct mapent *me)
|
||||
+{
|
||||
+ struct update_context *upd;
|
||||
+ char *key, *ent;
|
||||
+
|
||||
+ key = strdup(me->key);
|
||||
+ if (!key)
|
||||
+ return 0;
|
||||
+
|
||||
+ ent = strdup(me->mapent);
|
||||
+ if (!ent) {
|
||||
+ free(key);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ upd = malloc(sizeof(struct update_context));
|
||||
+ if (!upd) {
|
||||
+ free(ent);
|
||||
+ free(key);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ upd->key = key;
|
||||
+ upd->key_len = me->len;
|
||||
+ upd->entry = ent;
|
||||
+ upd->next = NULL;
|
||||
+ if (*entries)
|
||||
+ (*entries)->next = upd;
|
||||
+ *entries = upd;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static void free_update_entries(struct update_context *entries)
|
||||
+{
|
||||
+ struct update_context *this = entries;
|
||||
+
|
||||
+ while (this) {
|
||||
+ struct update_context *next = this->next;
|
||||
+ free(this->key);
|
||||
+ free(this->entry);
|
||||
+ free(this);
|
||||
+ this = next;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void entries_cleanup(void *arg)
|
||||
+{
|
||||
+ struct update_context *entries = arg;
|
||||
+
|
||||
+ free_update_entries(entries);
|
||||
+}
|
||||
+
|
||||
static void update_hosts_mounts(struct autofs_point *ap,
|
||||
struct map_source *source, time_t age,
|
||||
struct lookup_context *ctxt)
|
||||
{
|
||||
+ struct update_context *head = NULL;
|
||||
+ struct update_context *entries = NULL;
|
||||
struct mapent_cache *mc;
|
||||
struct mapent *me;
|
||||
char *mapent;
|
||||
@@ -212,6 +274,8 @@ static void update_hosts_mounts(struct a
|
||||
|
||||
mc = source->mc;
|
||||
|
||||
+ pthread_cleanup_push(entries_cleanup, head);
|
||||
+
|
||||
pthread_cleanup_push(cache_lock_cleanup, mc);
|
||||
cache_writelock(mc);
|
||||
me = cache_lookup_first(mc);
|
||||
@@ -224,39 +288,39 @@ static void update_hosts_mounts(struct a
|
||||
|
||||
mapent = get_exports(ap, me->key);
|
||||
if (mapent) {
|
||||
- cache_update(mc, source, me->key, mapent, age);
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = cache_update(mc, source, me->key, mapent, age);
|
||||
free(mapent);
|
||||
+ if (!IS_MM_ROOT(me))
|
||||
+ goto next;
|
||||
+ if (ret != CHE_FAIL) {
|
||||
+ if (!add_update_entry(&entries, me))
|
||||
+ warn(ap->logopt, MODPREFIX
|
||||
+ "failed to add update entry for %s", me->key);
|
||||
+ else if (!head)
|
||||
+ head = entries;
|
||||
+ }
|
||||
}
|
||||
next:
|
||||
me = cache_lookup_next(mc, me);
|
||||
}
|
||||
pthread_cleanup_pop(1);
|
||||
|
||||
- pthread_cleanup_push(cache_lock_cleanup, mc);
|
||||
- cache_readlock(mc);
|
||||
- me = cache_lookup_first(mc);
|
||||
- while (me) {
|
||||
- /*
|
||||
- * Hosts map entry not yet expanded, already expired
|
||||
- * or not the base of the tree
|
||||
- */
|
||||
- if (!IS_MM(me) || !IS_MM_ROOT(me))
|
||||
- goto cont;
|
||||
-
|
||||
+ while (head) {
|
||||
debug(ap->logopt, MODPREFIX
|
||||
- "attempt to update exports for %s", me->key);
|
||||
+ "attempt to update exports for %s", head->key);
|
||||
|
||||
master_source_current_wait(ap->entry);
|
||||
ap->entry->current = source;
|
||||
ap->flags |= MOUNT_FLAG_REMOUNT;
|
||||
- ret = ctxt->parse->parse_mount(ap, me->key, strlen(me->key),
|
||||
- me->mapent, ctxt->parse->context);
|
||||
+ ret = ctxt->parse->parse_mount(ap, head->key, strlen(head->key),
|
||||
+ head->entry, ctxt->parse->context);
|
||||
if (ret)
|
||||
warn(ap->logopt, MODPREFIX
|
||||
- "failed to parse mount %s", me->mapent);
|
||||
+ "failed to parse mount %s", head->entry);
|
||||
ap->flags &= ~MOUNT_FLAG_REMOUNT;
|
||||
-cont:
|
||||
- me = cache_lookup_next(mc, me);
|
||||
+ head = head->next;
|
||||
}
|
||||
pthread_cleanup_pop(1);
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
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.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -1,4 +1,5 @@
|
||||
- fix kernel mount status notificantion.
|
||||
+- fix fedfs build flags.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/fedfs/Makefile
|
||||
+++ autofs-5.1.8/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)
|
||||
|
@ -1,38 +0,0 @@
|
||||
autofs-5.1.8 - fix fix root offset error handling
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
The change to fix root offset error handlling is missing a cache read
|
||||
lock prior to the key lookup, the following unmatched unlock then
|
||||
causes a hang.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
daemon/direct.c | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 6f18a0bb..f81b0259 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -3,6 +3,7 @@
|
||||
- fix set open file limit.
|
||||
- improve descriptor open error reporting.
|
||||
- fix root offset error handling.
|
||||
+- fix fix root offset error handling.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
diff --git a/daemon/direct.c b/daemon/direct.c
|
||||
index 8810900c..cf3f24d7 100644
|
||||
--- a/daemon/direct.c
|
||||
+++ b/daemon/direct.c
|
||||
@@ -1275,6 +1275,7 @@ static void *do_mount_direct(void *arg)
|
||||
/* 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);
|
@ -1,116 +0,0 @@
|
||||
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(-)
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 5402b88d..72a5aa59 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -15,6 +15,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().
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
diff --git a/daemon/automount.c b/daemon/automount.c
|
||||
index 353e4f54..85847edf 100644
|
||||
--- a/daemon/automount.c
|
||||
+++ b/daemon/automount.c
|
||||
@@ -609,8 +609,7 @@ static int umount_subtree_mounts(struct autofs_point *ap, const char *path, unsi
|
||||
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;
|
||||
diff --git a/lib/mounts.c b/lib/mounts.c
|
||||
index 617c1d54..a3f9dfd7 100644
|
||||
--- a/lib/mounts.c
|
||||
+++ b/lib/mounts.c
|
||||
@@ -1869,8 +1869,7 @@ static int tree_mapent_umount_offset(struct mapent *oe, void *ptr)
|
||||
*/
|
||||
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 mapent *oe)
|
||||
*/
|
||||
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(struct autofs_point *ap, struct mapent *me)
|
||||
|
||||
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, const char *path)
|
||||
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, const char *path)
|
||||
* 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)
|
@ -1,97 +0,0 @@
|
||||
autofs-5.1.8 - fix hosts map deadlock on restart
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
When starting automount(8) with a hosts map that has mounts that were
|
||||
in use at the last exit a deadlock can occur.
|
||||
|
||||
In this case automount(8) will perform the same steps but not actually
|
||||
perform the mount to re-construct the context of each mount. But, with
|
||||
the hosts map, that leads to calling back into the sun parse module
|
||||
while holding the map module read lock which will again try and take
|
||||
the write lock.
|
||||
|
||||
Fix this by only taking the write lock in the mount code path if the
|
||||
module handle has not already been opened.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
daemon/lookup.c | 22 ++++++++++++----------
|
||||
modules/parse_amd.c | 18 ++++++++++--------
|
||||
3 files changed, 23 insertions(+), 18 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -23,6 +23,7 @@
|
||||
- fix parse module instance mutex naming.
|
||||
- serialise lookup module open and reinit.
|
||||
- coverity fix for invalid access.
|
||||
+- fix hosts map deadlock on restart.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/lookup.c
|
||||
+++ autofs-5.1.8/daemon/lookup.c
|
||||
@@ -809,19 +809,21 @@ int do_lookup_mount(struct autofs_point
|
||||
struct lookup_mod *lookup;
|
||||
int status;
|
||||
|
||||
- map_module_writelock(map);
|
||||
if (!map->lookup) {
|
||||
- status = open_lookup(map->type, "",
|
||||
- map->format, map->argc, map->argv, &lookup);
|
||||
- if (status != NSS_STATUS_SUCCESS) {
|
||||
- map_module_unlock(map);
|
||||
- debug(ap->logopt,
|
||||
- "lookup module %s open failed", map->type);
|
||||
- return status;
|
||||
+ map_module_writelock(map);
|
||||
+ if (!map->lookup) {
|
||||
+ status = open_lookup(map->type, "",
|
||||
+ map->format, map->argc, map->argv, &lookup);
|
||||
+ if (status != NSS_STATUS_SUCCESS) {
|
||||
+ map_module_unlock(map);
|
||||
+ debug(ap->logopt,
|
||||
+ "lookup module %s open failed", map->type);
|
||||
+ return status;
|
||||
+ }
|
||||
+ map->lookup = lookup;
|
||||
}
|
||||
- map->lookup = lookup;
|
||||
+ map_module_unlock(map);
|
||||
}
|
||||
- map_module_unlock(map);
|
||||
|
||||
master_source_current_wait(ap->entry);
|
||||
ap->entry->current = map;
|
||||
--- autofs-5.1.8.orig/modules/parse_amd.c
|
||||
+++ autofs-5.1.8/modules/parse_amd.c
|
||||
@@ -1370,17 +1370,19 @@ static int do_host_mount(struct autofs_p
|
||||
}
|
||||
}
|
||||
|
||||
- map_module_writelock(instance);
|
||||
if (!instance->lookup) {
|
||||
- status = open_lookup("hosts", MODPREFIX, NULL, argc, pargv, &lookup);
|
||||
- if (status != NSS_STATUS_SUCCESS) {
|
||||
- map_module_unlock(instance);
|
||||
- debug(ap->logopt, "open lookup module hosts failed");
|
||||
- goto out;
|
||||
+ map_module_writelock(instance);
|
||||
+ if (!instance->lookup) {
|
||||
+ status = open_lookup("hosts", MODPREFIX, NULL, argc, pargv, &lookup);
|
||||
+ if (status != NSS_STATUS_SUCCESS) {
|
||||
+ map_module_unlock(instance);
|
||||
+ debug(ap->logopt, "open lookup module hosts failed");
|
||||
+ goto out;
|
||||
+ }
|
||||
+ instance->lookup = lookup;
|
||||
}
|
||||
- instance->lookup = lookup;
|
||||
+ map_module_unlock(instance);
|
||||
}
|
||||
- map_module_unlock(instance);
|
||||
|
||||
cache_writelock(source->mc);
|
||||
me = cache_lookup_distinct(source->mc, name);
|
@ -1,63 +0,0 @@
|
||||
autofs-5.1.8 - fix incorrect path for is_mounted() in try_remount()
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
A regression was introduced when the offset mount handling was rewritten.
|
||||
|
||||
It resulted in an incorrect path sometimes being used in an is_mounted()
|
||||
check.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
lib/mounts.c | 26 +++++++++++++++++++++-----
|
||||
2 files changed, 22 insertions(+), 5 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -27,6 +27,7 @@
|
||||
- fix deadlock with hosts map reload.
|
||||
- fix memory leak in update_hosts_mounts().
|
||||
- fix minus only option handling in concat_options().
|
||||
+- fix incorrect path for is_mounted() in try_remount().
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/lib/mounts.c
|
||||
+++ autofs-5.1.8/lib/mounts.c
|
||||
@@ -2803,14 +2803,30 @@ int try_remount(struct autofs_point *ap,
|
||||
ap->flags &= ~MOUNT_FLAG_DIR_CREATED;
|
||||
else
|
||||
ap->flags |= MOUNT_FLAG_DIR_CREATED;
|
||||
+ goto done;
|
||||
+ }
|
||||
+
|
||||
+ me->flags &= ~MOUNT_FLAG_DIR_CREATED;
|
||||
+ /* Direct or offset mount, key is full path */
|
||||
+ if (MM_PARENT(me)->key[0] == '/') {
|
||||
+ if (!is_mounted(MM_PARENT(me)->key, MNTS_REAL))
|
||||
+ me->flags |= MOUNT_FLAG_DIR_CREATED;
|
||||
} else {
|
||||
- me->flags &= ~MOUNT_FLAG_DIR_CREATED;
|
||||
- if (type == t_offset) {
|
||||
- if (!is_mounted(MM_PARENT(me)->key, MNTS_REAL))
|
||||
- me->flags |= MOUNT_FLAG_DIR_CREATED;
|
||||
+ char *p_key = MM_PARENT(me)->key;
|
||||
+ char mp[PATH_MAX + 1];
|
||||
+ int len;
|
||||
+
|
||||
+ len = mount_fullpath(mp, PATH_MAX, ap->path, ap->len, p_key);
|
||||
+ if (len > PATH_MAX) {
|
||||
+ /* This should never happen due to earlier checks */
|
||||
+ error(ap->logopt, "mountpoint path too long");
|
||||
+ return 0;
|
||||
}
|
||||
- }
|
||||
|
||||
+ if (!is_mounted(mp, MNTS_REAL))
|
||||
+ me->flags |= MOUNT_FLAG_DIR_CREATED;
|
||||
+ }
|
||||
+done:
|
||||
/*
|
||||
* Either we opened the mount or we're re-reading the map.
|
||||
* If we opened the mount and ioctlfd is not -1 we have
|
@ -1,46 +0,0 @@
|
||||
autofs-5.1.8 - fix invalid tsv access
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
When using the --dumpmaps option of automount(8) a SEGV can occur
|
||||
because a thread specific data variable accessed in the code hasn't
|
||||
yet been created.
|
||||
|
||||
The thread specific data doesn't need to be set to list the maps
|
||||
so we can create the key and rely on pthread_getspecific() returning
|
||||
NULL when the value hasn't been set as this case is handled correctly.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
daemon/automount.c | 9 +++++++++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -18,6 +18,7 @@
|
||||
- fix handling of incorrect return from umount_ent().
|
||||
- dont use initgroups() at spawn.
|
||||
- fix missing unlock in sasl_do_kinit_ext_cc().
|
||||
+- fix invalid tsv access.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/automount.c
|
||||
+++ autofs-5.1.8/daemon/automount.c
|
||||
@@ -2521,6 +2521,15 @@ int main(int argc, char *argv[])
|
||||
master = argv[2];
|
||||
}
|
||||
|
||||
+ status = pthread_key_create(&key_thread_stdenv_vars,
|
||||
+ key_thread_stdenv_vars_destroy);
|
||||
+ if (status) {
|
||||
+ logerr("%s: failed to create thread data key for std env vars!",
|
||||
+ program);
|
||||
+ macro_free_global_table();
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
if (master)
|
||||
master_list = master_new(NULL, timeout, flags);
|
||||
else
|
@ -1,139 +0,0 @@
|
||||
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 | 2 ++
|
||||
daemon/direct.c | 19 +++++++++++--------
|
||||
daemon/indirect.c | 19 +++++++++++--------
|
||||
3 files changed, 24 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 3be6119a..9d92229a 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -1,3 +1,5 @@
|
||||
+- fix kernel mount status notificantion.
|
||||
+
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
- remove mount.x and rpcgen dependencies.
|
||||
diff --git a/daemon/direct.c b/daemon/direct.c
|
||||
index 4a56486b..c2331155 100644
|
||||
--- a/daemon/direct.c
|
||||
+++ b/daemon/direct.c
|
||||
@@ -1147,12 +1147,18 @@ int handle_packet_expire_direct(struct autofs_point *ap, autofs_packet_expire_di
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -1181,7 +1187,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);
|
||||
|
||||
@@ -1195,9 +1202,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);
|
||||
}
|
||||
@@ -1207,8 +1212,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);
|
||||
}
|
||||
diff --git a/daemon/indirect.c b/daemon/indirect.c
|
||||
index b73c2781..23ef9f41 100644
|
||||
--- a/daemon/indirect.c
|
||||
+++ b/daemon/indirect.c
|
||||
@@ -683,13 +683,18 @@ int handle_packet_expire_indirect(struct autofs_point *ap, autofs_packet_expire_
|
||||
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)
|
||||
@@ -718,7 +723,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);
|
||||
|
||||
@@ -731,9 +737,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);
|
||||
}
|
||||
@@ -742,7 +746,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);
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
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(-)
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index aaf20cd6..b4b064ff 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -6,6 +6,7 @@
|
||||
- fix 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().
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
diff --git a/lib/cache.c b/lib/cache.c
|
||||
index 66dda5d9..8aed28ea 100644
|
||||
--- a/lib/cache.c
|
||||
+++ b/lib/cache.c
|
||||
@@ -710,7 +710,7 @@ struct mapent *cache_get_offset_parent(struct mapent_cache *mc, const char *key)
|
||||
*tail = 0;
|
||||
|
||||
tail--;
|
||||
- if (tail == parent)
|
||||
+ if (tail <= parent)
|
||||
break;
|
||||
|
||||
me = cache_lookup_distinct(mc, parent);
|
@ -1,53 +0,0 @@
|
||||
autofs-5.1.8 - fix memory leak in update_hosts_mounts()
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Coverity has reported a memory leak in update_hosts_mounts() introduced
|
||||
by the map reload deadlock fix.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
modules/lookup_hosts.c | 13 +++++++------
|
||||
2 files changed, 8 insertions(+), 6 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -25,6 +25,7 @@
|
||||
- coverity fix for invalid access.
|
||||
- fix hosts map deadlock on restart.
|
||||
- fix deadlock with hosts map reload.
|
||||
+- fix memory leak in update_hosts_mounts().
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/modules/lookup_hosts.c
|
||||
+++ autofs-5.1.8/modules/lookup_hosts.c
|
||||
@@ -307,20 +307,21 @@ next:
|
||||
}
|
||||
pthread_cleanup_pop(1);
|
||||
|
||||
- while (head) {
|
||||
+ entries = head;
|
||||
+ while (entries) {
|
||||
debug(ap->logopt, MODPREFIX
|
||||
- "attempt to update exports for %s", head->key);
|
||||
+ "attempt to update exports for %s", entries->key);
|
||||
|
||||
master_source_current_wait(ap->entry);
|
||||
ap->entry->current = source;
|
||||
ap->flags |= MOUNT_FLAG_REMOUNT;
|
||||
- ret = ctxt->parse->parse_mount(ap, head->key, strlen(head->key),
|
||||
- head->entry, ctxt->parse->context);
|
||||
+ ret = ctxt->parse->parse_mount(ap, entries->key, strlen(entries->key),
|
||||
+ entries->entry, ctxt->parse->context);
|
||||
if (ret)
|
||||
warn(ap->logopt, MODPREFIX
|
||||
- "failed to parse mount %s", head->entry);
|
||||
+ "failed to parse mount %s", entries->entry);
|
||||
ap->flags &= ~MOUNT_FLAG_REMOUNT;
|
||||
- head = head->next;
|
||||
+ entries = entries->next;
|
||||
}
|
||||
pthread_cleanup_pop(1);
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
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(-)
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index f05c9c6b..9d57a21b 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -11,6 +11,7 @@
|
||||
- fix nfsv4 only mounts should not use rpcbind.
|
||||
- simplify cache_add() a little.
|
||||
- fix use after free in tree_mapent_delete_offset_tree().
|
||||
+- fix memory leak in xdr_exports().
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
diff --git a/lib/rpc_subs.c b/lib/rpc_subs.c
|
||||
index ee7f94b9..0c833af0 100644
|
||||
--- a/lib/rpc_subs.c
|
||||
+++ b/lib/rpc_subs.c
|
||||
@@ -1151,8 +1151,13 @@ bool_t xdr_exports(XDR *xdrs, struct exportinfo **exports)
|
||||
|
||||
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;
|
@ -1,88 +0,0 @@
|
||||
autofs-5.1.8 - fix minus only option handling in concat_options()
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
While a '-' alone isn't strictly valid it hadn't previously cuased a
|
||||
parse error. So commit 9047e91ffa69 (autofs-5.1.7 - fix concat_options()
|
||||
error handling) introduced a regression by no longer allowing this.
|
||||
|
||||
Fix this regression by only failing if errno is set to a non-zero value
|
||||
on return from concat_options() as well as returning NULL.
|
||||
|
||||
Fixes: 9047e91ffa69 (autofs-5.1.7 - fix concat_options() error handling)
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
modules/parse_sun.c | 25 +++++++++++++++++++------
|
||||
2 files changed, 20 insertions(+), 6 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -26,6 +26,7 @@
|
||||
- fix hosts map deadlock on restart.
|
||||
- fix deadlock with hosts map reload.
|
||||
- fix memory leak in update_hosts_mounts().
|
||||
+- fix minus only option handling in concat_options().
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/modules/parse_sun.c
|
||||
+++ autofs-5.1.8/modules/parse_sun.c
|
||||
@@ -376,10 +376,16 @@ static int do_init(int argc, const char
|
||||
if (gbl_options) {
|
||||
append_options = defaults_get_append_options();
|
||||
if (append_options) {
|
||||
- char *tmp = concat_options(gbl_options, ctxt->optstr);
|
||||
+ char *tmp;
|
||||
+
|
||||
+ errno = 0;
|
||||
+ tmp = concat_options(gbl_options, ctxt->optstr);
|
||||
if (!tmp) {
|
||||
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- logerr(MODPREFIX "concat_options: %s", estr);
|
||||
+ /* Ignore non-error NULL return */
|
||||
+ if (errno) {
|
||||
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
+ logerr(MODPREFIX "concat_options: %s", estr);
|
||||
+ }
|
||||
/* freed in concat_options */
|
||||
ctxt->optstr = NULL;
|
||||
} else
|
||||
@@ -1007,9 +1013,12 @@ static int parse_mapent(const char *ent,
|
||||
free(myoptions);
|
||||
myoptions = newopt;
|
||||
} else if (newopt) {
|
||||
+ errno = 0;
|
||||
tmp = concat_options(myoptions, newopt);
|
||||
- if (!tmp) {
|
||||
+ /* Ignore non-error NULL return */
|
||||
+ if (!tmp && errno) {
|
||||
char *estr;
|
||||
+
|
||||
estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
error(logopt, MODPREFIX
|
||||
"concat_options: %s", estr);
|
||||
@@ -1381,8 +1390,10 @@ dont_expand:
|
||||
free(mnt_options);
|
||||
mnt_options = noptions;
|
||||
} else if (noptions) {
|
||||
+ errno = 0;
|
||||
tmp = concat_options(mnt_options, noptions);
|
||||
- if (!tmp) {
|
||||
+ /* Ignore non-error NULL return */
|
||||
+ if (!tmp && errno) {
|
||||
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
error(ap->logopt,
|
||||
MODPREFIX "concat_options: %s", estr);
|
||||
@@ -1406,8 +1417,10 @@ dont_expand:
|
||||
free(options);
|
||||
options = mnt_options;
|
||||
} else if (mnt_options) {
|
||||
+ errno = 0;
|
||||
tmp = concat_options(options, mnt_options);
|
||||
- if (!tmp) {
|
||||
+ /* Ignore non-error NULL return */
|
||||
+ if (!tmp && errno) {
|
||||
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
error(ap->logopt, MODPREFIX "concat_options: %s", estr);
|
||||
free(pmapent);
|
@ -1,37 +0,0 @@
|
||||
autofs-5.1.8 - fix missing unlock in sasl_do_kinit_ext_cc()
|
||||
|
||||
From: James Dingwall <james-autofs@dingwall.me.uk>
|
||||
|
||||
There is a missing mutex unlock in function sasl_do_kinit_ext_cc(),
|
||||
fix it.
|
||||
|
||||
Signed-off-by: James Dingwall <james-autofs@dingwall.me.uk>
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
modules/cyrus-sasl.c | 4 ++++
|
||||
2 files changed, 5 insertions(+)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -17,6 +17,7 @@
|
||||
- remove nonstrict parameter from tree_mapent_umount_offsets().
|
||||
- fix handling of incorrect return from umount_ent().
|
||||
- dont use initgroups() at spawn.
|
||||
+- fix missing unlock in sasl_do_kinit_ext_cc().
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/modules/cyrus-sasl.c
|
||||
+++ autofs-5.1.8/modules/cyrus-sasl.c
|
||||
@@ -721,6 +721,10 @@ sasl_do_kinit_ext_cc(unsigned logopt, st
|
||||
|
||||
debug(logopt, "Kerberos authentication was successful!");
|
||||
|
||||
+ status = pthread_mutex_unlock(&krb5cc_mutex);
|
||||
+ if (status)
|
||||
+ fatal(status);
|
||||
+
|
||||
return 0;
|
||||
|
||||
out_cleanup_def_princ:
|
@ -1,54 +0,0 @@
|
||||
autofs-5.1.8 - fix mount tree startup reconnect
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
When reconnecting to an existing mount tree at startup trying to work
|
||||
out if we created the mountpoint directory uses the parent path of the
|
||||
current map entry.
|
||||
|
||||
But if the current map entry has no parent we should use the map entry
|
||||
path.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
lib/mounts.c | 8 +++++---
|
||||
2 files changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -47,6 +47,7 @@
|
||||
- add command pipe handling functions.
|
||||
- switch to application wide command pipe.
|
||||
- get rid of unused field submnt_count.
|
||||
+- fix mount tree startup reconnect.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/lib/mounts.c
|
||||
+++ autofs-5.1.8/lib/mounts.c
|
||||
@@ -2807,6 +2807,7 @@ static int remount_active_mount(struct a
|
||||
int try_remount(struct autofs_point *ap, struct mapent *me, unsigned int type)
|
||||
{
|
||||
struct ioctl_ops *ops = get_ioctl_ops();
|
||||
+ struct mapent *mapent;
|
||||
const char *path;
|
||||
int ret, fd;
|
||||
dev_t devid;
|
||||
@@ -2841,12 +2842,13 @@ int try_remount(struct autofs_point *ap,
|
||||
}
|
||||
|
||||
me->flags &= ~MOUNT_FLAG_DIR_CREATED;
|
||||
+ mapent = IS_MM(me) ? MM_PARENT(me) : me;
|
||||
/* Direct or offset mount, key is full path */
|
||||
- if (MM_PARENT(me)->key[0] == '/') {
|
||||
- if (!is_mounted(MM_PARENT(me)->key, MNTS_REAL))
|
||||
+ if (mapent->key[0] == '/') {
|
||||
+ if (!is_mounted(mapent->key, MNTS_REAL))
|
||||
me->flags |= MOUNT_FLAG_DIR_CREATED;
|
||||
} else {
|
||||
- char *p_key = MM_PARENT(me)->key;
|
||||
+ char *p_key = mapent->key;
|
||||
char mp[PATH_MAX + 1];
|
||||
int len;
|
||||
|
@ -1,102 +0,0 @@
|
||||
autofs-5.1.8 - fix nfsv4 only mounts should not use rpcbind
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Commit 606795ecfaa1 ("autofs-5.1.7 - also require TCP_REQUESTED when
|
||||
setting NFS port" together with commit 26fb6b5408be) caused NFSv4 only
|
||||
mounts to also use rpcbind to probe availability which breaks the
|
||||
requirememt that this type of mount not use rpcbind at all.
|
||||
|
||||
Fix this by treating fstype=nfs4 mounts as a special case which doesn't
|
||||
use rpcbind.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
include/replicated.h | 2 ++
|
||||
modules/mount_nfs.c | 13 +++++++------
|
||||
modules/replicated.c | 4 ++--
|
||||
4 files changed, 12 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 575f186d..4e5e82d0 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -8,6 +8,7 @@
|
||||
- dont fail on duplicate offset entry tree add.
|
||||
- fix loop under run in cache_get_offset_parent().
|
||||
- bailout on rpc systemerror.
|
||||
+- fix nfsv4 only mounts should not use rpcbind.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
diff --git a/include/replicated.h b/include/replicated.h
|
||||
index 95ff1f0d..f889a56a 100644
|
||||
--- a/include/replicated.h
|
||||
+++ b/include/replicated.h
|
||||
@@ -35,6 +35,8 @@
|
||||
#define NFS3_REQUESTED NFS3_SUPPORTED
|
||||
#define NFS4_REQUESTED NFS4_SUPPORTED
|
||||
|
||||
+#define NFS4_ONLY_REQUESTED 0x0800
|
||||
+
|
||||
#define TCP_SUPPORTED 0x0001
|
||||
#define UDP_SUPPORTED 0x0002
|
||||
#define TCP_REQUESTED TCP_SUPPORTED
|
||||
diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c
|
||||
index 0ab87dcf..feb5afcd 100644
|
||||
--- a/modules/mount_nfs.c
|
||||
+++ b/modules/mount_nfs.c
|
||||
@@ -92,7 +92,7 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
||||
mount_default_proto = defaults_get_mount_nfs_default_proto();
|
||||
vers = NFS_VERS_DEFAULT | NFS_PROTO_DEFAULT;
|
||||
if (strcmp(fstype, "nfs4") == 0)
|
||||
- vers = NFS4_VERS_DEFAULT | TCP_SUPPORTED;
|
||||
+ vers = NFS4_VERS_DEFAULT | TCP_SUPPORTED | NFS4_ONLY_REQUESTED;
|
||||
else if (mount_default_proto == 4)
|
||||
vers = vers | NFS4_VERS_DEFAULT;
|
||||
|
||||
@@ -157,15 +157,16 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
|
||||
} else {
|
||||
/* Is any version of NFSv4 in the options */
|
||||
if (_strncmp("vers=4", cp, 6) == 0 ||
|
||||
- _strncmp("nfsvers=4", cp, 9) == 0)
|
||||
- vers = NFS4_VERS_MASK | TCP_SUPPORTED;
|
||||
- else if (_strncmp("vers=3", cp, o_len) == 0 ||
|
||||
+ _strncmp("nfsvers=4", cp, 9) == 0) {
|
||||
+ vers &= ~(NFS_VERS_MASK);
|
||||
+ vers |= NFS4_VERS_MASK | TCP_SUPPORTED | NFS4_ONLY_REQUESTED;
|
||||
+ } else if (_strncmp("vers=3", cp, o_len) == 0 ||
|
||||
_strncmp("nfsvers=3", cp, o_len) == 0) {
|
||||
- vers &= ~(NFS4_VERS_MASK | NFS_VERS_MASK);
|
||||
+ vers &= ~(NFS4_VERS_MASK | NFS_VERS_MASK | NFS4_ONLY_REQUESTED);
|
||||
vers |= NFS3_REQUESTED;
|
||||
} else if (_strncmp("vers=2", cp, o_len) == 0 ||
|
||||
_strncmp("nfsvers=2", cp, o_len) == 0) {
|
||||
- vers &= ~(NFS4_VERS_MASK | NFS_VERS_MASK);
|
||||
+ vers &= ~(NFS4_VERS_MASK | NFS_VERS_MASK | NFS4_ONLY_REQUESTED);
|
||||
vers |= NFS2_REQUESTED;
|
||||
} else if (strstr(cp, "port=") == cp &&
|
||||
o_len - 5 < 25) {
|
||||
diff --git a/modules/replicated.c b/modules/replicated.c
|
||||
index 09075dd0..cdb7c617 100644
|
||||
--- a/modules/replicated.c
|
||||
+++ b/modules/replicated.c
|
||||
@@ -291,7 +291,7 @@ static unsigned int get_nfs_info(unsigned logopt, struct host *host,
|
||||
|
||||
rpc_info->proto = proto;
|
||||
if (port < 0) {
|
||||
- if ((version & NFS4_REQUESTED) && (version & TCP_REQUESTED))
|
||||
+ if (version & NFS4_REQUESTED && (version & NFS4_ONLY_REQUESTED))
|
||||
rpc_info->port = NFS_PORT;
|
||||
else
|
||||
port = 0;
|
||||
@@ -525,7 +525,7 @@ static int get_vers_and_cost(unsigned logopt, struct host *host,
|
||||
{
|
||||
struct conn_info pm_info, rpc_info;
|
||||
time_t timeout = RPC_TIMEOUT;
|
||||
- unsigned int supported, vers = (NFS_VERS_MASK | NFS4_VERS_MASK);
|
||||
+ unsigned int supported, vers = (NFS_VERS_MASK | NFS4_VERS_MASK | NFS4_ONLY_REQUESTED);
|
||||
int ret = 0;
|
||||
|
||||
if (!check_address_proto(logopt, host, version))
|
@ -1,42 +0,0 @@
|
||||
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(-)
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index f81b0259..bd1f672c 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -4,6 +4,7 @@
|
||||
- improve descriptor open error reporting.
|
||||
- fix root offset error handling.
|
||||
- fix fix root offset error handling.
|
||||
+- fix nonstrict fail handling of last offset mount.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
diff --git a/lib/mounts.c b/lib/mounts.c
|
||||
index 39b7fe81..b4229908 100644
|
||||
--- a/lib/mounts.c
|
||||
+++ b/lib/mounts.c
|
||||
@@ -1940,7 +1940,7 @@ static int tree_mapent_mount_offsets_work(struct tree_node *n, void *ptr)
|
||||
tree_mapent_mount_offsets(oe, !ctxt->strict);
|
||||
}
|
||||
|
||||
- return ret;
|
||||
+ return (ctxt->strict ? ret : 1);
|
||||
}
|
||||
|
||||
int tree_mapent_mount_offsets(struct mapent *oe, int nonstrict)
|
@ -1,183 +0,0 @@
|
||||
autofs-5.1.8 - fix parse module instance mutex naming
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
The naming used for parse module instance locks is the same as that
|
||||
used for map lookup instances. Rename these to make it clear they
|
||||
are being used in the parse modules.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
modules/parse_amd.c | 28 ++++++++++++++--------------
|
||||
modules/parse_sun.c | 20 ++++++++++----------
|
||||
3 files changed, 25 insertions(+), 24 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -20,6 +20,7 @@
|
||||
- fix missing unlock in sasl_do_kinit_ext_cc().
|
||||
- fix invalid tsv access.
|
||||
- fix autofs regression due to positive_timeout.
|
||||
+- fix parse module instance mutex naming.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/modules/parse_amd.c
|
||||
+++ autofs-5.1.8/modules/parse_amd.c
|
||||
@@ -39,18 +39,18 @@ int parse_version = AUTOFS_PARSE_VERSION
|
||||
|
||||
static struct mount_mod *mount_nfs = NULL;
|
||||
static int init_ctr = 0;
|
||||
-static pthread_mutex_t instance_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
+static pthread_mutex_t parse_instance_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
-static void instance_mutex_lock(void)
|
||||
+static void parse_instance_mutex_lock(void)
|
||||
{
|
||||
- int status = pthread_mutex_lock(&instance_mutex);
|
||||
+ int status = pthread_mutex_lock(&parse_instance_mutex);
|
||||
if (status)
|
||||
fatal(status);
|
||||
}
|
||||
|
||||
-static void instance_mutex_unlock(void)
|
||||
+static void parse_instance_mutex_unlock(void)
|
||||
{
|
||||
- int status = pthread_mutex_unlock(&instance_mutex);
|
||||
+ int status = pthread_mutex_unlock(&parse_instance_mutex);
|
||||
if (status)
|
||||
fatal(status);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ int parse_init(int argc, const char *con
|
||||
|
||||
/* We only need this once. NFS mounts are so common that we cache
|
||||
this module. */
|
||||
- instance_mutex_lock();
|
||||
+ parse_instance_mutex_lock();
|
||||
if (mount_nfs)
|
||||
init_ctr++;
|
||||
else {
|
||||
@@ -121,11 +121,11 @@ int parse_init(int argc, const char *con
|
||||
} else {
|
||||
kill_context(ctxt);
|
||||
*context = NULL;
|
||||
- instance_mutex_unlock();
|
||||
+ parse_instance_mutex_unlock();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
- instance_mutex_unlock();
|
||||
+ parse_instance_mutex_unlock();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1358,11 +1358,11 @@ static int do_host_mount(struct autofs_p
|
||||
argc = 1;
|
||||
}
|
||||
|
||||
- instance_mutex_lock();
|
||||
+ parse_instance_mutex_lock();
|
||||
status = open_lookup("hosts", MODPREFIX, NULL, argc, pargv, &lookup);
|
||||
if (status != NSS_STATUS_SUCCESS) {
|
||||
debug(ap->logopt, "open lookup module hosts failed");
|
||||
- instance_mutex_unlock();
|
||||
+ parse_instance_mutex_unlock();
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -1374,13 +1374,13 @@ static int do_host_mount(struct autofs_p
|
||||
if (!instance) {
|
||||
error(ap->logopt, MODPREFIX
|
||||
"failed to create source instance for hosts map");
|
||||
- instance_mutex_unlock();
|
||||
+ parse_instance_mutex_unlock();
|
||||
close_lookup(lookup);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
instance->lookup = lookup;
|
||||
- instance_mutex_unlock();
|
||||
+ parse_instance_mutex_unlock();
|
||||
|
||||
cache_writelock(source->mc);
|
||||
me = cache_lookup_distinct(source->mc, name);
|
||||
@@ -2373,12 +2373,12 @@ int parse_done(void *context)
|
||||
int rv = 0;
|
||||
struct parse_context *ctxt = (struct parse_context *) context;
|
||||
|
||||
- instance_mutex_lock();
|
||||
+ parse_instance_mutex_lock();
|
||||
if (--init_ctr == 0) {
|
||||
rv = close_mount(mount_nfs);
|
||||
mount_nfs = NULL;
|
||||
}
|
||||
- instance_mutex_unlock();
|
||||
+ parse_instance_mutex_unlock();
|
||||
if (ctxt)
|
||||
kill_context(ctxt);
|
||||
|
||||
--- autofs-5.1.8.orig/modules/parse_sun.c
|
||||
+++ autofs-5.1.8/modules/parse_sun.c
|
||||
@@ -41,18 +41,18 @@ int parse_version = AUTOFS_PARSE_VERSION
|
||||
|
||||
static struct mount_mod *mount_nfs = NULL;
|
||||
static int init_ctr = 0;
|
||||
-static pthread_mutex_t instance_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
+static pthread_mutex_t parse_instance_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
-static void instance_mutex_lock(void)
|
||||
+static void parse_instance_mutex_lock(void)
|
||||
{
|
||||
- int status = pthread_mutex_lock(&instance_mutex);
|
||||
+ int status = pthread_mutex_lock(&parse_instance_mutex);
|
||||
if (status)
|
||||
fatal(status);
|
||||
}
|
||||
|
||||
-static void instance_mutex_unlock(void)
|
||||
+static void parse_instance_mutex_unlock(void)
|
||||
{
|
||||
- int status = pthread_mutex_unlock(&instance_mutex);
|
||||
+ int status = pthread_mutex_unlock(&parse_instance_mutex);
|
||||
if (status)
|
||||
fatal(status);
|
||||
}
|
||||
@@ -424,7 +424,7 @@ int parse_init(int argc, const char *con
|
||||
|
||||
/* We only need this once. NFS mounts are so common that we cache
|
||||
this module. */
|
||||
- instance_mutex_lock();
|
||||
+ parse_instance_mutex_lock();
|
||||
if (mount_nfs)
|
||||
init_ctr++;
|
||||
else {
|
||||
@@ -432,11 +432,11 @@ int parse_init(int argc, const char *con
|
||||
init_ctr++;
|
||||
} else {
|
||||
kill_context(ctxt);
|
||||
- instance_mutex_unlock();
|
||||
+ parse_instance_mutex_unlock();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
- instance_mutex_unlock();
|
||||
+ parse_instance_mutex_unlock();
|
||||
|
||||
*context = (void *) ctxt;
|
||||
|
||||
@@ -1728,12 +1728,12 @@ int parse_done(void *context)
|
||||
int rv = 0;
|
||||
struct parse_context *ctxt = (struct parse_context *) context;
|
||||
|
||||
- instance_mutex_lock();
|
||||
+ parse_instance_mutex_lock();
|
||||
if (--init_ctr == 0) {
|
||||
rv = close_mount(mount_nfs);
|
||||
mount_nfs = NULL;
|
||||
}
|
||||
- instance_mutex_unlock();
|
||||
+ parse_instance_mutex_unlock();
|
||||
if (ctxt)
|
||||
kill_context(ctxt);
|
||||
|
@ -1,43 +0,0 @@
|
||||
autofs-5.1.8 - fix return status of mount_autofs()
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
The function mount_autofs() collects the status of mounting an autofs
|
||||
file system but doesn't actually return it.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
daemon/automount.c | 4 ++--
|
||||
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -34,6 +34,7 @@
|
||||
- fail on empty replicated host name.
|
||||
- improve handling of ENOENT in sss setautomntent().
|
||||
- don't immediately call function when waiting.
|
||||
+- fix return status of mount_autofs().
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/automount.c
|
||||
+++ autofs-5.1.8/daemon/automount.c
|
||||
@@ -1225,7 +1225,7 @@ static int autofs_init_ap(struct autofs_
|
||||
|
||||
static int mount_autofs(struct autofs_point *ap, const char *root)
|
||||
{
|
||||
- int status = 0;
|
||||
+ int status;
|
||||
|
||||
/* No need to create comms fds and command fifo if
|
||||
* unlinking mounts and exiting.
|
||||
@@ -1247,7 +1247,7 @@ static int mount_autofs(struct autofs_po
|
||||
|
||||
st_add_task(ap, ST_READY);
|
||||
|
||||
- return 0;
|
||||
+ return status;
|
||||
}
|
||||
|
||||
static int handle_packet(struct autofs_point *ap)
|
@ -1,91 +0,0 @@
|
||||
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 | 10 +++++++++-
|
||||
modules/parse_sun.c | 6 ++++++
|
||||
3 files changed, 16 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 870fd8f3..6f18a0bb 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -2,6 +2,7 @@
|
||||
- fix fedfs build flags.
|
||||
- fix set open file limit.
|
||||
- improve descriptor open error reporting.
|
||||
+- fix root offset error handling.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
diff --git a/daemon/direct.c b/daemon/direct.c
|
||||
index c2331155..8810900c 100644
|
||||
--- a/daemon/direct.c
|
||||
+++ b/daemon/direct.c
|
||||
@@ -1167,6 +1167,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;
|
||||
|
||||
@@ -1230,7 +1231,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;
|
||||
@@ -1271,6 +1271,14 @@ 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.
|
||||
+ */
|
||||
+ 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);
|
||||
|
||||
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
|
||||
index d9ac0c94..56fe4161 100644
|
||||
--- a/modules/parse_sun.c
|
||||
+++ b/modules/parse_sun.c
|
||||
@@ -1142,6 +1142,9 @@ static int mount_subtree(struct autofs_point *ap, struct mapent_cache *mc,
|
||||
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] = '/';
|
||||
@@ -1186,6 +1189,9 @@ static int mount_subtree(struct autofs_point *ap, struct mapent_cache *mc,
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
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.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -1,5 +1,6 @@
|
||||
- fix kernel mount status notificantion.
|
||||
- fix fedfs build flags.
|
||||
+- fix set open file limit.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/automount.c
|
||||
+++ autofs-5.1.8/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);
|
||||
@@ -2486,9 +2486,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)
|
@ -1,68 +0,0 @@
|
||||
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(-)
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index dacc2fa0..a063a126 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -13,6 +13,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.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
diff --git a/lib/mounts.c b/lib/mounts.c
|
||||
index c731f464..ad8f3de4 100644
|
||||
--- a/lib/mounts.c
|
||||
+++ b/lib/mounts.c
|
||||
@@ -2385,11 +2385,17 @@ void set_tsd_user_vars(unsigned int logopt, uid_t uid, gid_t gid)
|
||||
|
||||
/* 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 logopt, uid_t uid, gid_t gid)
|
||||
|
||||
/* 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;
|
@ -1,46 +0,0 @@
|
||||
autofs-5.1.8 - fix unterminated read in handle_cmd_pipe_fifo_message()
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
As Coverity points out the buffer in handle_cmd_pipe_fifo_message()
|
||||
could be overflowed and end up not terminated so fix it.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
daemon/automount.c | 7 ++++++-
|
||||
2 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -48,6 +48,7 @@
|
||||
- switch to application wide command pipe.
|
||||
- get rid of unused field submnt_count.
|
||||
- fix mount tree startup reconnect.
|
||||
+- fix unterminated read in handle_cmd_pipe_fifo_message().
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/automount.c
|
||||
+++ autofs-5.1.8/daemon/automount.c
|
||||
@@ -1427,7 +1427,6 @@ static void handle_cmd_pipe_fifo_message
|
||||
int ret;
|
||||
long pri;
|
||||
|
||||
- memset(buffer, 0, sizeof(buffer));
|
||||
ret = read(fd, &buffer, sizeof(buffer));
|
||||
if (ret < 0) {
|
||||
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
@@ -1435,6 +1434,12 @@ static void handle_cmd_pipe_fifo_message
|
||||
"read on command pipe returned error: %s", estr);
|
||||
return;
|
||||
}
|
||||
+ if (ret >= sizeof(buffer)) {
|
||||
+ error(LOGOPT_ANY,
|
||||
+ "read overrun on command pipe message");
|
||||
+ return;
|
||||
+ }
|
||||
+ buffer[ret] = 0;
|
||||
|
||||
sep = strrchr(buffer, ' ');
|
||||
if (!sep) {
|
@ -1,59 +0,0 @@
|
||||
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(-)
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 5b37460f..f05c9c6b 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -10,6 +10,7 @@
|
||||
- bailout on rpc systemerror.
|
||||
- fix nfsv4 only mounts should not use rpcbind.
|
||||
- simplify cache_add() a little.
|
||||
+- fix use after free in tree_mapent_delete_offset_tree().
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
diff --git a/lib/mounts.c b/lib/mounts.c
|
||||
index 451849a6..c731f464 100644
|
||||
--- a/lib/mounts.c
|
||||
+++ b/lib/mounts.c
|
||||
@@ -1666,16 +1666,26 @@ static int tree_mapent_delete_offset_tree(struct tree_node *root)
|
||||
*/
|
||||
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);
|
@ -1,56 +0,0 @@
|
||||
autofs-5.1.8 - fix use_ignore_mount_option description
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Fix a couple of grammer problem with the configuration setting
|
||||
use_ignore_mount_option description.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
redhat/autofs.conf.default.in | 4 ++--
|
||||
samples/autofs.conf.default.in | 4 ++--
|
||||
3 files changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -29,6 +29,7 @@
|
||||
- fix minus only option handling in concat_options().
|
||||
- fix incorrect path for is_mounted() in try_remount().
|
||||
- fix additional tsv invalid access.
|
||||
+- fix use_ignore_mount_option description.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/redhat/autofs.conf.default.in
|
||||
+++ autofs-5.1.8/redhat/autofs.conf.default.in
|
||||
@@ -192,11 +192,11 @@ mount_nfs_default_protocol = 4
|
||||
#disable_not_found_message = "no"
|
||||
#
|
||||
# use_ignore_mount_option - This option is used to enable the use of autofs
|
||||
-# pseudo option "disable". This option is used as a
|
||||
+# pseudo option "ignore". This option is used as a
|
||||
# hint to user space that the mount entry should be
|
||||
# ommitted from mount table listings. The default is
|
||||
# "no" to avoid unexpected changes in behaviour and
|
||||
-# so is an opt-in setting.
|
||||
+# is an opt-in setting.
|
||||
#
|
||||
#use_ignore_mount_option = no
|
||||
#
|
||||
--- autofs-5.1.8.orig/samples/autofs.conf.default.in
|
||||
+++ autofs-5.1.8/samples/autofs.conf.default.in
|
||||
@@ -191,11 +191,11 @@ browse_mode = no
|
||||
#disable_not_found_message = "no"
|
||||
#
|
||||
# use_ignore_mount_option - This option is used to enable the use of autofs
|
||||
-# pseudo option "disable". This option is used as a
|
||||
+# pseudo option "ignore". This option is used as a
|
||||
# hint to user space that the mount entry should be
|
||||
# ommitted from mount table listings. The default is
|
||||
# "no" to avoid unexpected changes in behaviour and
|
||||
-# so is an opt-in setting.
|
||||
+# is an opt-in setting.
|
||||
#
|
||||
#use_ignore_mount_option = no
|
||||
#
|
@ -1,69 +0,0 @@
|
||||
autofs-5.1.8 - get rid of unused field submnt_count
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
The autofs mount point struct field submnt_count is present but not
|
||||
used, remove it.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
daemon/automount.c | 3 ---
|
||||
daemon/master.c | 1 -
|
||||
include/automount.h | 1 -
|
||||
modules/mount_autofs.c | 2 --
|
||||
5 files changed, 1 insertion(+), 7 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -46,6 +46,7 @@
|
||||
- use device id to locate autofs_point when setting log priotity.
|
||||
- add command pipe handling functions.
|
||||
- switch to application wide command pipe.
|
||||
+- get rid of unused field submnt_count.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/automount.c
|
||||
+++ autofs-5.1.8/daemon/automount.c
|
||||
@@ -1747,9 +1747,6 @@ static void handle_mounts_cleanup(void *
|
||||
if (submount) {
|
||||
struct mnt_list *mnt;
|
||||
|
||||
- /* We are finishing up */
|
||||
- ap->parent->submnt_count--;
|
||||
-
|
||||
/* Submount at ap->path belongs to parent submount list. */
|
||||
mnts_remove_submount(ap->path);
|
||||
/* Also remove from parent mounted list */
|
||||
--- autofs-5.1.8.orig/daemon/master.c
|
||||
+++ autofs-5.1.8/daemon/master.c
|
||||
@@ -158,7 +158,6 @@ int master_add_autofs_point(struct maste
|
||||
|
||||
ap->parent = NULL;
|
||||
ap->thid = 0;
|
||||
- ap->submnt_count = 0;
|
||||
ap->submount = submount;
|
||||
INIT_LIST_HEAD(&ap->mounts);
|
||||
INIT_LIST_HEAD(&ap->submounts);
|
||||
--- autofs-5.1.8.orig/include/automount.h
|
||||
+++ autofs-5.1.8/include/automount.h
|
||||
@@ -567,7 +567,6 @@ struct autofs_point {
|
||||
struct autofs_point *parent; /* Owner of mounts list for submount */
|
||||
struct list_head mounts; /* List of autofs mounts at current level */
|
||||
unsigned int submount; /* Is this a submount */
|
||||
- unsigned int submnt_count; /* Number of submounts */
|
||||
struct list_head submounts; /* List of child submounts */
|
||||
struct list_head amdmounts; /* List of non submount amd mounts */
|
||||
unsigned int shutdown; /* Shutdown notification */
|
||||
--- autofs-5.1.8.orig/modules/mount_autofs.c
|
||||
+++ autofs-5.1.8/modules/mount_autofs.c
|
||||
@@ -379,8 +379,6 @@ int mount_mount(struct autofs_point *ap,
|
||||
}
|
||||
nap->thid = thid;
|
||||
|
||||
- ap->submnt_count++;
|
||||
-
|
||||
handle_mounts_startup_cond_destroy(&suc);
|
||||
|
||||
return 0;
|
@ -1,165 +0,0 @@
|
||||
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.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -1,6 +1,7 @@
|
||||
- fix kernel mount status notificantion.
|
||||
- fix fedfs build flags.
|
||||
- fix set open file limit.
|
||||
+- improve descriptor open error reporting.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/automount.c
|
||||
+++ autofs-5.1.8/daemon/automount.c
|
||||
@@ -868,9 +868,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.8.orig/daemon/spawn.c
|
||||
+++ autofs-5.1.8/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.8.orig/lib/mounts.c
|
||||
+++ autofs-5.1.8/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.8.orig/modules/lookup_program.c
|
||||
+++ autofs-5.1.8/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]);
|
@ -1,59 +0,0 @@
|
||||
autofs-5.1.8 - improve handling of ENOENT in sss setautomntent()
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
In the sss lookup module function setautomntent() a return of ENOENT
|
||||
isn't handled quite right.
|
||||
|
||||
If ENOENT (rather than EHOSTDOWN) is returned from sss setautomntent()
|
||||
we should assume the LDAP info. has been read by sss and the entry in
|
||||
fact doesn't exist.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
modules/lookup_sss.c | 16 +++++++++++++++-
|
||||
2 files changed, 16 insertions(+), 1 deletion(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -32,6 +32,7 @@
|
||||
- fix use_ignore_mount_option description.
|
||||
- include addtional log info for mounts.
|
||||
- fail on empty replicated host name.
|
||||
+- improve handling of ENOENT in sss setautomntent().
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/modules/lookup_sss.c
|
||||
+++ autofs-5.1.8/modules/lookup_sss.c
|
||||
@@ -394,7 +394,17 @@ static int setautomntent(unsigned int lo
|
||||
if (ret != ENOENT)
|
||||
goto error;
|
||||
} else {
|
||||
- if (ret != ENOENT && ret != EHOSTDOWN)
|
||||
+ /* If we get an ENOENT here assume it's accurrate
|
||||
+ * and return the error.
|
||||
+ */
|
||||
+ if (ret == ENOENT) {
|
||||
+ error(logopt, MODPREFIX
|
||||
+ "setautomountent: entry for map %s not found",
|
||||
+ ctxt->mapname);
|
||||
+ err = NSS_STATUS_NOTFOUND;
|
||||
+ goto free;
|
||||
+ }
|
||||
+ if (ret != EHOSTDOWN)
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -410,6 +420,10 @@ static int setautomntent(unsigned int lo
|
||||
if (ret == EINVAL)
|
||||
goto free;
|
||||
if (ret == ENOENT) {
|
||||
+ /* Map info. not found after host became available */
|
||||
+ error(logopt, MODPREFIX
|
||||
+ "setautomountent: entry for map %s not found",
|
||||
+ ctxt->mapname);
|
||||
err = NSS_STATUS_NOTFOUND;
|
||||
goto free;
|
||||
}
|
@ -1,160 +0,0 @@
|
||||
autofs-5.1.8 - include addtional log info for mounts
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
There has been a request to include some additional information when
|
||||
logging mounts and umounts, specifically host and mount location path.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
daemon/automount.c | 7 +++++--
|
||||
daemon/indirect.c | 2 +-
|
||||
daemon/spawn.c | 6 +++---
|
||||
modules/mount_bind.c | 4 ++--
|
||||
modules/mount_ext2.c | 2 +-
|
||||
modules/mount_generic.c | 2 +-
|
||||
modules/mount_nfs.c | 4 +++-
|
||||
8 files changed, 17 insertions(+), 11 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -30,6 +30,7 @@
|
||||
- fix incorrect path for is_mounted() in try_remount().
|
||||
- fix additional tsv invalid access.
|
||||
- fix use_ignore_mount_option description.
|
||||
+- include addtional log info for mounts.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/automount.c
|
||||
+++ autofs-5.1.8/daemon/automount.c
|
||||
@@ -1151,14 +1151,17 @@ static int get_pkt(struct autofs_point *
|
||||
int do_expire(struct autofs_point *ap, const char *name, int namelen)
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
+ const char *parent;
|
||||
int len, ret;
|
||||
|
||||
if (*name != '/') {
|
||||
len = ncat_path(buf, sizeof(buf), ap->path, name, namelen);
|
||||
+ parent = ap->path;
|
||||
} else {
|
||||
len = snprintf(buf, PATH_MAX, "%s", name);
|
||||
if (len >= PATH_MAX)
|
||||
len = 0;
|
||||
+ parent = name;
|
||||
}
|
||||
|
||||
if (!len) {
|
||||
@@ -1166,13 +1169,13 @@ int do_expire(struct autofs_point *ap, c
|
||||
return 1;
|
||||
}
|
||||
|
||||
- info(ap->logopt, "expiring path %s", buf);
|
||||
+ info(ap->logopt, "expiring path %s on %s", buf, parent);
|
||||
|
||||
pthread_cleanup_push(master_source_lock_cleanup, ap->entry);
|
||||
master_source_readlock(ap->entry);
|
||||
ret = umount_multi(ap, buf, 1);
|
||||
if (ret == 0)
|
||||
- info(ap->logopt, "expired %s", buf);
|
||||
+ info(ap->logopt, "umounting %s succeeded", buf);
|
||||
else
|
||||
warn(ap->logopt, "couldn't complete expire of %s", buf);
|
||||
pthread_cleanup_pop(1);
|
||||
--- autofs-5.1.8.orig/daemon/indirect.c
|
||||
+++ autofs-5.1.8/daemon/indirect.c
|
||||
@@ -342,7 +342,7 @@ force_umount:
|
||||
"forcing umount of indirect mount %s", mountpoint);
|
||||
rv = umount2(mountpoint, MNT_DETACH);
|
||||
} else {
|
||||
- info(ap->logopt, "umounted indirect mount %s", mountpoint);
|
||||
+ info(ap->logopt, "umounting indirect mount %s succeeded", mountpoint);
|
||||
if (ap->submount)
|
||||
rm_unwanted(ap, mountpoint, 1);
|
||||
}
|
||||
--- autofs-5.1.8.orig/daemon/spawn.c
|
||||
+++ autofs-5.1.8/daemon/spawn.c
|
||||
@@ -542,7 +542,7 @@ done:
|
||||
while (errp && (p = memchr(sp, '\n', errp))) {
|
||||
*p++ = '\0';
|
||||
if (sp[0]) /* Don't output empty lines */
|
||||
- warn(logopt, ">> %s", sp);
|
||||
+ debug(logopt, ">> %s", sp);
|
||||
errp -= (p - sp);
|
||||
sp = p;
|
||||
}
|
||||
@@ -553,7 +553,7 @@ done:
|
||||
if (errp >= ERRBUFSIZ) {
|
||||
/* Line too long, split */
|
||||
errbuf[errp] = '\0';
|
||||
- warn(logopt, ">> %s", errbuf);
|
||||
+ debug(logopt, ">> %s", errbuf);
|
||||
errp = 0;
|
||||
}
|
||||
}
|
||||
@@ -567,7 +567,7 @@ done:
|
||||
if (errp > 0) {
|
||||
/* End of file without \n */
|
||||
errbuf[errp] = '\0';
|
||||
- warn(logopt, ">> %s", errbuf);
|
||||
+ debug(logopt, ">> %s", errbuf);
|
||||
}
|
||||
|
||||
if (waitpid(f, &ret, 0) != f)
|
||||
--- autofs-5.1.8.orig/modules/mount_bind.c
|
||||
+++ autofs-5.1.8/modules/mount_bind.c
|
||||
@@ -177,7 +177,7 @@ int mount_mount(struct autofs_point *ap,
|
||||
|
||||
return err;
|
||||
} else {
|
||||
- debug(ap->logopt,
|
||||
+ mountlog(ap->logopt,
|
||||
MODPREFIX "mounted %s type %s on %s",
|
||||
what, fstype, fullpath);
|
||||
}
|
||||
@@ -252,7 +252,7 @@ int mount_mount(struct autofs_point *ap,
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
- debug(ap->logopt,
|
||||
+ mountlog(ap->logopt,
|
||||
MODPREFIX "symlinked %s -> %s", fullpath, what);
|
||||
return 0;
|
||||
}
|
||||
--- autofs-5.1.8.orig/modules/mount_ext2.c
|
||||
+++ autofs-5.1.8/modules/mount_ext2.c
|
||||
@@ -140,7 +140,7 @@ int mount_mount(struct autofs_point *ap,
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
- debug(ap->logopt,
|
||||
+ mountlog(ap->logopt,
|
||||
MODPREFIX "mounted %s type %s on %s",
|
||||
what, fstype, fullpath);
|
||||
return 0;
|
||||
--- autofs-5.1.8.orig/modules/mount_generic.c
|
||||
+++ autofs-5.1.8/modules/mount_generic.c
|
||||
@@ -99,7 +99,7 @@ int mount_mount(struct autofs_point *ap,
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
- debug(ap->logopt, MODPREFIX "mounted %s type %s on %s",
|
||||
+ mountlog(ap->logopt, MODPREFIX "mounted %s type %s on %s",
|
||||
what, fstype, fullpath);
|
||||
return 0;
|
||||
}
|
||||
--- autofs-5.1.8.orig/modules/mount_nfs.c
|
||||
+++ autofs-5.1.8/modules/mount_nfs.c
|
||||
@@ -403,7 +403,9 @@ dont_probe:
|
||||
}
|
||||
|
||||
if (!err) {
|
||||
- debug(ap->logopt, MODPREFIX "mounted %s on %s", loc, fullpath);
|
||||
+ mountlog(ap->logopt,
|
||||
+ MODPREFIX "mounted %s type %s on %s",
|
||||
+ loc, fstype, fullpath);
|
||||
free(loc);
|
||||
free_host_list(&hosts);
|
||||
return 0;
|
@ -1,81 +0,0 @@
|
||||
autofs-5.1.8 - make amd mapent search function name clear
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
When looking for amd sections in the configuration the function to
|
||||
find mount entries is not named so it is clear what it's trying to
|
||||
do so change its name. Also make it static since it is called only
|
||||
once in the same source file.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
daemon/master.c | 7 ++++---
|
||||
include/master.h | 2 +-
|
||||
3 files changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -38,6 +38,7 @@
|
||||
- don't close lookup at umount.
|
||||
- fix deadlock in lookups.
|
||||
- dont delay expire.
|
||||
+- make amd mapent search function name clear.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/master.c
|
||||
+++ autofs-5.1.8/daemon/master.c
|
||||
@@ -747,7 +747,7 @@ struct master_mapent *master_find_mapent
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-unsigned int master_partial_match_mapent(struct master *master, const char *path)
|
||||
+static unsigned int master_partial_match_amd_mapent(struct master *master, const char *path)
|
||||
{
|
||||
struct list_head *head, *p;
|
||||
size_t path_len = strlen(path);
|
||||
@@ -761,7 +761,7 @@ unsigned int master_partial_match_mapent
|
||||
|
||||
entry = list_entry(p, struct master_mapent, list);
|
||||
|
||||
- entry_len = strlen(entry->path);
|
||||
+ entry_len = entry->len;
|
||||
cmp_len = min(entry_len, path_len);
|
||||
|
||||
if (!strncmp(entry->path, path, cmp_len)) {
|
||||
@@ -812,6 +812,7 @@ struct master_mapent *master_new_mapent(
|
||||
return NULL;
|
||||
}
|
||||
entry->path = tmp;
|
||||
+ entry->len = strlen(tmp);
|
||||
|
||||
entry->thid = 0;
|
||||
entry->age = age;
|
||||
@@ -1044,7 +1045,7 @@ static void master_add_amd_mount_section
|
||||
char *map = NULL;
|
||||
char *opts;
|
||||
|
||||
- ret = master_partial_match_mapent(master, path);
|
||||
+ ret = master_partial_match_amd_mapent(master, path);
|
||||
if (ret) {
|
||||
/* If this amd entry is already present in the
|
||||
* master map it's not a duplicate, don't issue
|
||||
--- autofs-5.1.8.orig/include/master.h
|
||||
+++ autofs-5.1.8/include/master.h
|
||||
@@ -45,6 +45,7 @@ struct map_source {
|
||||
|
||||
struct master_mapent {
|
||||
char *path;
|
||||
+ size_t len;
|
||||
pthread_t thid;
|
||||
time_t age;
|
||||
struct master *master;
|
||||
@@ -109,7 +110,6 @@ void master_source_lock_cleanup(void *);
|
||||
void master_source_current_wait(struct master_mapent *);
|
||||
void master_source_current_signal(struct master_mapent *);
|
||||
struct master_mapent *master_find_mapent(struct master *, const char *);
|
||||
-unsigned int master_partial_match_mapent(struct master *, const char *);
|
||||
struct master_mapent *master_new_mapent(struct master *, const char *, time_t);
|
||||
void master_add_mapent(struct master *, struct master_mapent *);
|
||||
void master_remove_mapent(struct master_mapent *);
|
@ -1,75 +0,0 @@
|
||||
autofs-5.1.8 - make signal handling consistent
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
There's a mixture of usage of sigprocmask() and pthread_sigmask(), change
|
||||
to use the pthread versions of this for correctness.
|
||||
|
||||
The only exception to this is reset_signals() which is done in a forked
|
||||
process that is single threaded so it's valid to keep them as they are.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
daemon/automount.c | 8 ++++----
|
||||
daemon/spawn.c | 1 -
|
||||
3 files changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -40,6 +40,7 @@
|
||||
- dont delay expire.
|
||||
- make amd mapent search function name clear.
|
||||
- rename statemachine() to signal_handler().
|
||||
+- make signal handling consistent.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/automount.c
|
||||
+++ autofs-5.1.8/daemon/automount.c
|
||||
@@ -2223,7 +2223,7 @@ static void do_master_list_reset(struct
|
||||
|
||||
static int do_master_read_master(struct master *master, time_t *age, int wait)
|
||||
{
|
||||
- sigset_t signalset;
|
||||
+ sigset_t signalset, savesigset;
|
||||
/* Wait must be at least 1 second */
|
||||
unsigned int retry_wait = 2;
|
||||
unsigned int elapsed = 0;
|
||||
@@ -2234,7 +2234,7 @@ static int do_master_read_master(struct
|
||||
sigaddset(&signalset, SIGTERM);
|
||||
sigaddset(&signalset, SIGINT);
|
||||
sigaddset(&signalset, SIGHUP);
|
||||
- sigprocmask(SIG_UNBLOCK, &signalset, NULL);
|
||||
+ pthread_sigmask(SIG_UNBLOCK, &signalset, &savesigset);
|
||||
|
||||
while (1) {
|
||||
struct timespec t = { retry_wait, 0 };
|
||||
@@ -2260,7 +2260,7 @@ static int do_master_read_master(struct
|
||||
}
|
||||
}
|
||||
|
||||
- sigprocmask(SIG_BLOCK, &signalset, NULL);
|
||||
+ pthread_sigmask(SIG_SETMASK, &savesigset, NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -2308,7 +2308,7 @@ int main(int argc, char *argv[])
|
||||
sigdelset(&block_sigs, SIGILL);
|
||||
sigdelset(&block_sigs, SIGFPE);
|
||||
sigdelset(&block_sigs, SIGTRAP);
|
||||
- sigprocmask(SIG_BLOCK, &block_sigs, NULL);
|
||||
+ pthread_sigmask(SIG_BLOCK, &block_sigs, NULL);
|
||||
|
||||
program = argv[0];
|
||||
|
||||
--- autofs-5.1.8.orig/daemon/spawn.c
|
||||
+++ autofs-5.1.8/daemon/spawn.c
|
||||
@@ -46,7 +46,6 @@ void dump_core(void)
|
||||
sigemptyset(&segv);
|
||||
sigaddset(&segv, SIGSEGV);
|
||||
pthread_sigmask(SIG_UNBLOCK, &segv, NULL);
|
||||
- sigprocmask(SIG_UNBLOCK, &segv, NULL);
|
||||
|
||||
raise(SIGSEGV);
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
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(-)
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index a063a126..5402b88d 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -14,6 +14,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().
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
diff --git a/daemon/automount.c b/daemon/automount.c
|
||||
index b47c485b..353e4f54 100644
|
||||
--- a/daemon/automount.c
|
||||
+++ b/daemon/automount.c
|
||||
@@ -558,7 +558,7 @@ static int umount_subtree_mounts(struct autofs_point *ap, const char *path, unsi
|
||||
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);
|
||||
diff --git a/include/mounts.h b/include/mounts.h
|
||||
index ddb7e4c5..23c7ba1c 100644
|
||||
--- a/include/mounts.h
|
||||
+++ b/include/mounts.h
|
||||
@@ -182,7 +182,7 @@ int tree_mapent_add_node(struct mapent_cache *mc, struct tree_node *root, struct
|
||||
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);
|
||||
diff --git a/lib/mounts.c b/lib/mounts.c
|
||||
index ad8f3de4..617c1d54 100644
|
||||
--- a/lib/mounts.c
|
||||
+++ b/lib/mounts.c
|
||||
@@ -1843,7 +1843,7 @@ static int tree_mapent_umount_offset(struct mapent *oe, void *ptr)
|
||||
* 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_work(struct tree_node *n, void *ptr)
|
||||
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;
|
||||
|
@ -1,63 +0,0 @@
|
||||
autofs-5.1.8 - rename statemachine() to signal_handler()
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Rename function statemachine() to signal_handler() to align with what
|
||||
the function actually does.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
daemon/automount.c | 10 +++++-----
|
||||
2 files changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -39,6 +39,7 @@
|
||||
- fix deadlock in lookups.
|
||||
- dont delay expire.
|
||||
- make amd mapent search function name clear.
|
||||
+- rename statemachine() to signal_handler().
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/automount.c
|
||||
+++ autofs-5.1.8/daemon/automount.c
|
||||
@@ -75,7 +75,7 @@ int do_force_unlink = 0; /* Forceably u
|
||||
static int start_pipefd[2] = {-1, -1};
|
||||
static int st_stat = 1;
|
||||
static int *pst_stat = &st_stat;
|
||||
-static pthread_t state_mach_thid;
|
||||
+static pthread_t signal_handler_thid;
|
||||
|
||||
static sigset_t block_sigs;
|
||||
|
||||
@@ -1588,7 +1588,7 @@ static int do_hup_signal(struct master *
|
||||
}
|
||||
|
||||
/* Deal with all the signal-driven events in the state machine */
|
||||
-static void *statemachine(void *arg)
|
||||
+static void *signal_handler(void *arg)
|
||||
{
|
||||
sigset_t signalset;
|
||||
int sig;
|
||||
@@ -1775,7 +1775,7 @@ static void handle_mounts_cleanup(void *
|
||||
* perform final cleanup.
|
||||
*/
|
||||
if (!submount && !pending)
|
||||
- pthread_kill(state_mach_thid, SIGTERM);
|
||||
+ pthread_kill(signal_handler_thid, SIGTERM);
|
||||
|
||||
master_mutex_unlock();
|
||||
|
||||
@@ -2765,8 +2765,8 @@ int main(int argc, char *argv[])
|
||||
sd_notify(1, "READY=1");
|
||||
#endif
|
||||
|
||||
- state_mach_thid = pthread_self();
|
||||
- statemachine(NULL);
|
||||
+ signal_handler_thid = pthread_self();
|
||||
+ signal_handler(NULL);
|
||||
}
|
||||
|
||||
master_kill(master_list);
|
@ -1,272 +0,0 @@
|
||||
autofs-5.1.8 - serialise lookup module open and reinit
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Add a map source lock to serialise map setting and use of module
|
||||
structure fields such as the context.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1 +
|
||||
daemon/lookup.c | 35 +++++++++++++++++++++--------------
|
||||
daemon/master.c | 43 +++++++++++++++++++++++++++++++++++++++++++
|
||||
include/master.h | 5 +++++
|
||||
modules/parse_amd.c | 26 +++++++++++++++-----------
|
||||
5 files changed, 85 insertions(+), 25 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -21,6 +21,7 @@
|
||||
- fix invalid tsv access.
|
||||
- fix autofs regression due to positive_timeout.
|
||||
- fix parse module instance mutex naming.
|
||||
+- serialise lookup module open and reinit.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/lookup.c
|
||||
+++ autofs-5.1.8/daemon/lookup.c
|
||||
@@ -320,28 +320,27 @@ static int do_read_map(struct autofs_poi
|
||||
struct lookup_mod *lookup;
|
||||
int status;
|
||||
|
||||
- lookup = NULL;
|
||||
- master_source_writelock(ap->entry);
|
||||
+ pthread_cleanup_push(map_module_lock_cleanup, map);
|
||||
+ map_module_writelock(map);
|
||||
if (!map->lookup) {
|
||||
status = open_lookup(map->type, "", map->format,
|
||||
map->argc, map->argv, &lookup);
|
||||
- if (status != NSS_STATUS_SUCCESS) {
|
||||
- master_source_unlock(ap->entry);
|
||||
+ if (status == NSS_STATUS_SUCCESS)
|
||||
+ map->lookup = lookup;
|
||||
+ else
|
||||
debug(ap->logopt,
|
||||
"lookup module %s open failed", map->type);
|
||||
- return status;
|
||||
- }
|
||||
- map->lookup = lookup;
|
||||
} else {
|
||||
- lookup = map->lookup;
|
||||
- status = lookup->lookup_reinit(map->format,
|
||||
- map->argc, map->argv,
|
||||
- &lookup->context);
|
||||
+ status = map->lookup->lookup_reinit(map->format,
|
||||
+ map->argc, map->argv,
|
||||
+ &map->lookup->context);
|
||||
if (status)
|
||||
warn(ap->logopt,
|
||||
"lookup module %s reinit failed", map->type);
|
||||
}
|
||||
- master_source_unlock(ap->entry);
|
||||
+ pthread_cleanup_pop(1);
|
||||
+ if (status != NSS_STATUS_SUCCESS)
|
||||
+ return status;
|
||||
|
||||
if (!map->stale)
|
||||
return NSS_STATUS_SUCCESS;
|
||||
@@ -349,7 +348,11 @@ static int do_read_map(struct autofs_poi
|
||||
master_source_current_wait(ap->entry);
|
||||
ap->entry->current = map;
|
||||
|
||||
+ pthread_cleanup_push(map_module_lock_cleanup, map);
|
||||
+ map_module_readlock(map);
|
||||
+ lookup = map->lookup;
|
||||
status = lookup->lookup_read_map(ap, age, lookup->context);
|
||||
+ pthread_cleanup_pop(1);
|
||||
|
||||
if (status != NSS_STATUS_SUCCESS)
|
||||
map->stale = 0;
|
||||
@@ -806,23 +809,27 @@ int do_lookup_mount(struct autofs_point
|
||||
struct lookup_mod *lookup;
|
||||
int status;
|
||||
|
||||
+ map_module_writelock(map);
|
||||
if (!map->lookup) {
|
||||
status = open_lookup(map->type, "",
|
||||
map->format, map->argc, map->argv, &lookup);
|
||||
if (status != NSS_STATUS_SUCCESS) {
|
||||
+ map_module_unlock(map);
|
||||
debug(ap->logopt,
|
||||
"lookup module %s open failed", map->type);
|
||||
return status;
|
||||
}
|
||||
map->lookup = lookup;
|
||||
}
|
||||
-
|
||||
- lookup = map->lookup;
|
||||
+ map_module_unlock(map);
|
||||
|
||||
master_source_current_wait(ap->entry);
|
||||
ap->entry->current = map;
|
||||
|
||||
+ map_module_readlock(map);
|
||||
+ lookup = map->lookup;
|
||||
status = lookup->lookup_mount(ap, name, name_len, lookup->context);
|
||||
+ map_module_unlock(map);
|
||||
|
||||
return status;
|
||||
}
|
||||
--- autofs-5.1.8.orig/daemon/master.c
|
||||
+++ autofs-5.1.8/daemon/master.c
|
||||
@@ -66,6 +66,34 @@ void master_mutex_lock_cleanup(void *arg
|
||||
return;
|
||||
}
|
||||
|
||||
+void map_module_writelock(struct map_source *map)
|
||||
+{
|
||||
+ int status = pthread_rwlock_wrlock(&map->module_lock);
|
||||
+ if (status)
|
||||
+ fatal(status);
|
||||
+}
|
||||
+
|
||||
+void map_module_readlock(struct map_source *map)
|
||||
+{
|
||||
+ int status = pthread_rwlock_rdlock(&map->module_lock);
|
||||
+ if (status)
|
||||
+ fatal(status);
|
||||
+}
|
||||
+
|
||||
+void map_module_unlock(struct map_source *map)
|
||||
+{
|
||||
+ int status = pthread_rwlock_unlock(&map->module_lock);
|
||||
+ if (status)
|
||||
+ fatal(status);
|
||||
+}
|
||||
+
|
||||
+void map_module_lock_cleanup(void *arg)
|
||||
+{
|
||||
+ struct map_source *map = (struct map_source *) arg;
|
||||
+
|
||||
+ map_module_unlock(map);
|
||||
+}
|
||||
+
|
||||
int master_add_autofs_point(struct master_mapent *entry, unsigned logopt,
|
||||
unsigned nobind, unsigned ghost, int submount)
|
||||
{
|
||||
@@ -161,6 +189,7 @@ master_add_map_source(struct master_mape
|
||||
struct map_source *source;
|
||||
char *ntype, *nformat;
|
||||
const char **tmpargv;
|
||||
+ int status;
|
||||
|
||||
source = malloc(sizeof(struct map_source));
|
||||
if (!source)
|
||||
@@ -247,6 +276,10 @@ master_add_map_source(struct master_mape
|
||||
|
||||
master_source_unlock(entry);
|
||||
|
||||
+ status = pthread_rwlock_init(&source->module_lock, NULL);
|
||||
+ if (status)
|
||||
+ fatal(status);
|
||||
+
|
||||
return source;
|
||||
}
|
||||
|
||||
@@ -336,6 +369,8 @@ master_get_map_source(struct master_mape
|
||||
|
||||
static void __master_free_map_source(struct map_source *source, unsigned int free_cache)
|
||||
{
|
||||
+ int status;
|
||||
+
|
||||
/* instance map sources are not ref counted */
|
||||
if (source->ref && --source->ref)
|
||||
return;
|
||||
@@ -371,6 +406,10 @@ static void __master_free_map_source(str
|
||||
}
|
||||
}
|
||||
|
||||
+ status = pthread_rwlock_destroy(&source->module_lock);
|
||||
+ if (status)
|
||||
+ fatal(status);
|
||||
+
|
||||
free(source);
|
||||
|
||||
return;
|
||||
@@ -502,6 +541,10 @@ master_add_source_instance(struct map_so
|
||||
if (status)
|
||||
fatal(status);
|
||||
|
||||
+ status = pthread_rwlock_init(&new->module_lock, NULL);
|
||||
+ if (status)
|
||||
+ fatal(status);
|
||||
+
|
||||
return new;
|
||||
}
|
||||
|
||||
--- autofs-5.1.8.orig/include/master.h
|
||||
+++ autofs-5.1.8/include/master.h
|
||||
@@ -35,6 +35,7 @@ struct map_source {
|
||||
unsigned int stale;
|
||||
unsigned int recurse;
|
||||
unsigned int depth;
|
||||
+ pthread_rwlock_t module_lock;
|
||||
struct lookup_mod *lookup;
|
||||
int argc;
|
||||
const char **argv;
|
||||
@@ -126,5 +127,9 @@ int __master_list_empty(struct master *)
|
||||
int master_list_empty(struct master *);
|
||||
int master_done(struct master *);
|
||||
int master_kill(struct master *);
|
||||
+void map_module_writelock(struct map_source *map);
|
||||
+void map_module_readlock(struct map_source *map);
|
||||
+void map_module_unlock(struct map_source *map);
|
||||
+void map_module_lock_cleanup(void *arg);
|
||||
|
||||
#endif
|
||||
--- autofs-5.1.8.orig/modules/parse_amd.c
|
||||
+++ autofs-5.1.8/modules/parse_amd.c
|
||||
@@ -1358,14 +1358,6 @@ static int do_host_mount(struct autofs_p
|
||||
argc = 1;
|
||||
}
|
||||
|
||||
- parse_instance_mutex_lock();
|
||||
- status = open_lookup("hosts", MODPREFIX, NULL, argc, pargv, &lookup);
|
||||
- if (status != NSS_STATUS_SUCCESS) {
|
||||
- debug(ap->logopt, "open lookup module hosts failed");
|
||||
- parse_instance_mutex_unlock();
|
||||
- goto out;
|
||||
- }
|
||||
-
|
||||
instance = master_find_source_instance(source,
|
||||
"hosts", "sun", argc, pargv);
|
||||
if (!instance) {
|
||||
@@ -1374,13 +1366,22 @@ static int do_host_mount(struct autofs_p
|
||||
if (!instance) {
|
||||
error(ap->logopt, MODPREFIX
|
||||
"failed to create source instance for hosts map");
|
||||
- parse_instance_mutex_unlock();
|
||||
close_lookup(lookup);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
- instance->lookup = lookup;
|
||||
- parse_instance_mutex_unlock();
|
||||
+
|
||||
+ map_module_writelock(instance);
|
||||
+ if (!instance->lookup) {
|
||||
+ status = open_lookup("hosts", MODPREFIX, NULL, argc, pargv, &lookup);
|
||||
+ if (status != NSS_STATUS_SUCCESS) {
|
||||
+ map_module_unlock(instance);
|
||||
+ debug(ap->logopt, "open lookup module hosts failed");
|
||||
+ goto out;
|
||||
+ }
|
||||
+ instance->lookup = lookup;
|
||||
+ }
|
||||
+ map_module_unlock(instance);
|
||||
|
||||
cache_writelock(source->mc);
|
||||
me = cache_lookup_distinct(source->mc, name);
|
||||
@@ -1391,8 +1392,11 @@ static int do_host_mount(struct autofs_p
|
||||
master_source_current_wait(ap->entry);
|
||||
ap->entry->current = source;
|
||||
|
||||
+ map_module_readlock(instance);
|
||||
+ lookup = instance->lookup;
|
||||
ret = lookup->lookup_mount(ap, entry->rhost,
|
||||
strlen(entry->rhost), lookup->context);
|
||||
+ map_module_unlock(instance);
|
||||
|
||||
if (!strcmp(name, entry->rhost))
|
||||
goto out;
|
@ -1,48 +0,0 @@
|
||||
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(-)
|
||||
|
||||
diff --git a/CHANGELOG b/CHANGELOG
|
||||
index 4e5e82d0..5b37460f 100644
|
||||
--- a/CHANGELOG
|
||||
+++ b/CHANGELOG
|
||||
@@ -9,6 +9,7 @@
|
||||
- fix loop under run in cache_get_offset_parent().
|
||||
- bailout on rpc systemerror.
|
||||
- fix nfsv4 only mounts should not use rpcbind.
|
||||
+- simplify cache_add() a little.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
diff --git a/lib/cache.c b/lib/cache.c
|
||||
index 8aed28ea..4f908daf 100644
|
||||
--- a/lib/cache.c
|
||||
+++ b/lib/cache.c
|
||||
@@ -564,6 +564,7 @@ int cache_add(struct mapent_cache *mc, struct map_source *ms, const char *key, c
|
||||
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, struct map_source *ms, const char *key, c
|
||||
|
||||
existing = next;
|
||||
}
|
||||
- me->next = existing->next;
|
||||
existing->next = me;
|
||||
}
|
||||
return CHE_OK;
|
@ -1,568 +0,0 @@
|
||||
autofs-5.1.8 - switch to application wide command pipe
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Switch to use the functions previously added to allow a single
|
||||
application wide command pipe to be used.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1
|
||||
daemon/automount.c | 426 +++++++++-------------------------------------------
|
||||
daemon/master.c | 2
|
||||
include/automount.h | 1
|
||||
modules/parse_sun.c | 1
|
||||
5 files changed, 80 insertions(+), 351 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -45,6 +45,7 @@
|
||||
- add function master_find_mapent_by_devid().
|
||||
- use device id to locate autofs_point when setting log priotity.
|
||||
- add command pipe handling functions.
|
||||
+- switch to application wide command pipe.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/automount.c
|
||||
+++ autofs-5.1.8/daemon/automount.c
|
||||
@@ -69,10 +69,6 @@ const char *cmd_pipe_name = AUTOFS_FIFO_
|
||||
int start_cmd_pipe_handler(void);
|
||||
void finish_cmd_pipe_handler(void);
|
||||
|
||||
-/* autofs fifo name prefix */
|
||||
-#define FIFO_NAME_PREFIX "autofs.fifo"
|
||||
-const char *fifodir = AUTOFS_FIFO_DIR "/" FIFO_NAME_PREFIX;
|
||||
-
|
||||
const char *global_options; /* Global option, from command line */
|
||||
|
||||
static char *pid_file = NULL; /* File in which to keep pid */
|
||||
@@ -806,319 +802,6 @@ static int fullread(int fd, void *ptr, s
|
||||
return len;
|
||||
}
|
||||
|
||||
-static char *automount_path_to_fifo(unsigned logopt, const char *path)
|
||||
-{
|
||||
- char *fifo_name, *p;
|
||||
- int name_len = strlen(path) + strlen(fifodir) + 1;
|
||||
- int ret;
|
||||
-
|
||||
- fifo_name = malloc(name_len);
|
||||
- if (!fifo_name)
|
||||
- return NULL;
|
||||
- ret = snprintf(fifo_name, name_len, "%s%s", fifodir, path);
|
||||
- if (ret >= name_len) {
|
||||
- info(logopt,
|
||||
- "fifo path for \"%s\" truncated to \"%s\". This may "
|
||||
- "lead to --set-log-priority commands being sent to the "
|
||||
- "wrong automount daemon.", path, fifo_name);
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * An automount path can be made up of subdirectories. So, to
|
||||
- * create the fifo name, we will just replace instances of '/' with
|
||||
- * '-'.
|
||||
- */
|
||||
- p = fifo_name + strlen(fifodir);
|
||||
- while (*p != '\0') {
|
||||
- if (*p == '/')
|
||||
- *p = '-';
|
||||
- p++;
|
||||
- }
|
||||
-
|
||||
- debug(logopt, "fifo name %s",fifo_name);
|
||||
-
|
||||
- return fifo_name;
|
||||
-}
|
||||
-
|
||||
-static int create_logpri_fifo(struct autofs_point *ap)
|
||||
-{
|
||||
- int ret = -1;
|
||||
- int fd;
|
||||
- char *fifo_name;
|
||||
- char buf[MAX_ERR_BUF];
|
||||
-
|
||||
- fifo_name = automount_path_to_fifo(ap->logopt, ap->path);
|
||||
- if (!fifo_name) {
|
||||
- crit(ap->logopt, "Failed to allocate memory!");
|
||||
- goto out_free; /* free(NULL) is okay */
|
||||
- }
|
||||
-
|
||||
- ret = unlink(fifo_name);
|
||||
- if (ret != 0 && errno != ENOENT) {
|
||||
- crit(ap->logopt,
|
||||
- "Failed to unlink FIFO. Is the automount daemon "
|
||||
- "already running?");
|
||||
- goto out_free;
|
||||
- }
|
||||
-
|
||||
- ret = mkfifo(fifo_name, S_IRUSR|S_IWUSR);
|
||||
- if (ret != 0) {
|
||||
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- crit(ap->logopt,
|
||||
- "mkfifo for %s failed: %s", fifo_name, estr);
|
||||
- goto out_free;
|
||||
- }
|
||||
-
|
||||
- fd = open_fd(fifo_name, O_RDWR|O_NONBLOCK);
|
||||
- if (fd < 0) {
|
||||
- unlink(fifo_name);
|
||||
- ret = -1;
|
||||
- goto out_free;
|
||||
- }
|
||||
-
|
||||
- ap->logpri_fifo = fd;
|
||||
-
|
||||
-out_free:
|
||||
- free(fifo_name);
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
-int destroy_logpri_fifo(struct autofs_point *ap)
|
||||
-{
|
||||
- int ret = -1;
|
||||
- int fd = ap->logpri_fifo;
|
||||
- char *fifo_name;
|
||||
- char buf[MAX_ERR_BUF];
|
||||
-
|
||||
- if (fd == -1)
|
||||
- return 0;
|
||||
-
|
||||
- fifo_name = automount_path_to_fifo(ap->logopt, ap->path);
|
||||
- if (!fifo_name) {
|
||||
- crit(ap->logopt, "Failed to allocate memory!");
|
||||
- goto out_free; /* free(NULL) is okay */
|
||||
- }
|
||||
-
|
||||
- ap->logpri_fifo = -1;
|
||||
-
|
||||
- ret = close(fd);
|
||||
- if (ret != 0) {
|
||||
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- warn(ap->logopt,
|
||||
- "close for fifo %s: %s", fifo_name, estr);
|
||||
- }
|
||||
-
|
||||
- ret = unlink(fifo_name);
|
||||
- if (ret != 0) {
|
||||
- warn(ap->logopt,
|
||||
- "Failed to unlink FIFO. Was the fifo created OK?");
|
||||
- }
|
||||
-
|
||||
-out_free:
|
||||
- free(fifo_name);
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
-static void cleanup_stale_logpri_fifo_pipes(void)
|
||||
-{
|
||||
- size_t prefix_len = strlen(FIFO_NAME_PREFIX);
|
||||
- char *dir = AUTOFS_FIFO_DIR;
|
||||
- size_t dir_len = strlen(dir);
|
||||
- struct dirent *dent;
|
||||
- DIR *dfd;
|
||||
- int ret;
|
||||
-
|
||||
- dfd = opendir(dir);
|
||||
- if (!dfd) {
|
||||
- warn(LOGOPT_ANY, "failed to open fifo dir %s", dir);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- while ((dent = readdir(dfd))) {
|
||||
- char fifo_path[PATH_MAX];
|
||||
-
|
||||
- if (!(dent->d_type & DT_FIFO))
|
||||
- continue;
|
||||
- if (strncmp(FIFO_NAME_PREFIX, dent->d_name, prefix_len))
|
||||
- continue;
|
||||
- if ((dir_len + 1 + strlen(dent->d_name)) >= PATH_MAX) {
|
||||
- warn(LOGOPT_ANY, "fifo path too long for buffer");
|
||||
- continue;
|
||||
- }
|
||||
-
|
||||
- strcpy(fifo_path, dir);
|
||||
- strcat(fifo_path, "/");
|
||||
- strcat(fifo_path, dent->d_name);
|
||||
-
|
||||
- ret = unlink(fifo_path);
|
||||
- if (ret == -1) {
|
||||
- char buf[MAX_ERR_BUF];
|
||||
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- warn(LOGOPT_ANY, "unlink of fifo failed: %s", estr);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- closedir(dfd);
|
||||
-}
|
||||
-
|
||||
-static void handle_fifo_message(int fd)
|
||||
-{
|
||||
- struct autofs_point *ap;
|
||||
- int ret;
|
||||
- char buffer[PIPE_BUF];
|
||||
- char *end, *sep;
|
||||
- long pri;
|
||||
- char buf[MAX_ERR_BUF];
|
||||
- dev_t devid;
|
||||
-
|
||||
- memset(buffer, 0, sizeof(buffer));
|
||||
- ret = read(fd, &buffer, sizeof(buffer));
|
||||
- if (ret < 0) {
|
||||
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- warn(LOGOPT_ANY, "read on fifo returned error: %s", estr);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- sep = strrchr(buffer, ' ');
|
||||
- if (!sep) {
|
||||
- error(LOGOPT_ANY, "Incorrect cmd message format %s.", buffer);
|
||||
- return;
|
||||
- }
|
||||
- sep++;
|
||||
-
|
||||
- errno = 0;
|
||||
- devid = strtol(buffer, &end, 10);
|
||||
- if ((devid == LONG_MIN || devid == LONG_MAX) && errno == ERANGE) {
|
||||
- debug(LOGOPT_ANY, "strtol reported a range error.");
|
||||
- error(LOGOPT_ANY, "Invalid cmd message format %s.", buffer);
|
||||
- return;
|
||||
- }
|
||||
- if ((devid == 0 && errno == EINVAL) || end == buffer) {
|
||||
- debug(LOGOPT_ANY, "devid id is expected to be a integer.");
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- ap = master_find_mapent_by_devid(master_list, devid);
|
||||
- if (!ap) {
|
||||
- error(LOGOPT_ANY, "Can't locate autofs_point for device id %ld.", devid);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- errno = 0;
|
||||
- pri = strtol(sep, &end, 10);
|
||||
- if ((pri == LONG_MIN || pri == LONG_MAX) && errno == ERANGE) {
|
||||
- debug(ap->logopt, "strtol reported an %s. Failed to set "
|
||||
- "log priority.", pri == LONG_MIN ? "underflow" : "overflow");
|
||||
- return;
|
||||
- }
|
||||
- if ((pri == 0 && errno == EINVAL) || end == sep) {
|
||||
- debug(ap->logopt, "priority is expected to be an integer "
|
||||
- "in the range 0-7 inclusive.");
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- if (pri > LOG_DEBUG || pri < LOG_EMERG) {
|
||||
- debug(ap->logopt, "invalid log priority (%ld) received "
|
||||
- "on fifo", pri);
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * OK, the message passed all of the sanity checks. The
|
||||
- * automounter actually only supports three log priorities.
|
||||
- * Everything is logged at log level debug, deamon messages
|
||||
- * and everything except debug messages are logged with the
|
||||
- * verbose setting and only error and critical messages are
|
||||
- * logged when debugging isn't enabled.
|
||||
- */
|
||||
- if (pri >= LOG_WARNING) {
|
||||
- if (pri == LOG_DEBUG) {
|
||||
- set_log_debug_ap(ap);
|
||||
- info(ap->logopt, "Debug logging set for %s", ap->path);
|
||||
- } else {
|
||||
- set_log_verbose_ap(ap);
|
||||
- info(ap->logopt, "Verbose logging set for %s", ap->path);
|
||||
- }
|
||||
- } else {
|
||||
- if (ap->logopt & LOGOPT_ANY)
|
||||
- info(ap->logopt, "Basic logging set for %s", ap->path);
|
||||
- set_log_norm_ap(ap);
|
||||
- }
|
||||
-}
|
||||
-
|
||||
-static int set_log_priority(const char *path, int priority)
|
||||
-{
|
||||
- struct ioctl_ops *ops = get_ioctl_ops();
|
||||
- int fd;
|
||||
- char *fifo_name;
|
||||
- char buf[FIFO_BUF_SIZE];
|
||||
- int ret;
|
||||
- dev_t devid;
|
||||
-
|
||||
- if (!ops) {
|
||||
- fprintf(stderr, "Could not get ioctl ops\n");
|
||||
- return -1;
|
||||
- } else {
|
||||
- ret = ops->mount_device(LOGOPT_ANY, path, 0, &devid);
|
||||
- if (ret == -1 || ret == 0) {
|
||||
- fprintf(stderr,
|
||||
- "Could not find device id for mount %s\n", path);
|
||||
- return -1;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- if (priority > LOG_DEBUG || priority < LOG_EMERG) {
|
||||
- fprintf(stderr, "Log priority %d is invalid.\n", priority);
|
||||
- fprintf(stderr, "Please specify a number in the range 0-7.\n");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * This is an ascii based protocol, so we want the string
|
||||
- * representation of the integer log priority.
|
||||
- */
|
||||
- ret = snprintf(buf, sizeof(buf), "%ld %d", devid, priority);
|
||||
- if (ret >= FIFO_BUF_SIZE) {
|
||||
- fprintf(stderr, "Invalid device id or log priotity\n");
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- fifo_name = automount_path_to_fifo(LOGOPT_NONE, path);
|
||||
- if (!fifo_name) {
|
||||
- fprintf(stderr, "%s: Failed to allocate memory!\n",
|
||||
- __FUNCTION__);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * Specify O_NONBLOCK so that the open will fail if there is no
|
||||
- * daemon reading from the other side of the FIFO.
|
||||
- */
|
||||
- fd = open_fd(fifo_name, O_WRONLY|O_NONBLOCK);
|
||||
- if (fd < 0) {
|
||||
- fprintf(stderr, "%s: open of %s failed with %s\n",
|
||||
- __FUNCTION__, fifo_name, strerror(errno));
|
||||
- fprintf(stderr, "%s: perhaps the fifo wasn't setup,"
|
||||
- " please check your log for more information\n", __FUNCTION__);
|
||||
- free(fifo_name);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- if (write(fd, buf, sizeof(buf)) != sizeof(buf)) {
|
||||
- fprintf(stderr, "Failed to change logging priority. ");
|
||||
- fprintf(stderr, "write to fifo failed: %s.\n",
|
||||
- strerror(errno));
|
||||
- close(fd);
|
||||
- free(fifo_name);
|
||||
- return -1;
|
||||
- }
|
||||
- close(fd);
|
||||
- free(fifo_name);
|
||||
- fprintf(stdout, "Successfully set log priority for %s.\n", path);
|
||||
-
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
static void dummy(int sig)
|
||||
{
|
||||
}
|
||||
@@ -1127,18 +810,14 @@ static int get_pkt(struct autofs_point *
|
||||
{
|
||||
struct sigaction sa;
|
||||
sigset_t signalset;
|
||||
- struct pollfd fds[2];
|
||||
- int pollfds = 2;
|
||||
+ struct pollfd fds[1];
|
||||
+ int pollfds = 1;
|
||||
char buf[MAX_ERR_BUF];
|
||||
size_t read;
|
||||
char *estr;
|
||||
|
||||
fds[0].fd = ap->pipefd;
|
||||
fds[0].events = POLLIN;
|
||||
- fds[1].fd = ap->logpri_fifo;
|
||||
- fds[1].events = POLLIN;
|
||||
- if (fds[1].fd == -1)
|
||||
- pollfds--;
|
||||
|
||||
sa.sa_handler = dummy;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
@@ -1177,11 +856,6 @@ static int get_pkt(struct autofs_point *
|
||||
}
|
||||
return read;
|
||||
}
|
||||
-
|
||||
- if (fds[1].fd != -1 && fds[1].revents & POLLIN) {
|
||||
- debug(ap->logopt, "message pending on control fifo.");
|
||||
- handle_fifo_message(fds[1].fd);
|
||||
- }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1243,11 +917,6 @@ static int autofs_init_ap(struct autofs_
|
||||
ap->pipefd = pipefd[0];
|
||||
ap->kpipefd = pipefd[1];
|
||||
|
||||
- if (create_logpri_fifo(ap) < 0) {
|
||||
- logmsg("could not create FIFO for path %s\n", ap->path);
|
||||
- logmsg("dynamic log level changes not available for %s", ap->path);
|
||||
- }
|
||||
-
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1268,11 +937,6 @@ static int mount_autofs(struct autofs_po
|
||||
else
|
||||
status = mount_autofs_indirect(ap, root);
|
||||
|
||||
- if (status < 0) {
|
||||
- destroy_logpri_fifo(ap);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
st_add_task(ap, ST_READY);
|
||||
|
||||
return status;
|
||||
@@ -1843,6 +1507,68 @@ static void handle_cmd_pipe_fifo_message
|
||||
}
|
||||
}
|
||||
|
||||
+static int set_log_priority(const char *path, int priority)
|
||||
+{
|
||||
+ struct ioctl_ops *ops = get_ioctl_ops();
|
||||
+ char buf[FIFO_BUF_SIZE];
|
||||
+ dev_t devid;
|
||||
+ int fd;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (!ops) {
|
||||
+ fprintf(stderr, "Could not get ioctl ops\n");
|
||||
+ return -1;
|
||||
+ } else {
|
||||
+ ret = ops->mount_device(LOGOPT_ANY, path, 0, &devid);
|
||||
+ if (ret == -1 || ret == 0) {
|
||||
+ fprintf(stderr,
|
||||
+ "Could not find device id for mount %s\n", path);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (priority > LOG_DEBUG || priority < LOG_EMERG) {
|
||||
+ fprintf(stderr, "Log priority %d is invalid.\n", priority);
|
||||
+ fprintf(stderr, "Please specify a number in the range 0-7.\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * This is an ascii based protocol, so we want the string
|
||||
+ * representation of the integer log priority.
|
||||
+ */
|
||||
+ ret = snprintf(buf, sizeof(buf), "%ld %d", devid, priority);
|
||||
+ if (ret >= FIFO_BUF_SIZE) {
|
||||
+ fprintf(stderr, "Invalid device id or log priotity\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Specify O_NONBLOCK so that the open will fail if there is no
|
||||
+ * daemon reading from the other side of the FIFO.
|
||||
+ */
|
||||
+ fd = open_fd(cmd_pipe_name, O_WRONLY|O_NONBLOCK);
|
||||
+ if (fd < 0) {
|
||||
+ fprintf(stderr, "%s: open of %s failed with %s\n",
|
||||
+ __FUNCTION__, cmd_pipe_name, strerror(errno));
|
||||
+ fprintf(stderr, "%s: perhaps the fifo wasn't setup,"
|
||||
+ " please check your log for more information\n", __FUNCTION__);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (write(fd, buf, sizeof(buf)) != sizeof(buf)) {
|
||||
+ fprintf(stderr, "Failed to change logging priority. ");
|
||||
+ fprintf(stderr, "write to fifo failed: %s.\n",
|
||||
+ strerror(errno));
|
||||
+ close(fd);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ close(fd);
|
||||
+ fprintf(stdout, "Successfully set log priority for %s.\n", path);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static void cmd_pipe_dummy(int sig)
|
||||
{
|
||||
}
|
||||
@@ -2041,8 +1767,6 @@ static void handle_mounts_cleanup(void *
|
||||
|
||||
info(logopt, "shut down path %s", ap->path);
|
||||
|
||||
- destroy_logpri_fifo(ap);
|
||||
-
|
||||
/*
|
||||
* Submounts are detached threads and don't belong to the
|
||||
* master map entry list so we need to free their resources
|
||||
@@ -2972,6 +2696,18 @@ int main(int argc, char *argv[])
|
||||
|
||||
init_ioctl_ctl();
|
||||
|
||||
+ if (!start_cmd_pipe_handler()) {
|
||||
+ logerr("%s: failed to create command pipe handler thread!", program);
|
||||
+ master_kill(master_list);
|
||||
+ if (start_pipefd[1] != -1) {
|
||||
+ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat));
|
||||
+ close(start_pipefd[1]);
|
||||
+ }
|
||||
+ release_flag_file();
|
||||
+ macro_free_global_table();
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
if (!alarm_start_handler()) {
|
||||
logerr("%s: failed to create alarm handler thread!", program);
|
||||
master_kill(master_list);
|
||||
@@ -3037,13 +2773,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
- /* If the option to unlink all autofs mounts and exit has
|
||||
- * been given remove logpri fifo pipe files as all the mounts
|
||||
- * will be detached leaving them stale.
|
||||
- */
|
||||
- if (do_force_unlink & UNLINK_AND_EXIT)
|
||||
- cleanup_stale_logpri_fifo_pipes();
|
||||
- else {
|
||||
+ if (!(do_force_unlink & UNLINK_AND_EXIT)) {
|
||||
/*
|
||||
* Mmm ... reset force unlink umount so we don't also do
|
||||
* this in future when we receive a HUP signal.
|
||||
@@ -3067,6 +2797,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
master_kill(master_list);
|
||||
|
||||
+ finish_cmd_pipe_handler();
|
||||
+
|
||||
if (pid_file) {
|
||||
unlink(pid_file);
|
||||
pid_file = NULL;
|
||||
--- autofs-5.1.8.orig/daemon/master.c
|
||||
+++ autofs-5.1.8/daemon/master.c
|
||||
@@ -113,8 +113,6 @@ int master_add_autofs_point(struct maste
|
||||
|
||||
ap->state = ST_INIT;
|
||||
|
||||
- ap->logpri_fifo = -1;
|
||||
-
|
||||
ap->path = strdup(entry->path);
|
||||
if (!ap->path) {
|
||||
free(ap);
|
||||
--- autofs-5.1.8.orig/include/automount.h
|
||||
+++ autofs-5.1.8/include/automount.h
|
||||
@@ -552,7 +552,6 @@ struct autofs_point {
|
||||
int pipefd; /* File descriptor for pipe */
|
||||
int kpipefd; /* Kernel end descriptor for pipe */
|
||||
int ioctlfd; /* File descriptor for ioctls */
|
||||
- int logpri_fifo; /* FIFO used for changing log levels */
|
||||
dev_t dev; /* "Device" number assigned by kernel */
|
||||
struct master_mapent *entry; /* Master map entry for this mount */
|
||||
unsigned int type; /* Type of map direct or indirect */
|
||||
--- autofs-5.1.8.orig/modules/parse_sun.c
|
||||
+++ autofs-5.1.8/modules/parse_sun.c
|
||||
@@ -82,7 +82,6 @@ static struct parse_context default_cont
|
||||
1 /* Do slashify_colons */
|
||||
};
|
||||
|
||||
-int destroy_logpri_fifo(struct autofs_point *ap);
|
||||
static char *concat_options(char *left, char *right);
|
||||
|
||||
/* Free all storage associated with this context */
|
@ -1,155 +0,0 @@
|
||||
autofs-5.1.8 - use device id to locate autofs_point when setting log priotity
|
||||
|
||||
From: Ian Kent <raven@themaw.net>
|
||||
|
||||
Using a fifo pipe for every autofs mount to dynamically set the log
|
||||
priority is expensive in terms of the number of file handles used.
|
||||
|
||||
It would be better to use a single file handle and locate the autofs
|
||||
mount point by it's id to set the log priority.
|
||||
|
||||
Start by making the communication pipe send the device id as well as
|
||||
the log priority to be set and use the newly added helper function
|
||||
master_find_mapent_by_devid() to locate the autofs mount to change the
|
||||
log priority.
|
||||
|
||||
Signed-off-by: Ian Kent <raven@themaw.net>
|
||||
---
|
||||
CHANGELOG | 1
|
||||
daemon/automount.c | 63 ++++++++++++++++++++++++++++++++++++++++++++---------
|
||||
2 files changed, 54 insertions(+), 10 deletions(-)
|
||||
|
||||
--- autofs-5.1.8.orig/CHANGELOG
|
||||
+++ autofs-5.1.8/CHANGELOG
|
||||
@@ -43,6 +43,7 @@
|
||||
- make signal handling consistent.
|
||||
- eliminate last remaining state_pipe usage.
|
||||
- add function master_find_mapent_by_devid().
|
||||
+- use device id to locate autofs_point when setting log priotity.
|
||||
|
||||
19/10/2021 autofs-5.1.8
|
||||
- add xdr_exports().
|
||||
--- autofs-5.1.8.orig/daemon/automount.c
|
||||
+++ autofs-5.1.8/daemon/automount.c
|
||||
@@ -59,6 +59,8 @@ unsigned int mp_mode = 0755;
|
||||
unsigned int nfs_mount_uses_string_options = 0;
|
||||
static struct nfs_mount_vers vers, check = {1, 1, 1};
|
||||
|
||||
+#define FIFO_BUF_SIZE 25
|
||||
+
|
||||
/* autofs fifo name prefix */
|
||||
#define FIFO_NAME_PREFIX "autofs.fifo"
|
||||
const char *fifodir = AUTOFS_FIFO_DIR "/" FIFO_NAME_PREFIX;
|
||||
@@ -951,35 +953,57 @@ static void cleanup_stale_logpri_fifo_pi
|
||||
closedir(dfd);
|
||||
}
|
||||
|
||||
-static void handle_fifo_message(struct autofs_point *ap, int fd)
|
||||
+static void handle_fifo_message(int fd)
|
||||
{
|
||||
+ struct autofs_point *ap;
|
||||
int ret;
|
||||
char buffer[PIPE_BUF];
|
||||
- char *end;
|
||||
+ char *end, *sep;
|
||||
long pri;
|
||||
char buf[MAX_ERR_BUF];
|
||||
+ dev_t devid;
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
ret = read(fd, &buffer, sizeof(buffer));
|
||||
if (ret < 0) {
|
||||
char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
|
||||
- warn(ap->logopt, "read on fifo returned error: %s", estr);
|
||||
+ warn(LOGOPT_ANY, "read on fifo returned error: %s", estr);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ sep = strrchr(buffer, ' ');
|
||||
+ if (!sep) {
|
||||
+ error(LOGOPT_ANY, "Incorrect cmd message format %s.", buffer);
|
||||
+ return;
|
||||
+ }
|
||||
+ sep++;
|
||||
+
|
||||
+ errno = 0;
|
||||
+ devid = strtol(buffer, &end, 10);
|
||||
+ if ((devid == LONG_MIN || devid == LONG_MAX) && errno == ERANGE) {
|
||||
+ debug(LOGOPT_ANY, "strtol reported a range error.");
|
||||
+ error(LOGOPT_ANY, "Invalid cmd message format %s.", buffer);
|
||||
+ return;
|
||||
+ }
|
||||
+ if ((devid == 0 && errno == EINVAL) || end == buffer) {
|
||||
+ debug(LOGOPT_ANY, "devid id is expected to be a integer.");
|
||||
return;
|
||||
}
|
||||
|
||||
- if (ret != 2) {
|
||||
- debug(ap->logopt, "expected 2 bytes, received %d.", ret);
|
||||
+ ap = master_find_mapent_by_devid(master_list, devid);
|
||||
+ if (!ap) {
|
||||
+ error(LOGOPT_ANY, "Can't locate autofs_point for device id %ld.", devid);
|
||||
return;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
- pri = strtol(buffer, &end, 10);
|
||||
+ pri = strtol(sep, &end, 10);
|
||||
if ((pri == LONG_MIN || pri == LONG_MAX) && errno == ERANGE) {
|
||||
debug(ap->logopt, "strtol reported an %s. Failed to set "
|
||||
"log priority.", pri == LONG_MIN ? "underflow" : "overflow");
|
||||
return;
|
||||
}
|
||||
- if ((pri == 0 && errno == EINVAL) || end == buffer) {
|
||||
+ if ((pri == 0 && errno == EINVAL) || end == sep) {
|
||||
debug(ap->logopt, "priority is expected to be an integer "
|
||||
"in the range 0-7 inclusive.");
|
||||
return;
|
||||
@@ -1016,9 +1040,24 @@ static void handle_fifo_message(struct a
|
||||
|
||||
static int set_log_priority(const char *path, int priority)
|
||||
{
|
||||
+ struct ioctl_ops *ops = get_ioctl_ops();
|
||||
int fd;
|
||||
char *fifo_name;
|
||||
- char buf[2];
|
||||
+ char buf[FIFO_BUF_SIZE];
|
||||
+ int ret;
|
||||
+ dev_t devid;
|
||||
+
|
||||
+ if (!ops) {
|
||||
+ fprintf(stderr, "Could not get ioctl ops\n");
|
||||
+ return -1;
|
||||
+ } else {
|
||||
+ ret = ops->mount_device(LOGOPT_ANY, path, 0, &devid);
|
||||
+ if (ret == -1 || ret == 0) {
|
||||
+ fprintf(stderr,
|
||||
+ "Could not find device id for mount %s\n", path);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
if (priority > LOG_DEBUG || priority < LOG_EMERG) {
|
||||
fprintf(stderr, "Log priority %d is invalid.\n", priority);
|
||||
@@ -1030,7 +1069,11 @@ static int set_log_priority(const char *
|
||||
* This is an ascii based protocol, so we want the string
|
||||
* representation of the integer log priority.
|
||||
*/
|
||||
- snprintf(buf, sizeof(buf), "%d", priority);
|
||||
+ ret = snprintf(buf, sizeof(buf), "%ld %d", devid, priority);
|
||||
+ if (ret >= FIFO_BUF_SIZE) {
|
||||
+ fprintf(stderr, "Invalid device id or log priotity\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
|
||||
fifo_name = automount_path_to_fifo(LOGOPT_NONE, path);
|
||||
if (!fifo_name) {
|
||||
@@ -1129,7 +1172,7 @@ static int get_pkt(struct autofs_point *
|
||||
|
||||
if (fds[1].fd != -1 && fds[1].revents & POLLIN) {
|
||||
debug(ap->logopt, "message pending on control fifo.");
|
||||
- handle_fifo_message(ap, fds[1].fd);
|
||||
+ handle_fifo_message(fds[1].fd);
|
||||
}
|
||||
}
|
||||
}
|
111
autofs.spec
111
autofs.spec
@ -11,63 +11,11 @@
|
||||
|
||||
Summary: A tool for automatically mounting and unmounting filesystems
|
||||
Name: autofs
|
||||
Version: 5.1.8
|
||||
Release: 23%{?dist}
|
||||
Version: 5.1.9
|
||||
Release: 1%{?dist}
|
||||
Epoch: 1
|
||||
License: GPL-2.0-or-later
|
||||
Source: https://www.kernel.org/pub/linux/daemons/autofs/v5/autofs-%{version}.tar.gz
|
||||
Patch1: autofs-5.1.8-fix-kernel-mount-status-notification.patch
|
||||
Patch2: autofs-5.1.8-fix-fedfs-build-flags.patch
|
||||
Patch3: autofs-5.1.8-fix-set-open-file-limit.patch
|
||||
Patch4: autofs-5.1.8-improve-descriptor-open-error-reporting.patch
|
||||
Patch5: autofs-5.1.8-fix-root-offset-error-handling.patch
|
||||
Patch6: autofs-5.1.8-fix-fix-root-offset-error-handling.patch
|
||||
Patch7: autofs-5.1.8-fix-nonstrict-fail-handling-of-last-offset-mount.patch
|
||||
Patch8: autofs-5.1.8-dont-fail-on-duplicate-host-export-entry.patch
|
||||
Patch9: autofs-5.1.8-fix-loop-under-run-in-cache_get_offset_parent.patch
|
||||
Patch10: autofs-5.1.8-bailout-on-rpc-systemerror.patch
|
||||
Patch11: autofs-5.1.8-fix-nfsv4-only-mounts-should-not-use-rpcbind.patch
|
||||
Patch12: autofs-5.1.8-simplify-cache_add-a-little.patch
|
||||
Patch13: autofs-5.1.8-fix-use-after-free-in-tree_mapent_delete_offset_tree.patch
|
||||
Patch14: autofs-5.1.8-fix-memory-leak-in-xdr_exports.patch
|
||||
Patch15: autofs-5.1.8-avoid-calling-pthread_getspecific-with-NULL-key_thread_attempt_id.patch
|
||||
Patch16: autofs-5.1.8-fix-sysconf-return-handling.patch
|
||||
Patch17: autofs-5.1.8-remove-nonstrict-parameter-from-tree_mapent_umount_offsets.patch
|
||||
Patch18: autofs-5.1.8-fix-handling-of-incorrect-return-from-umount_ent.patch
|
||||
Patch19: autofs-5.1.8-dont-use-initgroups-at-spawn.patch
|
||||
Patch20: autofs-5.1.8-fix-missing-unlock-in-sasl_do_kinit_ext_cc.patch
|
||||
Patch21: autofs-5.1.8-fix-invalid-tsv-access.patch
|
||||
Patch22: autofs-5.1.8-configure-c99.patch
|
||||
Patch23: autofs-5.1.8-fix-autofs-regression-due-to-positive_timeout.patch
|
||||
Patch24: autofs-5.1.8-fix-parse-module-instance-mutex-naming.patch
|
||||
Patch25: autofs-5.1.8-serialise-lookup-module-open-and-reinit.patch
|
||||
Patch26: autofs-5.1.8-coverity-fix-for-invalid-access.patch
|
||||
Patch27: autofs-5.1.8-fix-hosts-map-deadlock-on-restart.patch
|
||||
Patch28: autofs-5.1.8-fix-deadlock-with-hosts-map-reload.patch
|
||||
Patch29: autofs-5.1.8-fix-memory-leak-in-update_hosts_mounts.patch
|
||||
Patch30: autofs-5.1.8-fix-minus-only-option-handling-in-concat_options.patch
|
||||
Patch31: autofs-5.1.8-fix-incorrect-path-for-is_mounted-in-try_remount.patch
|
||||
Patch32: autofs-5.1.8-fix-additional-tsv-invalid-access.patch
|
||||
Patch33: autofs-5.1.8-fix-use_ignore_mount_option-description.patch
|
||||
Patch34: autofs-5.1.8-include-addtional-log-info-for-mounts.patch
|
||||
Patch35: autofs-5.1.8-fail-on-empty-replicated-host-name.patch
|
||||
Patch36: autofs-5.1.8-improve-handling-of-ENOENT-in-sss-setautomntent.patch
|
||||
Patch37: autofs-5.1.8-dont-immediately-call-function-when-waiting.patch
|
||||
Patch38: autofs-5.1.8-fix-return-status-of-mount_autofs.patch
|
||||
Patch39: autofs-5.1.8-dont-close-lookup-at-umount.patch
|
||||
Patch40: autofs-5.1.8-fix-deadlock-in-lookups.patch
|
||||
Patch41: autofs-5.1.8-dont-delay-expire.patch
|
||||
Patch42: autofs-5.1.8-make-amd-mapent-search-function-name-clear.patch
|
||||
Patch43: autofs-5.1.8-rename-statemachine-to-signal_handler.patch
|
||||
Patch44: autofs-5.1.8-make-signal-handling-consistent.patch
|
||||
Patch45: autofs-5.1.8-eliminate-last-remaining-state_pipe-usage.patch
|
||||
Patch46: autofs-5.1.8-add-function-master_find_mapent_by_devid.patch
|
||||
Patch47: autofs-5.1.8-use-device-id-to-locate-autofs_point-when-setting-log-priotity.patch
|
||||
Patch48: autofs-5.1.8-add-command-pipe-handling-functions.patch
|
||||
Patch49: autofs-5.1.8-switch-to-application-wide-command-pipe.patch
|
||||
Patch50: autofs-5.1.8-get-rid-of-unused-field-submnt_count.patch
|
||||
Patch51: autofs-5.1.8-fix-mount-tree-startup-reconnect.patch
|
||||
Patch52: autofs-5.1.8-fix-unterminated-read-in-handle_cmd_pipe_fifo_message.patch
|
||||
|
||||
%if %{with_systemd}
|
||||
BuildRequires: systemd-units
|
||||
@ -132,58 +80,6 @@ echo %{version}-%{release} > .version
|
||||
%if %{with_fedfs}
|
||||
%define fedfs_configure_arg --enable-fedfs
|
||||
%endif
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
%patch15 -p1
|
||||
%patch16 -p1
|
||||
%patch17 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
%patch20 -p1
|
||||
%patch21 -p1
|
||||
%patch22 -p1
|
||||
%patch23 -p1
|
||||
%patch24 -p1
|
||||
%patch25 -p1
|
||||
%patch26 -p1
|
||||
%patch27 -p1
|
||||
%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
|
||||
%patch42 -p1
|
||||
%patch43 -p1
|
||||
%patch44 -p1
|
||||
%patch45 -p1
|
||||
%patch46 -p1
|
||||
%patch47 -p1
|
||||
%patch48 -p1
|
||||
%patch49 -p1
|
||||
%patch50 -p1
|
||||
%patch51 -p1
|
||||
%patch52 -p1
|
||||
|
||||
%build
|
||||
LDFLAGS=-Wl,-z,now
|
||||
@ -291,6 +187,9 @@ fi
|
||||
%dir /etc/auto.master.d
|
||||
|
||||
%changelog
|
||||
* Tue Nov 07 2023 Pavel Reichl <preichl@redhat.com> - 1:5.1.9-1
|
||||
- Update to autofs 5.1.9 release.
|
||||
|
||||
* Fri Oct 06 2023 Pavel Reichl <preichl@redhat.com> - 1:5.1.8-23
|
||||
- Convert License tag to SPDX format
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (autofs-5.1.8.tar.gz) = 69a0d5def08a1d7b4086bd89c3f582ee502605d9524a654a04c017de1704454e71f7afe7113773429e90af8ffc87bf5655403055e254a5c790d44ed877234861
|
||||
SHA512 (autofs-5.1.9.tar.gz) = 30a7a47b92c0bccacb32744709c3c45df3c5263317106bcb6737e402f03c587c748232d617a967768e49111ff95ca6bddedb1c445ed4d7eebc66c0e3ea9ed2ec
|
||||
|
Loading…
Reference in New Issue
Block a user