Compare commits

..

No commits in common. "c8" and "c8-beta" have entirely different histories.
c8 ... c8-beta

38 changed files with 296 additions and 4024 deletions

View File

@ -1,347 +0,0 @@
autofs-5.1.6 - fix ldap sasl reconnect problem
From: Ian Kent <raven@themaw.net>
When performing an ldap sasl connection a two step initialisation
was being done in an attempt to partially reuse existing connection
setup.
But if a network connectivity problem occurs the connection can end
up only half initialized and recovery after connectivity is restored
fails.
So get rid of the two step initialization, as it's benefit was at best
questionable, so that connection attempts either succeed or completely
fail. This leaves the connection completely uninitialized if there's a
network conectivity problem, ready for a new connection attempt.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1
include/lookup_ldap.h | 1
modules/cyrus-sasl.c | 131 +++++++++++++++++++++++++-------------------------
3 files changed, 68 insertions(+), 65 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -162,6 +162,7 @@
- refactor umount_amd_ext_mount().
- add flags argument to amd do_program_mount().
- fix deadlock in master_notify_submount().
+- fix ldap sasl reconnect problem.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/include/lookup_ldap.h
+++ autofs-5.1.4/include/lookup_ldap.h
@@ -87,7 +87,6 @@ struct lookup_context {
char *secret;
char *client_princ;
char *client_cc;
- int kinit_done;
int kinit_successful;
#ifdef WITH_SASL
/* Kerberos */
--- autofs-5.1.4.orig/modules/cyrus-sasl.c
+++ autofs-5.1.4/modules/cyrus-sasl.c
@@ -396,9 +396,9 @@ do_sasl_bind(unsigned logopt, LDAP *ld,
* cache, add the TGT to that cache, and set the environment variable so
* that the sasl/krb5 libraries can find our credentials.
*
- * Returns 0 upon success. ctxt->kinit_done and ctxt->kinit_successful
- * are set for cleanup purposes. The krb5 context and ccache entries in
- * the lookup_context are also filled in.
+ * Returns 0 upon success. ctxt->kinit_successful is set for cleanup
+ * purposes. The krb5 context and ccache entries in the lookup_context
+ * are also filled in.
*
* Upon failure, -1 is returned.
*/
@@ -412,9 +412,16 @@ sasl_do_kinit(unsigned logopt, struct lo
const char *realm_name;
int status, realm_length;
- if (ctxt->kinit_done)
+ status = pthread_mutex_lock(&krb5cc_mutex);
+ if (status)
+ fatal(status);
+
+ if (ctxt->kinit_successful) {
+ status = pthread_mutex_unlock(&krb5cc_mutex);
+ if (status)
+ fatal(status);
return 0;
- ctxt->kinit_done = 1;
+ }
debug(logopt,
"initializing kerberos ticket: client principal %s",
@@ -423,15 +430,14 @@ sasl_do_kinit(unsigned logopt, struct lo
ret = krb5_init_context(&ctxt->krb5ctxt);
if (ret) {
error(logopt, "krb5_init_context failed with %d", ret);
- return -1;
+ goto out_unlock;
}
ret = krb5_cc_resolve(ctxt->krb5ctxt, krb5ccval, &ctxt->krb5_ccache);
if (ret) {
error(logopt, "krb5_cc_resolve failed with error %d",
ret);
- krb5_free_context(ctxt->krb5ctxt);
- return -1;
+ goto out_free_context;
}
if (ctxt->client_princ) {
@@ -515,19 +521,11 @@ sasl_do_kinit(unsigned logopt, struct lo
goto out_cleanup_unparse;
}
- status = pthread_mutex_lock(&krb5cc_mutex);
- if (status)
- fatal(status);
-
if (krb5cc_in_use++ == 0)
/* tell the cache what the default principal is */
ret = krb5_cc_initialize(ctxt->krb5ctxt,
ctxt->krb5_ccache, krb5_client_princ);
- status = pthread_mutex_unlock(&krb5cc_mutex);
- if (status)
- fatal(status);
-
if (ret) {
error(logopt,
"krb5_cc_initialize failed with error %d", ret);
@@ -550,6 +548,10 @@ sasl_do_kinit(unsigned logopt, struct lo
}
ctxt->kinit_successful = 1;
+ status = pthread_mutex_unlock(&krb5cc_mutex);
+ if (status)
+ fatal(status);
+
debug(logopt, "Kerberos authentication was successful!");
krb5_free_unparsed_name(ctxt->krb5ctxt, tgs_name);
@@ -569,10 +571,6 @@ out_cleanup_tgs_princ:
out_cleanup_client_princ:
krb5_free_principal(ctxt->krb5ctxt, krb5_client_princ);
out_cleanup_cc:
- status = pthread_mutex_lock(&krb5cc_mutex);
- if (status)
- fatal(status);
-
if (krb5cc_in_use)
ret = krb5_cc_close(ctxt->krb5ctxt, ctxt->krb5_ccache);
else
@@ -580,22 +578,21 @@ out_cleanup_cc:
if (ret)
warn(logopt,
"krb5_cc_destroy failed with non-fatal error %d", ret);
-
+out_free_context:
+ krb5_free_context(ctxt->krb5ctxt);
+out_unlock:
status = pthread_mutex_unlock(&krb5cc_mutex);
if (status)
fatal(status);
-
- krb5_free_context(ctxt->krb5ctxt);
-
return -1;
}
/*
* Check a client given external credential cache.
*
- * Returns 0 upon success. ctxt->kinit_done and ctxt->kinit_successful
- * are set for cleanup purposes. The krb5 context and ccache entries in
- * the lookup_context are also filled in.
+ * Returns 0 upon success. ctxt->kinit_successful is set for cleanup
+ * purposes. The krb5 context and ccache entries in the lookup_context
+ * are also filled in.
*
* Upon failure, -1 is returned.
*/
@@ -606,10 +603,18 @@ sasl_do_kinit_ext_cc(unsigned logopt, st
krb5_principal krb5_client_princ;
krb5_error_code ret;
char *cc_princ, *client_princ;
+ int status;
+
+ status = pthread_mutex_lock(&krb5cc_mutex);
+ if (status)
+ fatal(status);
- if (ctxt->kinit_done)
+ if (ctxt->kinit_successful) {
+ status = pthread_mutex_unlock(&krb5cc_mutex);
+ if (status)
+ fatal(status);
return 0;
- ctxt->kinit_done = 1;
+ }
debug(logopt,
"using external credential cache for auth: client principal %s",
@@ -618,33 +623,26 @@ sasl_do_kinit_ext_cc(unsigned logopt, st
ret = krb5_init_context(&ctxt->krb5ctxt);
if (ret) {
error(logopt, "krb5_init_context failed with %d", ret);
- return -1;
+ goto out_unlock;
}
ret = krb5_cc_resolve(ctxt->krb5ctxt, ctxt->client_cc, &ctxt->krb5_ccache);
if (ret) {
error(logopt, "krb5_cc_resolve failed with error %d",
ret);
- krb5_cc_close(ctxt->krb5ctxt, ctxt->krb5_ccache);
- krb5_free_context(ctxt->krb5ctxt);
- return -1;
+ goto out_cleanup_cc;
}
ret = krb5_cc_get_principal(ctxt->krb5ctxt, ctxt->krb5_ccache, &def_princ);
if (ret) {
error(logopt, "krb5_cc_get_principal failed with error %d", ret);
- krb5_cc_close(ctxt->krb5ctxt, ctxt->krb5_ccache);
- krb5_free_context(ctxt->krb5ctxt);
- return -1;
+ goto out_cleanup_cc;
}
ret = krb5_unparse_name(ctxt->krb5ctxt, def_princ, &cc_princ);
if (ret) {
error(logopt, "krb5_unparse_name failed with error %d", ret);
- krb5_free_principal(ctxt->krb5ctxt, def_princ);
- krb5_cc_close(ctxt->krb5ctxt, ctxt->krb5_ccache);
- krb5_free_context(ctxt->krb5ctxt);
- return -1;
+ goto out_cleanup_def_princ;
}
debug(logopt, "external credential cache default principal %s", cc_princ);
@@ -667,10 +665,8 @@ sasl_do_kinit_ext_cc(unsigned logopt, st
error(logopt,
"krb5_sname_to_principal failed for "
"%s with error %d", default_client, ret);
- krb5_free_principal(ctxt->krb5ctxt, def_princ);
- krb5_cc_close(ctxt->krb5ctxt, ctxt->krb5_ccache);
- krb5_free_context(ctxt->krb5ctxt);
- return -1;
+ krb5_free_unparsed_name(ctxt->krb5ctxt, cc_princ);
+ goto out_cleanup_def_princ;
}
@@ -681,10 +677,8 @@ sasl_do_kinit_ext_cc(unsigned logopt, st
"krb5_unparse_name failed with error %d",
ret);
krb5_free_principal(ctxt->krb5ctxt, krb5_client_princ);
- krb5_free_principal(ctxt->krb5ctxt, def_princ);
- krb5_cc_close(ctxt->krb5ctxt, ctxt->krb5_ccache);
- krb5_free_context(ctxt->krb5ctxt);
- return -1;
+ krb5_free_unparsed_name(ctxt->krb5ctxt, cc_princ);
+ goto out_cleanup_def_princ;
}
debug(logopt,
@@ -711,10 +705,7 @@ sasl_do_kinit_ext_cc(unsigned logopt, st
if (!ctxt->client_princ)
krb5_free_unparsed_name(ctxt->krb5ctxt, client_princ);
krb5_free_unparsed_name(ctxt->krb5ctxt, cc_princ);
- krb5_free_principal(ctxt->krb5ctxt, def_princ);
- krb5_cc_close(ctxt->krb5ctxt, ctxt->krb5_ccache);
- krb5_free_context(ctxt->krb5ctxt);
- return -1;
+ goto out_cleanup_def_princ;
}
if (!ctxt->client_princ)
@@ -725,15 +716,24 @@ sasl_do_kinit_ext_cc(unsigned logopt, st
/* Set the environment variable to point to the external cred cache */
if (setenv(krb5ccenv, ctxt->client_cc, 1) != 0) {
error(logopt, "setenv failed with %d", errno);
- krb5_cc_close(ctxt->krb5ctxt, ctxt->krb5_ccache);
- krb5_free_context(ctxt->krb5ctxt);
- return -1;
+ goto out_cleanup_cc;
}
ctxt->kinit_successful = 1;
debug(logopt, "Kerberos authentication was successful!");
return 0;
+
+out_cleanup_def_princ:
+ krb5_free_principal(ctxt->krb5ctxt, def_princ);
+out_cleanup_cc:
+ krb5_cc_close(ctxt->krb5ctxt, ctxt->krb5_ccache);
+ krb5_free_context(ctxt->krb5ctxt);
+out_unlock:
+ status = pthread_mutex_unlock(&krb5cc_mutex);
+ if (status)
+ fatal(status);
+ return -1;
}
/*
@@ -975,11 +975,19 @@ void autofs_sasl_dispose(struct ldap_con
{
int status, ret;
+ status = pthread_mutex_lock(&krb5cc_mutex);
+ if (status)
+ fatal(status);
+
if (ctxt->sasl_mech && !strncmp(ctxt->sasl_mech, "EXTERNAL", 8)) {
if (conn && conn->ldap) {
ldap_unbind_s(conn->ldap);
conn->ldap = NULL;
+ ctxt->kinit_successful = 0;
}
+ status = pthread_mutex_unlock(&krb5cc_mutex);
+ if (status)
+ fatal(status);
return;
}
@@ -989,10 +997,6 @@ void autofs_sasl_dispose(struct ldap_con
}
if (ctxt->kinit_successful) {
- status = pthread_mutex_lock(&krb5cc_mutex);
- if (status)
- fatal(status);
-
if (--krb5cc_in_use || ctxt->client_cc)
ret = krb5_cc_close(ctxt->krb5ctxt, ctxt->krb5_ccache);
else
@@ -1001,19 +1005,18 @@ void autofs_sasl_dispose(struct ldap_con
logmsg("krb5_cc_destroy failed with non-fatal error %d",
ret);
- status = pthread_mutex_unlock(&krb5cc_mutex);
- if (status)
- fatal(status);
-
krb5_free_context(ctxt->krb5ctxt);
if (unsetenv(krb5ccenv) != 0)
logerr("unsetenv failed with error %d", errno);
ctxt->krb5ctxt = NULL;
ctxt->krb5_ccache = NULL;
- ctxt->kinit_done = 0;
ctxt->kinit_successful = 0;
}
+
+ status = pthread_mutex_unlock(&krb5cc_mutex);
+ if (status)
+ fatal(status);
}
static void *sasl_mutex_new(void)

View File

@ -1,72 +0,0 @@
autofs-5.1.7 - clear per-mount timeout if not set
From: Ian Kent <raven@themaw.net>
If the per-mount timeout isn't set in the amd map entry clear it so
that updates that remove the setting are seen.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
lib/mounts.c | 8 +++++++-
modules/parse_amd.c | 12 ++++++++----
3 files changed, 16 insertions(+), 5 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -176,6 +176,7 @@
- fix remount_active_mount() not remounting symlinks.
- log when setting amd per-mount timeout.
- update per-mount expire timeout on readmap.
+- clear per-mount timeout if not set.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -2696,8 +2696,14 @@ void update_mounted_mounts_timeout(struc
goto next;
/* No per-mount timeout set? */
- if (!(mnt->amd_flags & AMD_MOUNT_OPT_MASK))
+ if (!(mnt->amd_flags & AMD_MOUNT_OPT_MASK)) {
+ /* Per-mount timeout setting isn't present, reset to
+ * be sure updates are seen.
+ */
+ if (ops)
+ ops->timeout(ap->logopt, ap->ioctlfd, de[n]->d_name, -1);
goto next;
+ }
/* The default in autofs is to always expire mounts according to
* a timeout set in the autofs mount super block information
--- autofs-5.1.4.orig/modules/parse_amd.c
+++ autofs-5.1.4/modules/parse_amd.c
@@ -1720,10 +1720,16 @@ static int amd_mount(struct autofs_point
}
if (!ret) {
- struct ioctl_ops *ops;
+ struct ioctl_ops *ops = get_ioctl_ops();
- if (!(per_mnt_flags & AMD_MOUNT_OPT_MASK))
+ if (!(per_mnt_flags & AMD_MOUNT_OPT_MASK)) {
+ /* Per-mount timeout setting isn't present, reset to
+ * be sure updates are seen.
+ */
+ if (ops)
+ ops->timeout(ap->logopt, ap->ioctlfd, name, -1);
goto done;
+ }
/* The mount succeeded, make sure there's no path component
* seperator in "name" as it must be the last component of
@@ -1734,8 +1740,6 @@ static int amd_mount(struct autofs_point
goto done;
}
- ops = get_ioctl_ops();
-
/* The default in autofs is to always expire mounts according to
* a timeout set in the autofs mount super block information
* structure. But amd allows for differing expire timeouts on a

View File

@ -1,132 +0,0 @@
autofs-5.1.8 - always recreate credential cache
From: Ian Collier <imc@cs.ox.ac.uk>
In recent Kerberos revisions when a TGT expires autofs will fail to
renew the ticket.
Expired creds are being pulled out of the cache and in that case the patched
version clears the cache to remove the expired creds.
If the cache is already in use, try to pull out a cred and then if that
was successful and the cred is expired, clear the cache.
So this fixes the behaviour I was seeing, since that was happening because
expired creds were being pulled out of the cache and in that case the patched
version clears the cache to remove the expired creds.
What sort of race conditions might happen here?
- If the function is called very late during the validity of a ticket, it
might expire after the decision not to clear the cache. In that case,
the behaviour is the same as the unpatched version, but this is highly
unlikely because do_kinit is not supposed to happen while there is a
valid ticket.
- If two or more threads decide to call do_kinit at about the same time:
it's protected by a mutex, so one of the calls will happen first; this
call will clear the cache and add a new ticket. When the others kick
in, the cache won't be cleared because it's only cleared if we can
find an expired ticket in the cache and any such ticket was removed
when the first do_kinit happened.
- If one thread does do_kinit while another thread is trying to do a lookup:
if the current ticket is expired then the lookup would have failed anyway;
if it's not expired then we won't clear the cache.
- If there is both an expired and a valid ticket in the cache:
this only happens if two or more do_kinits clashed and stored tickets
with different expiration times, and if the current time is between those
times. The current bug happens because krb5 cache retrieval is returning
the earliest (i.e. expired) ticket. When that's the case then do_kinit
will clear the cache because when it tests the cache it will pull the
expired cred - and it needs to do this because otherwise all lookups are
failing (that's the bug). In a case where krb5 cache retrieval returns
the valid ticket, it doesn't matter that the cache is not cleared because
any subsequent lookups will use that valid ticket.
Signed-off-by: Ian Collier <imc@cs.ox.ac.uk>
---
CHANGELOG | 1
modules/cyrus-sasl.c | 53 +++++++++++++++++++++++++++++++++++++++------------
2 files changed, 42 insertions(+), 12 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -163,6 +163,7 @@
- add flags argument to amd do_program_mount().
- fix deadlock in master_notify_submount().
- fix ldap sasl reconnect problem.
+- always recreate credential cache.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/modules/cyrus-sasl.c
+++ autofs-5.1.4/modules/cyrus-sasl.c
@@ -509,6 +509,46 @@ sasl_do_kinit(unsigned logopt, struct lo
debug(logopt, "Using tgs name %s", tgs_name);
memset(&my_creds, 0, sizeof(my_creds));
+
+ if (krb5cc_in_use++ == 0) {
+ /* tell the cache what the default principal is */
+ ret = krb5_cc_initialize(ctxt->krb5ctxt,
+ ctxt->krb5_ccache, krb5_client_princ);
+
+ if (ret) {
+ --krb5cc_in_use;
+ error(logopt,
+ "krb5_cc_initialize failed with error %d", ret);
+ goto out_cleanup_unparse;
+ }
+ }
+ else {
+ krb5_creds match_creds, out_creds;
+ time_t now = monotonic_time(NULL);
+
+ /* even if the cache is in use, we will clear it if it
+ * contains an expired credential for our principal,
+ * because Kerberos doesn't always work well with caches
+ * that contain both expired and valid credentials
+ */
+ memset(&match_creds, 0, sizeof match_creds);
+ match_creds.client = krb5_client_princ;
+ match_creds.server = tgs_princ;
+ ret = krb5_cc_retrieve_cred(ctxt->krb5ctxt, ctxt->krb5_ccache,
+ 0, &match_creds, &out_creds);
+ if (ret == 0 && (time_t) out_creds.times.endtime < now) {
+ debug(logopt,
+ "calling krb5_cc_initialize to clear expired tickets");
+ ret = krb5_cc_initialize(ctxt->krb5ctxt,
+ ctxt->krb5_ccache, krb5_client_princ);
+ if (ret)
+ warn(logopt,
+ "krb5_cc_initialize failed with error %d "
+ "while trying to clear existing cache",
+ ret);
+ }
+ }
+
ret = krb5_get_init_creds_keytab(ctxt->krb5ctxt, &my_creds,
krb5_client_princ,
NULL /*keytab*/,
@@ -521,18 +561,7 @@ sasl_do_kinit(unsigned logopt, struct lo
goto out_cleanup_unparse;
}
- if (krb5cc_in_use++ == 0)
- /* tell the cache what the default principal is */
- ret = krb5_cc_initialize(ctxt->krb5ctxt,
- ctxt->krb5_ccache, krb5_client_princ);
-
- if (ret) {
- error(logopt,
- "krb5_cc_initialize failed with error %d", ret);
- goto out_cleanup_creds;
- }
-
- /* and store credentials for that principal */
+ /* and store credentials for our principal */
ret = krb5_cc_store_cred(ctxt->krb5ctxt, ctxt->krb5_ccache, &my_creds);
if (ret) {
error(logopt,

View File

@ -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.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -165,6 +165,7 @@
- fix ldap sasl reconnect problem.
- always recreate credential cache.
- fix always recreate credential cache.
+- fix missing unlock in sasl_do_kinit_ext_cc().
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/modules/cyrus-sasl.c
+++ autofs-5.1.4/modules/cyrus-sasl.c
@@ -751,6 +751,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:

View File

@ -1,60 +0,0 @@
autofs-5.1.9 - add flags argument to amd do_program_mount()
From: Ian Kent <raven@themaw.net>
Most of the amd mount functions take a flags argument that allows them
to alter their function based on configuration.
For example the amd option autofs_use_lofs will use bind mounts instead
of symlinks in some cases which might be preferred.
The program mount function was not being passed this parameter but the
design of all the amd mount functions is quite similar and adding the
flag works as expected..
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
modules/parse_amd.c | 7 ++++---
2 files changed, 5 insertions(+), 3 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -160,6 +160,7 @@
- don't free ext mount if mounted.
- refactor amd function do_program_mount().
- refactor umount_amd_ext_mount().
+- add flags argument to amd do_program_mount().
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/modules/parse_amd.c
+++ autofs-5.1.4/modules/parse_amd.c
@@ -1405,7 +1405,8 @@ out:
}
static int do_program_mount(struct autofs_point *ap,
- struct amd_entry *entry, const char *name)
+ struct amd_entry *entry, const char *name,
+ unsigned int flags)
{
int rv = 1;
@@ -1479,7 +1480,7 @@ static int do_program_mount(struct autof
goto out;
}
done:
- rv = do_link_mount(ap, name, entry, 0);
+ rv = do_link_mount(ap, name, entry, flags);
if (rv) {
if (!umount_amd_ext_mount(ap, entry->fs, 1)) {
debug(ap->logopt, MODPREFIX
@@ -1708,7 +1709,7 @@ static int amd_mount(struct autofs_point
case AMD_MOUNT_TYPE_PROGRAM:
if (!validate_program_options(ap->logopt, entry))
return 1;
- ret = do_program_mount(ap, entry, name);
+ ret = do_program_mount(ap, entry, name, flags);
break;
default:

View File

@ -1,122 +0,0 @@
autofs-5.1.9 - add function table_lookup_ino()
From: Ian Kent <raven@themaw.net>
Add function table_lookup_ino() to try and locate a mount for a given
device, open a file handle for it, and return it's path in the provided
buffer.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1
include/mounts.h | 1
lib/mounts.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 80 insertions(+)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -188,6 +188,7 @@
- fix direct mount trigger umount failure case.
- refactor do_umount_autofs_direct().
- fix stale direct mount trigger not umounted on expire.
+- add function table_lookup_ino().
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/include/mounts.h
+++ autofs-5.1.4/include/mounts.h
@@ -175,6 +175,7 @@ void mnts_remove_amdmounts(struct autofs
struct mnt_list *mnts_add_mount(struct autofs_point *ap, const char *name, unsigned int flags);
void mnts_remove_mount(const char *mp, unsigned int flags);
struct mnt_list *get_mnt_list(const char *path, int include);
+char *table_lookup_ino(struct autofs_point *ap, dev_t dev, ino_t ino, char *buf, size_t len, int *fd);
unsigned int mnts_has_mounted_mounts(struct autofs_point *ap);
int tree_traverse_inorder(struct tree_node *n, tree_work_fn_t work, void *ptr);
void tree_free(struct tree_node *root);
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -2330,6 +2330,84 @@ void free_mnt_list(struct mnt_list *list
}
}
+char *table_lookup_ino(struct autofs_point *ap,
+ dev_t dev, ino_t ino,
+ char *buf, size_t len, int *fd)
+{
+ struct ioctl_ops *ops;
+ struct mntent *mnt;
+ struct mntent mnt_wrk;
+ char tmp[PATH_MAX * 3];
+ char *path = NULL;
+ FILE *tab;
+ int ret = 0;
+
+ ops = get_ioctl_ops();
+ if (!ops) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ tab = open_fopen_r(_PROC_MOUNTS);
+ if (!tab) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ while ((mnt = local_getmntent_r(tab, &mnt_wrk, tmp, PATH_MAX * 3))) {
+ unsigned int type;
+ int ioctlfd;
+ dev_t devid;
+
+ if (strcmp(mnt->mnt_type, "autofs"))
+ continue;
+
+ type = t_direct;
+ if (strstr(mnt->mnt_opts, "indirect"))
+ type = t_indirect;
+ else if (strstr(mnt->mnt_opts, "offset"))
+ type = t_offset;
+
+ ret = ops->mount_device(ap->logopt, mnt->mnt_dir, type, &devid);
+ if (ret == -1 || ret == 0)
+ continue;
+
+ /* Our <device, inode> should be unique so there can only
+ * be one.
+ */
+ ioctlfd = open_ioctlfd(ap, mnt->mnt_dir, devid);
+ /* errno will be set on fail */
+ if (ioctlfd == -1)
+ break;
+ if (fd > 0) {
+ struct stat st;
+
+ if (fstat(ioctlfd, &st) == -1) {
+ ops->close(ap->logopt, ioctlfd);
+ break;
+ }
+
+ if (strlen(mnt->mnt_dir) >= len) {
+ ops->close(ap->logopt, ioctlfd);
+ errno = ENAMETOOLONG;
+ break;
+ }
+
+ if (st.st_dev == dev && st.st_ino == ino) {
+ strcpy(buf, mnt->mnt_dir);
+ path = buf;
+ *fd = ioctlfd;
+ break;
+ }
+ ops->close(ap->logopt, ioctlfd);
+ break;
+ }
+ }
+ fclose(tab);
+
+ return path;
+}
+
static int table_is_mounted(const char *mp, unsigned int type)
{
struct mntent *mnt;

View File

@ -1,221 +0,0 @@
commit 6cbb6e9a3b8b223babf723e0f56cdd7b7eb90455
Author: Ian Kent <raven@themaw.net>
Date: Mon Jul 8 11:04:11 2024 +0800
autofs-5.1.9 - add some unimplemented amd map options
Add handling for amd per-mount options "utimeout", "unmount" and "nounmount"
if the kernel supports it.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
include/mounts.h | 2 ++
include/parse_amd.h | 6 ++++++
lib/mounts.c | 4 ++++
modules/amd_parse.y | 38 +++++++++++++++++++++++++++++++-------
modules/parse_amd.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 94 insertions(+), 7 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -171,6 +171,7 @@
- seperate amd mount and entry flags.
- make iocl ops ->timeout() handle per-dentry expire.
- refactor amd mount options handling.
+- add some unimplemented amd map options.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/include/mounts.h
+++ autofs-5.1.4/include/mounts.h
@@ -113,6 +113,8 @@ struct mnt_list {
char *amd_pref;
char *amd_type;
char *amd_opts;
+ unsigned long amd_flags;
+ unsigned int amd_utimeout;
unsigned int amd_cache_opts;
struct list_head amdmount;
--- autofs-5.1.4.orig/include/parse_amd.h
+++ autofs-5.1.4/include/parse_amd.h
@@ -33,6 +33,11 @@
#define AMD_MOUNT_TYPE_PROGRAM 0x00004000
#define AMD_MOUNT_TYPE_MASK 0x0000ffff
+#define AMD_MOUNT_OPT_UNMOUNT 0x00010000
+#define AMD_MOUNT_OPT_NOUNMOUNT 0x00020000
+#define AMD_MOUNT_OPT_UTIMEOUT 0x00040000
+#define AMD_MOUNT_OPT_MASK 0x00ff0000
+
#define AMD_DEFAULTS_MERGE 0x0001
#define AMD_DEFAULTS_RESET 0x0002
#define AMD_DEFAULTS_MASK 0x00ff
@@ -49,6 +54,7 @@
struct amd_entry {
char *path;
unsigned long flags;
+ unsigned int utimeout;
unsigned int cache_opts;
unsigned int entry_flags;
char *type;
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -1212,6 +1212,8 @@ struct mnt_list *mnts_add_amdmount(struc
this->amd_pref = pref;
this->amd_type = type;
this->amd_opts = opts;
+ this->amd_flags = entry->flags;
+ this->amd_utimeout = entry->utimeout;
this->amd_cache_opts = entry->cache_opts;
this->flags |= MNTS_AMD_MOUNT;
if (list_empty(&this->amdmount))
@@ -1256,6 +1258,8 @@ static void __mnts_remove_amdmount(const
free(this->amd_opts);
this->amd_opts = NULL;
}
+ this->amd_flags = AMD_MOUNT_OPT_UNMOUNT;
+ this->amd_utimeout = -1;
this->amd_cache_opts = 0;
__mnts_put_mount(this);
}
--- autofs-5.1.4.orig/modules/amd_parse.y
+++ autofs-5.1.4/modules/amd_parse.y
@@ -647,8 +647,7 @@ static int match_mnt_option(char *option
{
int ret = 0;
- if (!strcmp(option, "fullybrowsable") ||
- !strcmp(option, "nounmount")) {
+ if (!strcmp(option, "fullybrowsable")) {
sprintf(msg_buf, "option %s is not currently "
"implemented, ignored", option);
amd_info(msg_buf);
@@ -660,15 +659,37 @@ static int match_mnt_option(char *option
sprintf(msg_buf, "option %s is not used by "
"autofs, ignored", option);
amd_info(msg_buf);
+ } else if (!strcmp(option, "umount")) {
+ entry.flags &= ~AMD_MOUNT_OPT_NOUNMOUNT;
+ entry.flags |= AMD_MOUNT_OPT_UNMOUNT;
+ } else if (!strcmp(option, "nounmount")) {
+ if (entry.flags & AMD_MOUNT_TYPE_AUTO)
+ prepend_opt(opts, "timeout=0");
+ else {
+ entry.flags &= ~AMD_MOUNT_OPT_UNMOUNT;
+ entry.flags |= AMD_MOUNT_OPT_NOUNMOUNT;
+ entry.utimeout = 0;
+ }
} else if (!strncmp(option, "utimeout=", 9)) {
+ /*
+ * amd type "auto" mounts map to autofs fstype=autofs
+ * mounts so a distinct autofs mount is present at the
+ * the root so there's no need for special handling,
+ * just pass the timeout=<seconds> autofs option.
+ */
if (entry.flags & AMD_MOUNT_TYPE_AUTO)
prepend_opt(options, ++option);
else {
- sprintf(msg_buf, "umount timeout can't be "
- "used for other than type "
- "\"auto\" with autofs, "
- "ignored");
- amd_info(msg_buf);
+ if (strchr(option, '=')) {
+ unsigned long tout;
+ int ret;
+
+ ret = sscanf(option, "utimeout=%lu", &tout);
+ if (ret) {
+ entry.flags |= AMD_MOUNT_OPT_UTIMEOUT;
+ entry.utimeout = tout;
+ }
+ }
}
} else
ret = 1;
@@ -791,6 +812,8 @@ static void local_init_vars(void)
{
memset(&entry, 0, sizeof(entry));
entry.cache_opts = AMD_CACHE_OPTION_NONE;
+ entry.flags = AMD_MOUNT_OPT_UNMOUNT;
+ entry.utimeout = -1;
memset(opts, 0, sizeof(opts));
}
@@ -900,6 +923,7 @@ static int add_location(void)
new->path = entry.path;
}
new->flags = entry.flags;
+ new->utimeout = entry.utimeout;
new->cache_opts = entry.cache_opts;
new->entry_flags = entry.entry_flags;
new->type = entry.type;
--- autofs-5.1.4.orig/modules/parse_amd.c
+++ autofs-5.1.4/modules/parse_amd.c
@@ -1647,6 +1647,7 @@ static int amd_mount(struct autofs_point
struct parse_context *ctxt)
{
unsigned long fstype = entry->flags & AMD_MOUNT_TYPE_MASK;
+ unsigned long per_mnt_flags = entry->flags & AMD_MOUNT_OPT_MASK;
int ret = 1;
switch (fstype) {
@@ -1718,6 +1719,55 @@ static int amd_mount(struct autofs_point
break;
}
+ if (!ret) {
+ struct ioctl_ops *ops;
+
+ if (!(per_mnt_flags & AMD_MOUNT_OPT_MASK))
+ goto done;
+
+ /* The mount succeeded, make sure there's no path component
+ * seperator in "name" as it must be the last component of
+ * the mount point alone for the per-mount options.
+ */
+ if (strchr(name, '/')) {
+ warn(ap->logopt, "path component seperator not valid here");
+ goto done;
+ }
+
+ ops = get_ioctl_ops();
+
+ /* The default in autofs is to always expire mounts according to
+ * a timeout set in the autofs mount super block information
+ * structure. But amd allows for differing expire timeouts on a
+ * per-mount basis. It also has (context sensitive) options "unmount"
+ * to say expire this mount and "nounmount" to say don't expire this
+ * mount. In amd mounts these options are set by default according
+ * to whether a mount should expire or not, for example a cd mount
+ * is set "nounmount". Setting defaults like this is not used in the
+ * autofs amd implementation because there's only one, little used,
+ * removable file system available.
+ *
+ * But the "nounmount" and "utimeout" options can be useful.
+ */
+ if (per_mnt_flags & AMD_MOUNT_OPT_NOUNMOUNT) {
+ if (entry->utimeout)
+ warn(ap->logopt,
+ "non-zero timeout set, possible conflicting options");
+
+ /* "nounmount" option, don't expire this mount. */
+ if (ops)
+ ops->timeout(ap->logopt, ap->ioctlfd, name, 0);
+ } else if (per_mnt_flags & AMD_MOUNT_OPT_UTIMEOUT) {
+ if (!entry->utimeout)
+ warn(ap->logopt,
+ "zero timeout set, possible conflicting options");
+
+ /* "utimeout" option, expire this mount according to a timeout. */
+ if (ops)
+ ops->timeout(ap->logopt, ap->ioctlfd, name, entry->utimeout);
+ }
+ }
+done:
return ret;
}

View File

@ -1,53 +0,0 @@
autofs-5.1.9 - don't free ext mount if mounted
From: Ian Kent <raven@themaw.net>
If an external mount is in use when a umount is attempted don't free
it just let the reference count go to zero.
This will leave the mount in place and it won't get umounted. But if
another automount uses it it's reference count will become no zero
allowing for it to be umounted as normal if it isn't in use during
automount expire.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
lib/mounts.c | 8 ++++----
2 files changed, 5 insertions(+), 4 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -157,6 +157,7 @@
- fix submount shutdown race.
- fix amd external mount error handling.
- fix amd external mount mount handling.
+- don't free ext mount if mounted.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -906,10 +906,10 @@ int ext_mount_remove(const char *path)
if (!em)
goto done;
- em->ref--;
if (em->ref)
- goto done;
- else {
+ em->ref--;
+
+ if (!em->ref && !is_mounted(path, MNTS_REAL)) {
hlist_del_init(&em->mount);
free(em->mp);
if (em->umount)
@@ -931,7 +931,7 @@ int ext_mount_inuse(const char *path)
em = ext_mount_lookup(path);
if (!em)
goto done;
- ret = em->ref;
+ ret = 1;
done:
ext_mount_hash_mutex_unlock();
return ret;

View File

@ -1,36 +0,0 @@
autofs-5.1.9 - fix always recreate credential cache
From: Ian Kent <raven@themaw.net>
When I aplied the original patch from Ian Collier for this I changed
the credential end time comparison to be against the time returned from
monotomic_time(). But this isn't the same as the calander time returned
from time() which Ian used in his original patch.
Signed-off-by: Ian Kent < raven@themaw.net>
---
CHANGELOG | 1 +
modules/cyrus-sasl.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -164,6 +164,7 @@
- fix deadlock in master_notify_submount().
- fix ldap sasl reconnect problem.
- always recreate credential cache.
+- fix always recreate credential cache.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/modules/cyrus-sasl.c
+++ autofs-5.1.4/modules/cyrus-sasl.c
@@ -524,7 +524,7 @@ sasl_do_kinit(unsigned logopt, struct lo
}
else {
krb5_creds match_creds, out_creds;
- time_t now = monotonic_time(NULL);
+ time_t now = time(NULL);
/* even if the cache is in use, we will clear it if it
* contains an expired credential for our principal,

View File

@ -1,36 +0,0 @@
commit abf2030556dfe694dc19ed2d73f84f7e5046b660
Author: Ian Kent <raven@themaw.net>
Date: Thu Jul 11 13:56:15 2024 +0800
autofs-5.1.9 - fix amd cache options not copied
The cache options set when parsing the amd map entry are not copied to
the list entry that gets processed by the caller.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
modules/amd_parse.y | 1 +
2 files changed, 2 insertions(+)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -167,6 +167,7 @@
- fix always recreate credential cache.
- fix missing unlock in sasl_do_kinit_ext_cc().
- handle sss special case getautomntbyname() error.
+- fix amd cache options not copied.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/modules/amd_parse.y
+++ autofs-5.1.4/modules/amd_parse.y
@@ -888,6 +888,7 @@ static int add_location(void)
new->path = entry.path;
}
new->flags = entry.flags;
+ new->cache_opts = entry.cache_opts;
new->type = entry.type;
new->map_type = entry.map_type;
new->pref = entry.pref;

View File

@ -1,55 +0,0 @@
autofs-5.1.9 - fix amd external mount error handling
From: Ian Kent <raven@themaw.net>
An amd program mount might have defined its own umount program to be used
for external mounts.
In mount failure cases where the mount needs to be umounted be sure to
use the custom umount if there is one.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
modules/parse_amd.c | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -155,6 +155,7 @@
- fix get parent multi-mount check in try_remount().
- fix deadlock in remount.
- fix submount shutdown race.
+- fix amd external mount error handling.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/modules/parse_amd.c
+++ autofs-5.1.4/modules/parse_amd.c
@@ -1183,7 +1183,7 @@ static int do_generic_mount(struct autof
}
/* If we have an external mount add it to the list */
if (umount && !ext_mount_add(entry->fs, entry->umount)) {
- umount_ent(ap, entry->fs);
+ umount_amd_ext_mount(ap, entry->fs);
error(ap->logopt, MODPREFIX
"error: could not add external mount %s",
entry->fs);
@@ -1233,7 +1233,7 @@ static int do_nfs_mount(struct autofs_po
}
/* We might be using an external mount */
if (umount && !ext_mount_add(entry->fs, entry->umount)) {
- umount_ent(ap, entry->fs);
+ umount_amd_ext_mount(ap, entry->fs);
error(ap->logopt, MODPREFIX
"error: could not add external mount %s", entry->fs);
ret = 1;
@@ -1462,7 +1462,7 @@ static int do_program_mount(struct autof
"%s: mounted %s", entry->type, entry->fs);
goto do_free;
}
- umount_ent(ap, entry->fs);
+ umount_amd_ext_mount(ap, entry->fs);
}
if (!ext_mount_inuse(entry->fs))

View File

@ -1,71 +0,0 @@
autofs-5.1.9 - fix amd external mount mount handling
From: Ian Kent <raven@themaw.net>
Amd external mounts exist outside of the autofs file system and need
extra effort to try and keep track of them so they are mounted and
umounted when they should be.
Cleanup cases where an external mount is already mounted.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
modules/parse_amd.c | 21 ++++++++++++---------
2 files changed, 13 insertions(+), 9 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -156,6 +156,7 @@
- fix deadlock in remount.
- fix submount shutdown race.
- fix amd external mount error handling.
+- fix amd external mount mount handling.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/modules/parse_amd.c
+++ autofs-5.1.4/modules/parse_amd.c
@@ -1182,8 +1182,9 @@ static int do_generic_mount(struct autof
umount = 1;
}
/* If we have an external mount add it to the list */
- if (umount && !ext_mount_add(entry->fs, entry->umount)) {
- umount_amd_ext_mount(ap, entry->fs);
+ if (!ext_mount_add(entry->fs, entry->umount)) {
+ if (umount)
+ umount_amd_ext_mount(ap, entry->fs);
error(ap->logopt, MODPREFIX
"error: could not add external mount %s",
entry->fs);
@@ -1232,8 +1233,9 @@ static int do_nfs_mount(struct autofs_po
umount = 1;
}
/* We might be using an external mount */
- if (umount && !ext_mount_add(entry->fs, entry->umount)) {
- umount_amd_ext_mount(ap, entry->fs);
+ if (!ext_mount_add(entry->fs, entry->umount)) {
+ if (umount)
+ umount_amd_ext_mount(ap, entry->fs);
error(ap->logopt, MODPREFIX
"error: could not add external mount %s", entry->fs);
ret = 1;
@@ -1435,12 +1437,13 @@ static int do_program_mount(struct autof
* before executing the mount command and removing it at
* umount.
*/
- if (ext_mount_inuse(entry->fs)) {
+ if (is_mounted(entry->fs, MNTS_REAL)) {
+ if (!ext_mount_add(entry->fs, entry->umount)) {
+ error(ap->logopt, MODPREFIX
+ "error: could not add external mount %s", entry->fs);
+ goto out;
+ }
rv = 0;
- /* An external mount with path entry->fs exists
- * so ext_mount_add() won't fail.
- */
- ext_mount_add(entry->fs, entry->umount);
} else {
rv = mkdir_path(entry->fs, mp_mode);
if (rv && errno != EEXIST) {

View File

@ -1,48 +0,0 @@
autofs-5.1.9 - fix cache writelock must be taken in update_map_cache()
From: Ian Kent <raven@themaw.net>
In update_map_cache() the cache writelock must be taken because we need
to clean up the map entry as it will be a problem later if we don't.
It's possible that some other process has taken the lock temporarily but
when this function is called the thread does not hold any cache locks so
it should be ok to aquire it.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/automount.c | 12 +++++-------
2 files changed, 6 insertions(+), 7 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -181,6 +181,7 @@
- skip expire check for amd nounmount mounts.
- quiet possibly noisy log message.
- fix devid update on reload.
+- fix cache writelock must be taken in update_map_cache().
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/automount.c
+++ autofs-5.1.4/daemon/automount.c
@@ -512,13 +512,11 @@ static void update_map_cache(struct auto
}
mc = map->mc;
- /* If the lock is busy try later */
- if (cache_try_writelock(mc)) {
- me = cache_lookup_distinct(mc, key);
- if (me && me->ioctlfd == -1)
- cache_delete(mc, key);
- cache_unlock(mc);
- }
+ cache_writelock(mc);
+ me = cache_lookup_distinct(mc, key);
+ if (me && me->ioctlfd == -1)
+ cache_delete(mc, key);
+ cache_unlock(mc);
map = map->next;
}

View File

@ -1,66 +0,0 @@
autofs-5.1.9 - fix deadlock in master_notify_submount()
From: Ian Kent <raven@themaw.net>
A deadlock between mnts_remove_submount() and master_notify_submount()
can occur because master_notify_submount() holds the state mutex over
a call to mnts_find_submount() which then needs to take mnts_hash_mutex.
But mnts_remove_submount() takes mnts_hash_mutex and then needs to take
the state mutex to clear the ->ap field so deadlock cann occur.
But it isn't necessary for master_notify_submount() to take the state
mutex before calling mnts_find_submount() because if the submount is'
found a reference is taken on the entry so it won't go away while it's
being used. All that's needed is to ensure that the ->ap field doesn't
get set to NULL by mnts_remove_submount() while it's being used to check
if the submount has shutdown.
Fixes: 81ac572466e3 ("autofs-5.1.9 - fix submount shutdown race")
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/master.c | 7 +++----
2 files changed, 4 insertions(+), 4 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -161,6 +161,7 @@
- refactor amd function do_program_mount().
- refactor umount_amd_ext_mount().
- add flags argument to amd do_program_mount().
+- fix deadlock in master_notify_submount().
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/master.c
+++ autofs-5.1.4/daemon/master.c
@@ -1237,26 +1237,25 @@ int master_notify_submount(struct autofs
* 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;
+ st_mutex_lock();
if (!sbmnt->ap ||
(sbmnt->ap->state != ST_SHUTDOWN_PENDING &&
sbmnt->ap->state != ST_SHUTDOWN_FORCE)) {
ret = 0;
+ st_mutex_unlock();
mnts_put_mount(sbmnt);
break;
}
+ st_mutex_unlock();
mnts_put_mount(sbmnt);
- st_mutex_unlock();
while (nanosleep(&t, &r) == -1 && errno == EINTR)
memcpy(&t, &r, sizeof(struct timespec));
- st_mutex_lock();
}
- st_mutex_unlock();
done:
mnts_put_mount(this);
}

View File

@ -1,180 +0,0 @@
autofs-5.1.9 - fix devid update on reload
From: Ian Kent <raven@themaw.net>
On map update if there's a direct mount in the master map it may be
associated with multiple maps.
If there's an entry that's been removed but is present in another map
and the removed entry has a real mount associated with it special case
handling is needed.
Currently the function that looks for these newly valid map entries
doesn't do it properly. It's meant to look for the first "valid" map
entry but doesn't check if the entry is valid. So if a valid entry
follows the an invalid entry it isn't found, the invalid entry is
returned instead.
Once this is fixed the handling of a removed direct mount entry that's
covered by a real mount can be done. Basically, the newly valid map
entry needs to take over the mount (which wasn't being done quite right
either) and the removed map entry deleted so that the covering mount can
expire. From this point onward the newly valid map entry will be used.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/lookup.c | 38 ++++++++++++--------------------------
daemon/state.c | 17 +++++------------
include/automount.h | 2 +-
4 files changed, 19 insertions(+), 39 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -180,6 +180,7 @@
- fix incorrect flags update in update_with_defaults().
- skip expire check for amd nounmount mounts.
- quiet possibly noisy log message.
+- fix devid update on reload.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/lookup.c
+++ autofs-5.1.4/daemon/lookup.c
@@ -1354,6 +1354,7 @@ void lookup_prune_one_cache(struct autof
me = cache_enumerate(mc, NULL);
while (me) {
+ dev_t devid;
struct mapent *valid;
char *key = NULL, *next_key = NULL;
@@ -1411,6 +1412,7 @@ void lookup_prune_one_cache(struct autof
me = cache_enumerate(mc, me);
continue;
}
+ devid = ap->type == LKP_INDIRECT ? ap->dev : me->dev;
/*
* If this key has another valid entry we want to prune it,
@@ -1418,37 +1420,20 @@ void lookup_prune_one_cache(struct autof
* mount if it is a direct mount or it's just a stale indirect
* cache entry.
*/
- valid = lookup_source_valid_mapent(ap, key, LKP_DISTINCT);
- if (valid && valid->mc == mc) {
- /*
- * We've found a map entry that has been removed from
- * the current cache so it isn't really valid. Set the
- * mapent negative to prevent further mount requests
- * using the cache entry.
- */
- debug(ap->logopt, "removed map entry detected, mark negative");
- if (valid->mapent) {
- free(valid->mapent);
- valid->mapent = NULL;
- }
+ valid = lookup_source_valid_mapent(ap, key, LKP_DISTINCT, age);
+ if (valid)
cache_unlock(valid->mc);
- valid = NULL;
- }
- if (!valid &&
- is_mounted(path, MNTS_REAL)) {
+ else if (is_mounted(path, MNTS_REAL)) {
debug(ap->logopt, "prune postponed, %s mounted", path);
free(key);
free(path);
me = cache_enumerate(mc, me);
continue;
}
- if (valid)
- cache_unlock(valid->mc);
me = cache_enumerate(mc, me);
if (me)
next_key = strdup(me->key);
-
cache_unlock(mc);
cache_writelock(mc);
@@ -1461,10 +1446,7 @@ void lookup_prune_one_cache(struct autof
if (valid)
cache_delete(mc, key);
else if (!is_mounted(path, MNTS_AUTOFS)) {
- dev_t devid = ap->dev;
status = CHE_FAIL;
- if (ap->type == LKP_DIRECT)
- devid = this->dev;
if (this->ioctlfd == -1)
status = cache_delete(mc, key);
if (status != CHE_FAIL) {
@@ -1538,7 +1520,7 @@ int lookup_prune_cache(struct autofs_poi
}
/* Return with cache readlock held */
-struct mapent *lookup_source_valid_mapent(struct autofs_point *ap, const char *key, unsigned int type)
+struct mapent *lookup_source_valid_mapent(struct autofs_point *ap, const char *key, unsigned int type, time_t age)
{
struct master_mapent *entry = ap->entry;
struct map_source *map;
@@ -1562,8 +1544,12 @@ struct mapent *lookup_source_valid_mapen
me = cache_lookup_distinct(mc, key);
else
me = cache_lookup(mc, key);
- if (me)
- break;
+ if (me) {
+ /* Valid? */
+ if (me->age >= age)
+ break;
+ me = NULL;
+ }
cache_unlock(mc);
map = map->next;
}
--- autofs-5.1.4.orig/daemon/state.c
+++ autofs-5.1.4/daemon/state.c
@@ -357,17 +357,7 @@ static int do_readmap_mount(struct autof
* This is becuase of the requirement to continue running with
* an empty cache awaiting a map re-load.
*/
- valid = lookup_source_valid_mapent(ap, me->key, LKP_DISTINCT);
- if (valid && valid->mc == me->mc) {
- /*
- * We've found a map entry that has been removed from
- * the current cache so there is no need to update it.
- * The stale entry will be dealt with when we prune the
- * cache later.
- */
- cache_unlock(valid->mc);
- valid = NULL;
- }
+ valid = lookup_source_valid_mapent(ap, me->key, LKP_DISTINCT, now);
if (valid) {
struct mapent_cache *vmc = valid->mc;
struct ioctl_ops *ops = get_ioctl_ops();
@@ -389,8 +379,11 @@ static int do_readmap_mount(struct autof
/* Take over the mount if there is one */
valid->ioctlfd = me->ioctlfd;
me->ioctlfd = -1;
+ /* Same path */
+ valid->dev = me->dev;
+ valid->ino = me->ino;
/* Set device and inode number of the new mapent */
- cache_set_ino_index(vmc, me);
+ cache_set_ino_index(vmc, valid);
cache_unlock(vmc);
/* Set timeout and calculate the expire run frequency */
timeout = get_exp_timeout(ap, map);
--- autofs-5.1.4.orig/include/automount.h
+++ autofs-5.1.4/include/automount.h
@@ -273,7 +273,7 @@ int lookup_nss_mount(struct autofs_point
void lookup_close_lookup(struct autofs_point *ap);
void lookup_prune_one_cache(struct autofs_point *ap, struct mapent_cache *mc, time_t age);
int lookup_prune_cache(struct autofs_point *ap, time_t age);
-struct mapent *lookup_source_valid_mapent(struct autofs_point *ap, const char *key, unsigned int type);
+struct mapent *lookup_source_valid_mapent(struct autofs_point *ap, const char *key, unsigned int type, time_t age);
struct mapent *lookup_source_mapent(struct autofs_point *ap, const char *key, unsigned int type);
int lookup_source_close_ioctlfd(struct autofs_point *ap, const char *key);

View File

@ -1,39 +0,0 @@
autofs-5.1.9 - fix direct mount trigger umount failure case
From: Ian Kent <raven@themaw.net>
In function do_umount_autofs_direct() for the case where the trigger
mount is found to be in use we should be detaching the mount so it gets
umounted but the process can continue using it while it has an open file
handle for it.
This is because direct mount triggers are only umounted when the map
entry is removed from a map or automount(8) is shutdown which in both
cases the trigger mount needs to go away.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/direct.c | 1 +
2 files changed, 2 insertions(+)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -185,6 +185,7 @@
- fix skip valid map entries on expire cleanup.
- remove unnecessary call to set_direct_mount_tree_catatonic().
- remove unnecessary assignment in umount_multi().
+- fix direct mount trigger umount failure case.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/direct.c
+++ autofs-5.1.4/daemon/direct.c
@@ -153,6 +153,7 @@ int do_umount_autofs_direct(struct autof
} else {
me->ioctlfd = -1;
ops->close(ap->logopt, ioctlfd);
+ rv = -1;
goto force_umount;
}
}

View File

@ -1,41 +0,0 @@
autofs-5.1.9 - fix incorrect flags update in update_with_defaults()
From: Ian Kent <raven@themaw.net>
After adding support for some additional am-utils map entry options at
least one of them, "nounmount", and probably others don't work in some
cases.
This is because some of them are is implemented using a flag in the map
entry which was incorrectly being cleared during updating the entry with
current defaults.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
modules/parse_amd.c | 4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -177,6 +177,7 @@
- log when setting amd per-mount timeout.
- update per-mount expire timeout on readmap.
- clear per-mount timeout if not set.
+- fix incorrect flags update in update_with_defaults().
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/modules/parse_amd.c
+++ autofs-5.1.4/modules/parse_amd.c
@@ -654,7 +654,9 @@ static void update_with_defaults(struct
if (deftype != AMD_MOUNT_TYPE_NONE)
entry->flags |= (defaults->flags & AMD_MOUNT_TYPE_MASK);
else {
- entry->flags = AMD_MOUNT_TYPE_NFS;
+ unsigned long per_mnt_flags = entry->flags & AMD_MOUNT_OPT_MASK;
+
+ entry->flags = AMD_MOUNT_TYPE_NFS | per_mnt_flags;
tmp = strdup("nfs");
if (tmp)
entry->type = tmp;

View File

@ -1,66 +0,0 @@
autofs-5.1.9 - fix lock ordering deadlock in expire_cleanup()
From: Ian Kent <raven@themaw.net>
Commit 81ac572466e3 ("autofs-5.1.9 - fix submount shutdown race")
introduced a lock ordering deadlock between the state mutex and the
mounts hash list mutex when fixing a submount shutdown race. It's enough
to just move the conditional alarm set function call outside of the
state mutex critical section to fix it.
Fixes: 81ac572466e3 ("autofs-5.1.9 - fix submount shutdown race")
Signed-off-by: Ian Kent <raven@themaw.net>
---
daemon/state.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
--- autofs-5.1.4.orig/daemon/state.c
+++ autofs-5.1.4/daemon/state.c
@@ -86,8 +86,9 @@ void expire_cleanup(void *arg)
pthread_t thid = pthread_self();
struct expire_args *ec;
struct autofs_point *ap;
- int success;
enum states next = ST_INVAL;
+ unsigned int need_alarm = 0;
+ int success;
ec = (struct expire_args *) arg;
ap = ec->ap;
@@ -123,7 +124,7 @@ void expire_cleanup(void *arg)
}
if (ap->state == ST_EXPIRE)
- conditional_alarm_add(ap, ap->exp_runfreq);
+ need_alarm = 1;
/* FALLTHROUGH */
@@ -140,7 +141,7 @@ void expire_cleanup(void *arg)
rv = ops->askumount(ap->logopt, ap->ioctlfd, &idle);
if (!rv && !idle && !ap->shutdown) {
next = ST_READY;
- conditional_alarm_add(ap, ap->exp_runfreq);
+ need_alarm = 1;
break;
}
@@ -153,7 +154,7 @@ void expire_cleanup(void *arg)
/* Failed shutdown returns to ready */
warn(ap->logopt, "filesystem %s still busy", ap->path);
- conditional_alarm_add(ap, ap->exp_runfreq);
+ need_alarm = 1;
next = ST_READY;
break;
#endif
@@ -180,6 +181,9 @@ void expire_cleanup(void *arg)
st_mutex_unlock();
+ if (need_alarm)
+ conditional_alarm_add(ap, ap->exp_runfreq);
+
return;
}

View File

@ -1,34 +0,0 @@
autofs-5.1.9 - fix lookup search type in umount_subtree_mounts()
From: Ian Kent <raven@themaw.net>
The lookup type used in umount_subtree_mounts() should be LKP_DISTINCT
because we're looking for existing cache entries.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/automount.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -172,6 +172,7 @@
- make iocl ops ->timeout() handle per-dentry expire.
- refactor amd mount options handling.
- add some unimplemented amd map options.
+- fix lookup search type in umount_subtree_mounts().
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/automount.c
+++ autofs-5.1.4/daemon/automount.c
@@ -544,7 +544,7 @@ static int umount_subtree_mounts(struct
if (ind_key)
ind_key++;
- me = lookup_source_mapent(ap, ind_key, LKP_NORMAL);
+ me = lookup_source_mapent(ap, ind_key, LKP_DISTINCT);
}
if (me) {

View File

@ -1,53 +0,0 @@
autofs-5.1.9 - fix remount_active_mount() not remounting symlinks
From: Ian Kent <raven@themaw.net>
In remount_active_mount() there's a check if the path has an active
mount (ie. covered). This is meant to check if the mount is a direct
mount with an active mount to decide if the file descriptor needs to
be retained or not.
But this check gets it worng if the path is an indirect mount that
contains symlinks and causes them to not be properly expired after
the re-mount.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
lib/mounts.c | 12 +++++-------
2 files changed, 6 insertions(+), 7 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -173,6 +173,7 @@
- refactor amd mount options handling.
- add some unimplemented amd map options.
- fix lookup search type in umount_subtree_mounts().
+- fix remount_active_mount() not remounting symlinks.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -2819,16 +2819,14 @@ static int remount_active_mount(struct a
ops->close(ap->logopt, fd);
return REMOUNT_FAIL;
}
- if (!mounted) {
+ if (!mounted && type != t_indirect) {
/*
* If we're an indirect mount we pass back the fd.
- * But if were a direct or offset mount with no active
- * mount we don't retain an open file descriptor.
+ * But if we're a direct or offset mount with no active
+ * mount we don't retain the open file descriptor.
*/
- if (type != t_indirect) {
- ops->close(ap->logopt, fd);
- *ioctlfd = -1;
- }
+ ops->close(ap->logopt, fd);
+ *ioctlfd = -1;
} else {
/*
* What can I do if we can't remount the existing

View File

@ -1,51 +0,0 @@
autofs-5.1.9 - fix skip valid map entries on expire cleanup
From: Ian Kent <raven@themaw.net>
After an expire if the current map entry is stale because it could not
be cleaned up during the map entry prune (due to the presence of a real
mount) it needs to be cleaned up after a successful expire.
Currently this is done by update_map_cache() if the entry is contained
in an invalid map but it should be doing it if the entry is no longer
valid. In addition, if update_map_cache() gets called the umount has
been successful so the ioctlfd does not need to be checked (and is in
fact updated later in the expire process).
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/automount.c | 9 ++-------
2 files changed, 3 insertions(+), 7 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -182,6 +182,7 @@
- quiet possibly noisy log message.
- fix devid update on reload.
- fix cache writelock must be taken in update_map_cache().
+- fix skip valid map entries on expire cleanup.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/automount.c
+++ autofs-5.1.4/daemon/automount.c
@@ -505,16 +505,11 @@ static void update_map_cache(struct auto
while (map) {
struct mapent *me = NULL;
- /* Skip current, in-use cache */
- if (ap->entry->age <= map->age) {
- map = map->next;
- continue;
- }
-
mc = map->mc;
cache_writelock(mc);
me = cache_lookup_distinct(mc, key);
- if (me && me->ioctlfd == -1)
+ /* Only for invalid map entries */
+ if (me && map->age > me->age)
cache_delete(mc, key);
cache_unlock(mc);

View File

@ -1,90 +0,0 @@
autofs-5.1.9 - fix stale direct mount trigger not umounted on expire
From: Ian Kent <raven@themaw.net>
If a direct mount map entry is removed but has an active real mount the
mount trigger needs to be unmounted during the expire cleanup.
If the direct mount map entry has been re-added the map entry age will
have been updated so the entry won't be seen as stale so the umount
won't be done.
Also in function umount_multi() update_map_cache() and check_rm_dirs()
are not called for direct mounts because count_mounts() always returns
1 or more for top level direct mounts. Make this clear by using ap->type
in the logical check and rely on the left == 0 check to verify there are
no remaining mounts for indirect mounts since count_mounts() will be
more expensive.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/automount.c | 12 ++++++++----
daemon/direct.c | 22 +++++++++++++++++++++-
3 files changed, 30 insertions(+), 5 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -187,6 +187,7 @@
- remove unnecessary assignment in umount_multi().
- fix direct mount trigger umount failure case.
- refactor do_umount_autofs_direct().
+- fix stale direct mount trigger not umounted on expire.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/automount.c
+++ autofs-5.1.4/daemon/automount.c
@@ -697,10 +697,14 @@ int umount_multi(struct autofs_point *ap
left = umount_subtree_mounts(ap, path, is_autofs_fs);
- /* Delete detritus like unwanted mountpoints and symlinks */
- if (left == 0 &&
- ap->state != ST_READMAP &&
- !count_mounts(ap, path, ap->dev)) {
+ /* Delete detritus like unwanted mountpoints and symlinks
+ * for indirect mounts. This can't be done for direct mounts
+ * here because there's an ioctl file handle open on the
+ * autofs trigger mount for them so it must be done after
+ * the expire.
+ */
+ if (ap->type == LKP_INDIRECT &&
+ ap->state != ST_READMAP && left == 0) {
update_map_cache(ap, path);
check_rm_dirs(ap, path, incl);
}
--- autofs-5.1.4.orig/daemon/direct.c
+++ autofs-5.1.4/daemon/direct.c
@@ -1000,10 +1000,30 @@ static void *do_expire_direct(void *arg)
mt.ioctlfd, mt.wait_queue_token, -ENOENT);
else {
struct mapent *me;
+
cache_writelock(mt.mc);
me = cache_lookup_distinct(mt.mc, mt.name);
- if (me)
+ if (me) {
+ /* If the direct mount map entry is no longer
+ * valid but there is an autofs mount trigger
+ * for the mount the mount trigger needs to be
+ * umounted, the map entry deleted and the mount
+ * point directory removed (if it was created by
+ * us).
+ */
me->ioctlfd = -1;
+ if (me->mc->map->age > me->age &&
+ is_mounted(mt.name, MNTS_AUTOFS)) {
+ /* We must detach the mount becuase the
+ * umount must be completed before
+ * notifying status to the kernel but
+ * there's an ioctlfd open on the
+ * trigger.
+ */
+ if (!finish_umount(ap, me, -1))
+ cache_delete(me->mc, me->key);
+ }
+ }
cache_unlock(mt.mc);
ops->send_ready(ap->logopt, mt.ioctlfd, mt.wait_queue_token);
ops->close(ap->logopt, mt.ioctlfd);

View File

@ -1,89 +0,0 @@
autofs-5.1.9 - fix submount shutdown race
From: Ian Kent <raven@themaw.net>
In function master_notify_submount() an expire notification is sent to
existing submounts. automount waits for the task to complete then, if
the submount is exiting, waits for the submount to reach a completion
state.
But the submount can go away during these checks resulting in the
autofs mount point structure field of the mount list structure to be
set to NULL which can then lead to a crash.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/master.c | 23 +++++++++++++----------
lib/mounts.c | 2 ++
3 files changed, 16 insertions(+), 10 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -154,6 +154,7 @@
- fix multi-mount check.
- fix get parent multi-mount check in try_remount().
- fix deadlock in remount.
+- fix submount shutdown race.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/master.c
+++ autofs-5.1.4/daemon/master.c
@@ -1213,22 +1213,24 @@ int master_notify_submount(struct autofs
this = mnts_find_submount(path);
if (this) {
+ struct autofs_point *found;
+
/* We have found a submount to expire */
st_mutex_lock();
-
- if (this->ap->state == ST_SHUTDOWN) {
+ found = this->ap;
+ if (!found || found->state == ST_SHUTDOWN) {
this = NULL;
st_mutex_unlock();
goto done;
}
-
- this->ap->shutdown = ap->shutdown;
-
- __st_add_task(this->ap, state);
-
+ found->shutdown = ap->shutdown;
+ __st_add_task(found, state);
st_mutex_unlock();
- st_wait_task(this->ap, state, 0);
+ /* This is ok because found isn't dereferenced during
+ * the wait checks.
+ */
+ st_wait_task(found, state, 0);
/*
* If our submount gets to state ST_SHUTDOWN_PENDING or
@@ -1240,8 +1242,9 @@ int master_notify_submount(struct autofs
struct timespec t = { 0, 300000000 };
struct timespec r;
- if (sbmnt->ap->state != ST_SHUTDOWN_PENDING &&
- sbmnt->ap->state != ST_SHUTDOWN_FORCE) {
+ if (!sbmnt->ap ||
+ (sbmnt->ap->state != ST_SHUTDOWN_PENDING &&
+ sbmnt->ap->state != ST_SHUTDOWN_FORCE)) {
ret = 0;
mnts_put_mount(sbmnt);
break;
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -1153,7 +1153,9 @@ void mnts_remove_submount(const char *mp
this = mnts_lookup(mp);
if (this && this->flags & MNTS_AUTOFS) {
this->flags &= ~MNTS_AUTOFS;
+ st_mutex_lock();
this->ap = NULL;
+ st_mutex_unlock();
list_del_init(&this->submount);
__mnts_put_mount(this);
}

View File

@ -1,49 +0,0 @@
autofs-5.1.9 - handle sss special case getautomntbyname() error
From: Ian Kent <raven@themaw.net>
The sss key lookup (via getautomntbyname()) returns EHOSTDOWN when the
entry is invalid, such as when the location is empty. But setatomntent()
has already been called successfully so we know the host is up and the
map exists hence this probably should be EINVAL.
In both these cases the better return is NSS_STATUS_UNAVAIL.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
modules/lookup_sss.c | 6 +++---
2 files changed, 4 insertions(+), 3 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -166,6 +166,7 @@
- always recreate credential cache.
- fix always recreate credential cache.
- fix missing unlock in sasl_do_kinit_ext_cc().
+- handle sss special case getautomntbyname() error.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/modules/lookup_sss.c
+++ autofs-5.1.4/modules/lookup_sss.c
@@ -658,8 +658,8 @@ static int getautomntbyname(unsigned int
err = NSS_STATUS_NOTFOUND;
goto free;
}
- if (ret != EHOSTDOWN)
- goto error;
+ if (ret == EINVAL || ret == EHOSTDOWN)
+ goto free;
}
ret = getautomntbyname_wait(logopt, ctxt,
@@ -670,7 +670,7 @@ static int getautomntbyname(unsigned int
if (ret == ETIMEDOUT)
goto error;
/* sss proto version 0 and sss timeout not set */
- if (ret == EINVAL)
+ if (ret == EINVAL || ret == EHOSTDOWN)
goto free;
if (ret == ENOENT) {
err = NSS_STATUS_NOTFOUND;

View File

@ -1,98 +0,0 @@
autofs-5.1.9 - improve handling of missing map entry for mount request
From: Ian Kent <raven@themaw.net>
If the map entry isn't found it must have been deleted from the map but
a trigger mount is still mounted because it has sent us this request.
Use the mount table for a brute force lookup to get the path and open a
file handle for it so we can send a failure status to the kernel.
Also remove the crit() log message following open_ioctlfd() as it already
issues an appropriate error message on failure.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/direct.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++------
2 files changed, 48 insertions(+), 6 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -189,6 +189,7 @@
- refactor do_umount_autofs_direct().
- fix stale direct mount trigger not umounted on expire.
- add function table_lookup_ino().
+- improve handling of missing map entry for mount request.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/direct.c
+++ autofs-5.1.4/daemon/direct.c
@@ -1365,12 +1365,54 @@ int handle_packet_missing_direct(struct
}
if (!me) {
- /*
- * Shouldn't happen as the kernel is telling us
- * someone has walked on our mount point.
+ char tmp[PATH_MAX + 1];
+ char *path;
+
+ /* If the map entry wasn't found it must have been deleted
+ * from the map but a trigger mount is still mounted because
+ * it has sent us this request. So use the mount table for a
+ * brute force lookup to get the path and open a file handle
+ * for it so we can return a not found status to the kernel.
*/
- logerr("can't find map entry for (%lu,%lu)",
- (unsigned long) pkt->dev, (unsigned long) pkt->ino);
+ path = table_lookup_ino(ap, pkt->dev, pkt->ino, tmp, PATH_MAX + 1, &ioctlfd);
+ if (!path) {
+ /* This could be cuased by an inability to open a file
+ * handle but generally that doesn't happen. The mount
+ * has to exist and be pinned becuase we got this request
+ * so it can't be umounted. Therefore it's very unlikely
+ * this case will happen. If it does happen it's fatal,
+ * the waiter will hang and there's nothing we can do
+ * about it.
+ */
+ logerr("can't find mount for (%lu,%lu)",
+ (unsigned long) pkt->dev, (unsigned long) pkt->ino);
+ /* TODO: how do we clear wait q in kernel ?? */
+ } else {
+ char buf[MAX_ERR_BUF];
+
+ /* Try and recover from this unexpecyedly missing map
+ * entry by detaching the direct mount trigger that
+ * sent the request so it's no longer visible to the
+ * VFS.
+ */
+ info(ap->logopt, "forcing umount of direct mount %s", path);
+ if (umount2(path, MNT_DETACH) == -1) {
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
+ warn(ap->logopt, "failed to force umount %s: %s",
+ path, estr);
+ }
+ if (rmdir(path) == -1) {
+ char buf[MAX_ERR_BUF];
+ char *estr;
+
+ estr = strerror_r(errno, buf, MAX_ERR_BUF);
+ warn(ap->logopt,
+ "failed to remove dir %s: %s", path, estr);
+ }
+ ops->send_fail(ap->logopt,
+ ioctlfd, pkt->wait_queue_token, -EINVAL);
+ ops->close(ap->logopt, ioctlfd);
+ }
master_source_unlock(ap->entry);
master_mutex_unlock();
pthread_setcancelstate(state, NULL);
@@ -1389,7 +1431,6 @@ int handle_packet_missing_direct(struct
master_source_unlock(ap->entry);
master_mutex_unlock();
pthread_setcancelstate(state, NULL);
- crit(ap->logopt, "failed to create ioctl fd for %s", me->key);
/* TODO: how do we clear wait q in kernel ?? */
return 1;
}

View File

@ -1,51 +0,0 @@
autofs-5.1.9 - log when setting amd per-mount timeout
From: Ian Kent <raven@themaw.net>
Log action when setting amd per-mount expire timeout.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
modules/parse_amd.c | 12 ++++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -174,6 +174,7 @@
- add some unimplemented amd map options.
- fix lookup search type in umount_subtree_mounts().
- fix remount_active_mount() not remounting symlinks.
+- log when setting amd per-mount timeout.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/modules/parse_amd.c
+++ autofs-5.1.4/modules/parse_amd.c
@@ -1755,16 +1755,24 @@ static int amd_mount(struct autofs_point
"non-zero timeout set, possible conflicting options");
/* "nounmount" option, don't expire this mount. */
- if (ops)
+ if (ops) {
+ info(ap->logopt,
+ "set amd per-mount expire timeout to 0 for %s",
+ name);
ops->timeout(ap->logopt, ap->ioctlfd, name, 0);
+ }
} else if (per_mnt_flags & AMD_MOUNT_OPT_UTIMEOUT) {
if (!entry->utimeout)
warn(ap->logopt,
"zero timeout set, possible conflicting options");
/* "utimeout" option, expire this mount according to a timeout. */
- if (ops)
+ if (ops) {
+ info(ap->logopt,
+ "set amd per-dentry expire timeout to %d for %s",
+ entry->utimeout, name);
ops->timeout(ap->logopt, ap->ioctlfd, name, entry->utimeout);
+ }
}
}
done:

View File

@ -1,193 +0,0 @@
commit 6fdfbcd65fd845e968a68cbdf475a6dd0ee0ee66
Author: Ian Kent <raven@themaw.net>
Date: Tue Jul 9 16:18:19 2024 +0800
autofs-5.1.9 - make ioctl ops ->timeout() handle per-dentry expire
Update the ioctl ops ->timeout() function to handle setting of per-dentry
expire timeout if the kernel supports it.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/direct.c | 6 +++---
daemon/indirect.c | 2 +-
daemon/state.c | 4 ++--
include/dev-ioctl-lib.h | 2 +-
lib/dev-ioctl-lib.c | 42 +++++++++++++++++++++++++++++++-----------
lib/mounts.c | 4 ++--
7 files changed, 41 insertions(+), 20 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -169,6 +169,7 @@
- handle sss special case getautomntbyname() error.
- fix amd cache options not copied.
- seperate amd mount and entry flags.
+- make iocl ops ->timeout() handle per-dentry expire.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/direct.c
+++ autofs-5.1.4/daemon/direct.c
@@ -328,7 +328,7 @@ int do_mount_autofs_direct(struct autofs
return 0;
}
- ops->timeout(ap->logopt, ioctlfd, tout);
+ ops->timeout(ap->logopt, ioctlfd, NULL, tout);
if (save_ioctlfd == -1)
ops->close(ap->logopt, ioctlfd);
@@ -423,7 +423,7 @@ int do_mount_autofs_direct(struct autofs
goto out_umount;
}
- ops->timeout(ap->logopt, ioctlfd, timeout);
+ ops->timeout(ap->logopt, ioctlfd, NULL, timeout);
notify_mount_result(ap, me->key, timeout, str_direct);
cache_set_ino_index(me->mc, me);
ops->close(ap->logopt, ioctlfd);
@@ -777,7 +777,7 @@ int mount_autofs_offset(struct autofs_po
if (ioctlfd < 0)
goto out_umount;
- ops->timeout(ap->logopt, ioctlfd, timeout);
+ ops->timeout(ap->logopt, ioctlfd, NULL, timeout);
cache_set_ino_index(me->mc, me);
notify_mount_result(ap, me->key, timeout, str_offset);
ops->close(ap->logopt, ioctlfd);
--- autofs-5.1.4.orig/daemon/indirect.c
+++ autofs-5.1.4/daemon/indirect.c
@@ -136,7 +136,7 @@ static int do_mount_autofs_indirect(stru
goto out_umount;
}
- ops->timeout(ap->logopt, ap->ioctlfd, timeout);
+ ops->timeout(ap->logopt, ap->ioctlfd, NULL, timeout);
notify_mount_result(ap, ap->path, timeout, str_indirect);
return 0;
--- autofs-5.1.4.orig/daemon/state.c
+++ autofs-5.1.4/daemon/state.c
@@ -394,7 +394,7 @@ static int do_readmap_mount(struct autof
cache_unlock(vmc);
/* Set timeout and calculate the expire run frequency */
timeout = get_exp_timeout(ap, map);
- ops->timeout(ap->logopt, valid->ioctlfd, timeout);
+ ops->timeout(ap->logopt, valid->ioctlfd, NULL, timeout);
if (timeout) {
runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO;
if (ap->exp_runfreq)
@@ -455,7 +455,7 @@ static void *do_readmap(void *arg)
struct ioctl_ops *ops = get_ioctl_ops();
time_t timeout = get_exp_timeout(ap, ap->entry->maps);
ap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO;
- ops->timeout(ap->logopt, ap->ioctlfd, timeout);
+ ops->timeout(ap->logopt, ap->ioctlfd, NULL, timeout);
lookup_prune_cache(ap, now);
status = lookup_ghost(ap);
} else {
--- autofs-5.1.4.orig/include/dev-ioctl-lib.h
+++ autofs-5.1.4/include/dev-ioctl-lib.h
@@ -45,7 +45,7 @@ struct ioctl_ops {
int (*send_fail)(unsigned int, int, unsigned int, int);
int (*setpipefd)(unsigned int, int, int);
int (*catatonic)(unsigned int, int);
- int (*timeout)(unsigned int, int, time_t);
+ int (*timeout)(unsigned int, int, const char *, time_t);
int (*requester)(unsigned int, int, const char *, uid_t *, gid_t *);
int (*expire)(unsigned int, int, const char *, unsigned int);
int (*askumount)(unsigned int, int, unsigned int *);
--- autofs-5.1.4.orig/lib/dev-ioctl-lib.c
+++ autofs-5.1.4/lib/dev-ioctl-lib.c
@@ -55,7 +55,7 @@ static int dev_ioctl_send_ready(unsigned
static int dev_ioctl_send_fail(unsigned int, int, unsigned int, int);
static int dev_ioctl_setpipefd(unsigned int, int, int);
static int dev_ioctl_catatonic(unsigned int, int);
-static int dev_ioctl_timeout(unsigned int, int, time_t);
+static int dev_ioctl_timeout(unsigned int, int, const char *, time_t);
static int dev_ioctl_requester(unsigned int, int, const char *, uid_t *, gid_t *);
static int dev_ioctl_expire(unsigned int, int, const char *, unsigned int);
static int dev_ioctl_askumount(unsigned int, int, unsigned int *);
@@ -69,7 +69,7 @@ static int ioctl_close(unsigned int, int
static int ioctl_send_ready(unsigned int, int, unsigned int);
static int ioctl_send_fail(unsigned int, int, unsigned int, int);
static int ioctl_catatonic(unsigned int, int);
-static int ioctl_timeout(unsigned int, int, time_t);
+static int ioctl_timeout(unsigned int, int, const char *, time_t);
static int ioctl_expire(unsigned int, int, const char *, unsigned int);
static int ioctl_askumount(unsigned int, int, unsigned int *);
@@ -579,21 +579,41 @@ static int ioctl_catatonic(unsigned int
}
/* Set the autofs mount timeout */
-static int dev_ioctl_timeout(unsigned int logopt, int ioctlfd, time_t timeout)
+static int dev_ioctl_timeout(unsigned int logopt, int ioctlfd, const char *mp, time_t timeout)
{
- struct autofs_dev_ioctl param;
-
- init_autofs_dev_ioctl(&param);
- param.ioctlfd = ioctlfd;
- param.timeout.timeout = timeout;
+ if (!mp) {
+ struct autofs_dev_ioctl param;
- if (ioctl(ctl.devfd, AUTOFS_DEV_IOCTL_TIMEOUT, &param) == -1)
- return -1;
+ init_autofs_dev_ioctl(&param);
+ param.ioctlfd = ioctlfd;
+ param.timeout.timeout = timeout;
+ if (ioctl(ctl.devfd, AUTOFS_DEV_IOCTL_TIMEOUT, &param) == -1)
+ return -1;
+ } else {
+ unsigned int kver_major = get_kver_major();
+ unsigned int kver_minor = get_kver_minor();
+ struct autofs_dev_ioctl *param;
+
+ if (kver_major < 5 ||
+ (kver_major == 5 && kver_minor < 6)) {
+ error(logopt, "per-mount expire timeout not supported by kernel.");
+ return -1;
+ }
+ param = alloc_dev_ioctl_path(ioctlfd, mp);
+ if (!param)
+ return -1;
+ param->timeout.timeout = timeout;
+ if (ioctl(ctl.devfd, AUTOFS_DEV_IOCTL_TIMEOUT, param) == -1) {
+ free_dev_ioctl_path(param);
+ return -1;
+ }
+ free_dev_ioctl_path(param);
+ }
return 0;
}
-static int ioctl_timeout(unsigned int logopt, int ioctlfd, time_t timeout)
+static int ioctl_timeout(unsigned int logopt, int ioctlfd, const char *mp, time_t timeout)
{
time_t tout = timeout;
return ioctl(ioctlfd, AUTOFS_IOC_SETTIMEOUT, &tout);
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -2759,7 +2759,7 @@ static int remount_active_mount(struct a
/* Re-reading the map, set timeout and return */
if (ap->state == ST_READMAP) {
debug(ap->logopt, "already mounted, update timeout");
- ops->timeout(ap->logopt, fd, timeout);
+ ops->timeout(ap->logopt, fd, NULL, timeout);
ops->close(ap->logopt, fd);
return REMOUNT_READ_MAP;
}
@@ -2781,7 +2781,7 @@ static int remount_active_mount(struct a
ops->close(ap->logopt, fd);
return REMOUNT_OPEN_FAIL;
}
- ops->timeout(ap->logopt, fd, timeout);
+ ops->timeout(ap->logopt, fd, NULL, timeout);
if (fstat(fd, &st) == -1) {
error(ap->logopt,
"failed to stat %s mount %s", str_type, path);

View File

@ -1,35 +0,0 @@
autofs-5.1.9 - quiet possibly noisy log message
From: Ian Kent <raven@themaw.net>
The message that logs when a mount is already mounted and only the
timeout will be updated on map re-read can create a lot of noise in
the log for direct mount maps. But this is normal operation and is of
limited value for both direct and indirect maps, so remove it.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
lib/mounts.c | 1 -
2 files changed, 1 insertion(+), 1 deletion(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -179,6 +179,7 @@
- clear per-mount timeout if not set.
- fix incorrect flags update in update_with_defaults().
- skip expire check for amd nounmount mounts.
+- quiet possibly noisy log message.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -2890,7 +2890,6 @@ static int remount_active_mount(struct a
/* Re-reading the map, set timeout and return */
if (ap->state == ST_READMAP) {
- debug(ap->logopt, "already mounted, update timeout");
ops->timeout(ap->logopt, fd, NULL, timeout);
ops->close(ap->logopt, fd);
return REMOUNT_READ_MAP;

View File

@ -1,138 +0,0 @@
autofs-5.1.9 - refactor amd function do_program_mount()
From: Ian Kent <raven@themaw.net>
The amd mounts function do_program_mount() is particularly untidy.
Refactor it to make it a little simpler and to take advantage of the
coming refactoring of the funtion umount_amd_ext_mount().
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1
modules/parse_amd.c | 74 ++++++++++++++++++++++++----------------------------
2 files changed, 36 insertions(+), 39 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -158,6 +158,7 @@
- fix amd external mount error handling.
- fix amd external mount mount handling.
- don't free ext mount if mounted.
+- refactor amd function do_program_mount().
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/modules/parse_amd.c
+++ autofs-5.1.4/modules/parse_amd.c
@@ -1407,26 +1407,8 @@ out:
static int do_program_mount(struct autofs_point *ap,
struct amd_entry *entry, const char *name)
{
- char *prog, *str;
- char **argv;
- int argc = -1;
int rv = 1;
- str = strdup(entry->mount);
- if (!str)
- goto out;
-
- prog = NULL;
- argv = NULL;
-
- argc = construct_argv(str, &prog, &argv);
- if (argc == -1) {
- error(ap->logopt, MODPREFIX
- "%s: error creating mount arguments", entry->type);
- free(str);
- goto out;
- }
-
/* The am-utils documentation doesn't actually say that the
* mount (and umount, if given) command need to use ${fs} as
* the mount point in the command.
@@ -1445,6 +1427,25 @@ static int do_program_mount(struct autof
}
rv = 0;
} else {
+ char *prog, *str;
+ char **argv;
+ int argc = -1;
+
+ str = strdup(entry->mount);
+ if (!str)
+ goto out;
+
+ prog = NULL;
+ argv = NULL;
+
+ argc = construct_argv(str, &prog, &argv);
+ if (argc == -1) {
+ error(ap->logopt, MODPREFIX
+ "%s: error creating mount arguments", entry->type);
+ free(str);
+ goto out;
+ }
+
rv = mkdir_path(entry->fs, mp_mode);
if (rv && errno != EEXIST) {
char buf[MAX_ERR_BUF];
@@ -1454,7 +1455,9 @@ static int do_program_mount(struct autof
error(ap->logopt,
MODPREFIX "%s: mkdir_path %s failed: %s",
entry->type, entry->fs, estr);
- goto do_free;
+ free_argv(argc, (const char **) argv);
+ free(str);
+ goto out;
}
rv = spawnv(ap->logopt, prog, (const char * const *) argv);
@@ -1463,33 +1466,26 @@ static int do_program_mount(struct autof
rv = 0;
debug(ap->logopt, MODPREFIX
"%s: mounted %s", entry->type, entry->fs);
- goto do_free;
+ free_argv(argc, (const char **) argv);
+ free(str);
+ goto done;
}
umount_amd_ext_mount(ap, entry->fs);
}
-
- if (!ext_mount_inuse(entry->fs))
- rmdir_path(ap, entry->fs, ap->dev);
error(ap->logopt, MODPREFIX
"%s: failed to mount using %s", entry->type, entry->mount);
- }
-do_free:
- free_argv(argc, (const char **) argv);
- free(str);
-
- if (rv)
+ free_argv(argc, (const char **) argv);
+ free(str);
goto out;
-
+ }
+done:
rv = do_link_mount(ap, name, entry, 0);
- if (!rv)
- goto out;
-
- if (umount_amd_ext_mount(ap, entry->fs)) {
- if (!ext_mount_inuse(entry->fs))
- rmdir_path(ap, entry->fs, ap->dev);
- debug(ap->logopt, MODPREFIX
- "%s: failed to umount external mount at %s",
- entry->type, entry->fs);
+ if (rv) {
+ if (umount_amd_ext_mount(ap, entry->fs)) {
+ debug(ap->logopt, MODPREFIX
+ "%s: failed to cleanup external mount at %s",
+ entry->type, entry->fs);
+ }
}
out:
return rv;

View File

@ -1,242 +0,0 @@
autofs-5.1.9 - refactor amd function umount_amd_ext_mount()
From: Ian Kent <raven@themaw.net>
The amd mounts function umount_amd_ext_mount() needs some improvement.
Make sure the function returns true for success and false for failure
and add a parameter to control if the expternal mount reference should
be decremented on successful umount.
If the reference count of the external mount is greater than 1 there's
some other mount using (symlink pointing to) it so don't try to umount
it just return success.
Also check for the case where the mount is already mounted.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1
daemon/automount.c | 4 +-
include/mounts.h | 2 -
lib/mounts.c | 80 ++++++++++++++++++++++++++++++----------------------
modules/parse_amd.c | 10 +++---
5 files changed, 56 insertions(+), 41 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -159,6 +159,7 @@
- fix amd external mount mount handling.
- don't free ext mount if mounted.
- refactor amd function do_program_mount().
+- refactor umount_amd_ext_mount().
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/automount.c
+++ autofs-5.1.4/daemon/automount.c
@@ -619,7 +619,7 @@ static int umount_subtree_mounts(struct
/* Check for an external mount and umount if possible */
mnt = mnts_find_amdmount(path);
if (mnt) {
- umount_amd_ext_mount(ap, mnt->ext_mp);
+ umount_amd_ext_mount(ap, mnt->ext_mp, 1);
mnts_remove_amdmount(path);
mnts_put_mount(mnt);
}
@@ -684,7 +684,7 @@ int umount_multi(struct autofs_point *ap
/* Check for an external mount and attempt umount if needed */
mnt = mnts_find_amdmount(path);
if (mnt) {
- umount_amd_ext_mount(ap, mnt->ext_mp);
+ umount_amd_ext_mount(ap, mnt->ext_mp, 1);
mnts_remove_amdmount(path);
mnts_put_mount(mnt);
}
--- autofs-5.1.4.orig/include/mounts.h
+++ autofs-5.1.4/include/mounts.h
@@ -199,7 +199,7 @@ int try_remount(struct autofs_point *, s
void set_indirect_mount_tree_catatonic(struct autofs_point *);
void set_direct_mount_tree_catatonic(struct autofs_point *, struct mapent *);
int umount_ent(struct autofs_point *, const char *);
-int umount_amd_ext_mount(struct autofs_point *, const char *);
+int umount_amd_ext_mount(struct autofs_point *, const char *, int remove);
int clean_stale_multi_triggers(struct autofs_point *, struct mapent *, char *, const char *);
#endif
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -3097,37 +3097,62 @@ int umount_ent(struct autofs_point *ap,
return mounted;
}
-int umount_amd_ext_mount(struct autofs_point *ap, const char *path)
+int umount_amd_ext_mount(struct autofs_point *ap, const char *path, int remove)
{
struct ext_mount *em;
char *umount = NULL;
- char *mp;
+ char *mp = NULL;
int rv = 1;
+ int ret;
pthread_mutex_lock(&ext_mount_hash_mutex);
-
em = ext_mount_lookup(path);
if (!em) {
pthread_mutex_unlock(&ext_mount_hash_mutex);
+ rv = 0;
goto out;
}
mp = strdup(em->mp);
if (!mp) {
pthread_mutex_unlock(&ext_mount_hash_mutex);
+ rv = 0;
goto out;
}
if (em->umount) {
umount = strdup(em->umount);
if (!umount) {
pthread_mutex_unlock(&ext_mount_hash_mutex);
- free(mp);
+ rv = 0;
goto out;
}
}
-
+ /* Don't try and umount if there's more than one
+ * user of the external mount.
+ */
+ if (em->ref > 1) {
+ pthread_mutex_unlock(&ext_mount_hash_mutex);
+ if (!remove)
+ error(ap->logopt,
+ "reference count mismatch, called with remove false");
+ else
+ ext_mount_remove(mp);
+ goto out;
+ }
+ /* This shouldn't happen ... */
+ if (!is_mounted(mp, MNTS_REAL)) {
+ pthread_mutex_unlock(&ext_mount_hash_mutex);
+ error(ap->logopt, "failed to umount program mount at %s", mp);
+ if (remove)
+ ext_mount_remove(mp);
+ goto out;
+ }
pthread_mutex_unlock(&ext_mount_hash_mutex);
- if (umount) {
+ if (!umount) {
+ ret = umount_ent(ap, mp);
+ if (ret)
+ rv = 0;
+ } else {
char *prog;
char **argv;
int argc = -1;
@@ -3136,41 +3161,30 @@ int umount_amd_ext_mount(struct autofs_p
argv = NULL;
argc = construct_argv(umount, &prog, &argv);
- if (argc == -1)
- goto done;
-
- if (!ext_mount_remove(mp)) {
- rv =0;
- goto out_free;
- }
-
- rv = spawnv(ap->logopt, prog, (const char * const *) argv);
- if (rv == -1 || (WIFEXITED(rv) && WEXITSTATUS(rv)))
+ if (argc == -1) {
error(ap->logopt,
- "failed to umount program mount at %s", mp);
- else {
+ "failed to allocate args for umount of %s", mp);
rv = 0;
- debug(ap->logopt, "umounted program mount at %s", mp);
- rmdir_path(ap, mp, ap->dev);
+ goto out;
}
-out_free:
+ ret = spawnv(ap->logopt, prog, (const char * const *) argv);
+ rv = WIFEXITED(ret) && !WEXITSTATUS(ret);
free_argv(argc, (const char **) argv);
-
- goto done;
}
- if (ext_mount_remove(mp)) {
- rv = umount_ent(ap, mp);
- if (rv)
- error(ap->logopt,
- "failed to umount external mount %s", mp);
- else
- debug(ap->logopt, "umounted external mount %s", mp);
+ if (is_mounted(mp, MNTS_REAL))
+ error(ap->logopt,
+ "failed to umount external mount %s", mp);
+ else {
+ info(ap->logopt, "umounted external mount %s", mp);
+ rmdir_path(ap, mp, ap->dev);
}
-done:
+ if (remove)
+ ext_mount_remove(mp);
+out:
if (umount)
free(umount);
- free(mp);
-out:
+ if (mp)
+ free(mp);
return rv;
}
--- autofs-5.1.4.orig/modules/parse_amd.c
+++ autofs-5.1.4/modules/parse_amd.c
@@ -1133,7 +1133,7 @@ symlink:
if (entry->sublink) {
/* failed to complete sublink mount */
- umount_amd_ext_mount(ap, entry->fs);
+ umount_amd_ext_mount(ap, entry->fs, 1);
}
out:
return ret;
@@ -1184,7 +1184,7 @@ static int do_generic_mount(struct autof
/* If we have an external mount add it to the list */
if (!ext_mount_add(entry->fs, entry->umount)) {
if (umount)
- umount_amd_ext_mount(ap, entry->fs);
+ umount_amd_ext_mount(ap, entry->fs, 0);
error(ap->logopt, MODPREFIX
"error: could not add external mount %s",
entry->fs);
@@ -1235,7 +1235,7 @@ static int do_nfs_mount(struct autofs_po
/* We might be using an external mount */
if (!ext_mount_add(entry->fs, entry->umount)) {
if (umount)
- umount_amd_ext_mount(ap, entry->fs);
+ umount_amd_ext_mount(ap, entry->fs, 0);
error(ap->logopt, MODPREFIX
"error: could not add external mount %s", entry->fs);
ret = 1;
@@ -1470,7 +1470,7 @@ static int do_program_mount(struct autof
free(str);
goto done;
}
- umount_amd_ext_mount(ap, entry->fs);
+ umount_amd_ext_mount(ap, entry->fs, 0);
}
error(ap->logopt, MODPREFIX
"%s: failed to mount using %s", entry->type, entry->mount);
@@ -1481,7 +1481,7 @@ static int do_program_mount(struct autof
done:
rv = do_link_mount(ap, name, entry, 0);
if (rv) {
- if (umount_amd_ext_mount(ap, entry->fs)) {
+ if (!umount_amd_ext_mount(ap, entry->fs, 1)) {
debug(ap->logopt, MODPREFIX
"%s: failed to cleanup external mount at %s",
entry->type, entry->fs);

View File

@ -1,121 +0,0 @@
commit b48aab92dd3f47411a8ccd67ff4370cbfee64581
Author: Ian Kent <raven@themaw.net>
Date: Thu Jul 11 13:35:04 2024 +0800
autofs-5.1.9 - refactor amd mount options handling
Refactor handling of entry options opts, addopts, remopts.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1
modules/amd_parse.y | 66 ++++++++++++++++++++++++++++++----------------------
2 files changed, 40 insertions(+), 27 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -170,6 +170,7 @@
- fix amd cache options not copied.
- seperate amd mount and entry flags.
- make iocl ops ->timeout() handle per-dentry expire.
+- refactor amd mount options handling.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/modules/amd_parse.y
+++ autofs-5.1.4/modules/amd_parse.y
@@ -60,6 +60,7 @@ static int match_map_option_fs_type(char
static int match_map_option_map_type(char *map_option, char *type);
static int match_map_option_cache_option(char *type);
static int match_mnt_option_options(char *mnt_option, char *options);
+static int match_mnt_option(char *option, char *options);
static struct amd_entry entry;
static struct list_head *entries;
@@ -437,40 +438,18 @@ option_assignment: MAP_OPTION OPTION_ASS
options: OPTION
{
- if (!strcmp($1, "fullybrowsable") ||
- !strcmp($1, "nounmount")) {
- sprintf(msg_buf, "option %s is not currently "
- "implemented, ignored", $1);
- amd_info(msg_buf);
- } else if (!strncmp($1, "ping=", 5) ||
- !strncmp($1, "retry=", 6) ||
- !strcmp($1, "public") ||
- !strcmp($1, "softlookup") ||
- !strcmp($1, "xlatecookie")) {
- sprintf(msg_buf, "option %s is not used by "
- "autofs, ignored", $1);
- amd_info(msg_buf);
- } else if (!strncmp($1, "utimeout=", 9)) {
- if (entry.flags & AMD_MOUNT_TYPE_AUTO) {
- char *opt = $1;
- prepend_opt(opts, ++opt);
- } else {
- sprintf(msg_buf, "umount timeout can't be "
- "used for other than type "
- "\"auto\" with autofs, "
- "ignored");
- amd_info(msg_buf);
- }
- } else
+ if (match_mnt_option($1, opts))
prepend_opt(opts, $1);
}
| OPTION COMMA options
{
- prepend_opt(opts, $1);
+ if (match_mnt_option($1, opts))
+ prepend_opt(opts, $1);
}
| OPTION COMMA
{
- prepend_opt(opts, $1);
+ if (match_mnt_option($1, opts))
+ prepend_opt(opts, $1);
}
;
@@ -664,6 +643,39 @@ static int match_mnt_option_options(char
return 1;
}
+static int match_mnt_option(char *option, char *options)
+{
+ int ret = 0;
+
+ if (!strcmp(option, "fullybrowsable") ||
+ !strcmp(option, "nounmount")) {
+ sprintf(msg_buf, "option %s is not currently "
+ "implemented, ignored", option);
+ amd_info(msg_buf);
+ } else if (!strncmp(option, "ping=", 5) ||
+ !strncmp(option, "retry=", 6) ||
+ !strcmp(option, "public") ||
+ !strcmp(option, "softlookup") ||
+ !strcmp(option, "xlatecookie")) {
+ sprintf(msg_buf, "option %s is not used by "
+ "autofs, ignored", option);
+ amd_info(msg_buf);
+ } else if (!strncmp(option, "utimeout=", 9)) {
+ if (entry.flags & AMD_MOUNT_TYPE_AUTO)
+ prepend_opt(options, ++option);
+ else {
+ sprintf(msg_buf, "umount timeout can't be "
+ "used for other than type "
+ "\"auto\" with autofs, "
+ "ignored");
+ amd_info(msg_buf);
+ }
+ } else
+ ret = 1;
+
+ return ret;
+}
+
static void prepend_opt(char *dest, char *opt)
{
char new[MAX_OPTS_LEN];

View File

@ -1,158 +0,0 @@
autofs-5.1.9 - refactor do_umount_autofs_direct()
From: Ian Kent <raven@themaw.net>
Refactor functon do_umount_autofs_direct() so that it can be called from
do_expire_direct() to clean up stale direct mounts that couldn't be
cleaned up at map re-load.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1
daemon/direct.c | 106 ++++++++++++++++++++++++++++++--------------------------
2 files changed, 58 insertions(+), 49 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -186,6 +186,7 @@
- remove unnecessary call to set_direct_mount_tree_catatonic().
- remove unnecessary assignment in umount_multi().
- fix direct mount trigger umount failure case.
+- refactor do_umount_autofs_direct().
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/direct.c
+++ autofs-5.1.4/daemon/direct.c
@@ -81,12 +81,66 @@ static void mnts_cleanup(void *arg)
mnts_put_expire_list(mnts);
}
+static int finish_umount(struct autofs_point *ap, struct mapent *me, int rv)
+{
+ char buf[MAX_ERR_BUF];
+
+ if (rv != 0) {
+ info(ap->logopt, "forcing umount of direct mount %s", me->key);
+ rv = umount2(me->key, MNT_DETACH);
+ } else
+ info(ap->logopt, "umounted direct mount %s", me->key);
+
+ if (!rv && me->flags & MOUNT_FLAG_DIR_CREATED) {
+ if (rmdir(me->key) == -1) {
+ char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
+ warn(ap->logopt, "failed to remove dir %s: %s",
+ me->key, estr);
+ }
+ }
+ return rv;
+}
+
+static int do_umount_direct(struct autofs_point *ap, struct mapent *me)
+{
+ int rv, retries = UMOUNT_RETRIES;
+
+ while ((rv = umount(me->key)) == -1 && retries--) {
+ struct timespec tm = {0, 50000000};
+ if (errno != EBUSY)
+ break;
+ nanosleep(&tm, NULL);
+ }
+
+ if (rv == -1) {
+ switch (errno) {
+ case ENOENT:
+ case EINVAL:
+ warn(ap->logopt, "mount point %s does not exist",
+ me->key);
+ return 0;
+ case EBUSY:
+ warn(ap->logopt, "mount point %s is in use", me->key);
+ if (ap->state == ST_SHUTDOWN_FORCE)
+ goto out;
+ else
+ return 0;
+ case ENOTDIR:
+ error(ap->logopt, "mount point is not a directory");
+ return 0;
+ }
+ return 1;
+ }
+out:
+ return finish_umount(ap, me, rv);
+}
+
int do_umount_autofs_direct(struct autofs_point *ap, struct mapent *me)
{
struct ioctl_ops *ops = get_ioctl_ops();
struct mapent_cache *mc = me->mc;
char buf[MAX_ERR_BUF];
- int ioctlfd = -1, rv, left, retries;
+ int ioctlfd = -1, rv, left;
char key[PATH_MAX + 1];
struct mapent *tmp;
int opened = 0;
@@ -153,8 +207,7 @@ int do_umount_autofs_direct(struct autof
} else {
me->ioctlfd = -1;
ops->close(ap->logopt, ioctlfd);
- rv = -1;
- goto force_umount;
+ return finish_umount(ap, me, -1);
}
}
me->ioctlfd = -1;
@@ -167,52 +220,7 @@ int do_umount_autofs_direct(struct autof
sched_yield();
- retries = UMOUNT_RETRIES;
- while ((rv = umount(me->key)) == -1 && retries--) {
- struct timespec tm = {0, 50000000};
- if (errno != EBUSY)
- break;
- nanosleep(&tm, NULL);
- }
-
- if (rv == -1) {
- switch (errno) {
- case ENOENT:
- case EINVAL:
- warn(ap->logopt, "mount point %s does not exist",
- me->key);
- return 0;
- break;
- case EBUSY:
- warn(ap->logopt, "mount point %s is in use", me->key);
- if (ap->state == ST_SHUTDOWN_FORCE)
- goto force_umount;
- else
- return 0;
- break;
- case ENOTDIR:
- error(ap->logopt, "mount point is not a directory");
- return 0;
- break;
- }
- return 1;
- }
-
-force_umount:
- if (rv != 0) {
- info(ap->logopt, "forcing umount of direct mount %s", me->key);
- rv = umount2(me->key, MNT_DETACH);
- } else
- info(ap->logopt, "umounted direct mount %s", me->key);
-
- if (!rv && me->flags & MOUNT_FLAG_DIR_CREATED) {
- if (rmdir(me->key) == -1) {
- char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
- warn(ap->logopt, "failed to remove dir %s: %s",
- me->key, estr);
- }
- }
- return rv;
+ return do_umount_direct(ap, me);
}
int umount_autofs_direct(struct autofs_point *ap)

View File

@ -1,36 +0,0 @@
autofs-5.1.9 - remove unnecessary assignment in umount_multi()
From: Ian Kent <raven@themaw.net>
Remove the leftover initialisation of left from when there were multiple
calls to umount_subtree_mounts().
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/automount.c | 4 +---
2 files changed, 2 insertions(+), 3 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -184,6 +184,7 @@
- fix cache writelock must be taken in update_map_cache().
- fix skip valid map entries on expire cleanup.
- remove unnecessary call to set_direct_mount_tree_catatonic().
+- remove unnecessary assignment in umount_multi().
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/automount.c
+++ autofs-5.1.4/daemon/automount.c
@@ -695,9 +695,7 @@ int umount_multi(struct autofs_point *ap
mnts_put_mount(sbmnt);
}
- left = 0;
-
- left += umount_subtree_mounts(ap, path, is_autofs_fs);
+ left = umount_subtree_mounts(ap, path, is_autofs_fs);
/* Delete detritus like unwanted mountpoints and symlinks */
if (left == 0 &&

View File

@ -1,44 +0,0 @@
autofs-5.1.9 - remove unnecessary call to set_direct_mount_tree_catatonic()
From: Ian Kent <raven@themaw.net>
Function do_umount_autofs_direct() is called in two cases, during a
readmap and when umounting top level direct mounts.
During a readmap, mounts should not be set catatonic so the call to
set_direct_mount_tree_catatonic() is not needed. If it's called for a
top level direct mount the caller, umount_autofs_direct(), calls
set_direct_mount_tree_catatonic() itself already. So remove this
unnecessary call.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/direct.c | 5 +----
2 files changed, 2 insertions(+), 4 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -183,6 +183,7 @@
- fix devid update on reload.
- fix cache writelock must be taken in update_map_cache().
- fix skip valid map entries on expire cleanup.
+- remove unnecessary call to set_direct_mount_tree_catatonic().
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/direct.c
+++ autofs-5.1.4/daemon/direct.c
@@ -186,11 +186,8 @@ int do_umount_autofs_direct(struct autof
warn(ap->logopt, "mount point %s is in use", me->key);
if (ap->state == ST_SHUTDOWN_FORCE)
goto force_umount;
- else {
- if (ap->state != ST_READMAP)
- set_direct_mount_tree_catatonic(ap, me);
+ else
return 0;
- }
break;
case ENOTDIR:
error(ap->logopt, "mount point is not a directory");

View File

@ -1,133 +0,0 @@
commit a2002247e16ef60efe049e04119a9c92694cbfe1
Author: Ian Kent <raven@themaw.net>
Date: Tue Jul 9 14:59:40 2024 +0800
autofs-5.1.9 - seperate amd mount and entry flags
We are running out of flags for amd mounts, seperate the mount flags
from the defaults and entry flags and add a new amd entry flags field.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
include/parse_amd.h | 11 ++++++-----
modules/amd_parse.y | 7 ++++---
modules/parse_amd.c | 10 +++++-----
4 files changed, 16 insertions(+), 13 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -168,6 +168,7 @@
- fix missing unlock in sasl_do_kinit_ext_cc().
- handle sss special case getautomntbyname() error.
- fix amd cache options not copied.
+- seperate amd mount and entry flags.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/include/parse_amd.h
+++ autofs-5.1.4/include/parse_amd.h
@@ -33,12 +33,12 @@
#define AMD_MOUNT_TYPE_PROGRAM 0x00004000
#define AMD_MOUNT_TYPE_MASK 0x0000ffff
-#define AMD_ENTRY_CUT 0x00010000
-#define AMD_ENTRY_MASK 0x00ff0000
+#define AMD_DEFAULTS_MERGE 0x0001
+#define AMD_DEFAULTS_RESET 0x0002
+#define AMD_DEFAULTS_MASK 0x00ff
-#define AMD_DEFAULTS_MERGE 0x01000000
-#define AMD_DEFAULTS_RESET 0x02000000
-#define AMD_DEFAULTS_MASK 0xff000000
+#define AMD_ENTRY_CUT 0x0100
+#define AMD_ENTRY_MASK 0xff00
#define AMD_CACHE_OPTION_NONE 0x0000
#define AMD_CACHE_OPTION_INC 0x0001
@@ -50,6 +50,7 @@ struct amd_entry {
char *path;
unsigned long flags;
unsigned int cache_opts;
+ unsigned int entry_flags;
char *type;
char *map_type;
char *pref;
--- autofs-5.1.4.orig/modules/amd_parse.y
+++ autofs-5.1.4/modules/amd_parse.y
@@ -155,7 +155,7 @@ location_selection_list: location
}
| location_selection_list SPACE CUT SPACE location
{
- entry.flags |= AMD_ENTRY_CUT;
+ entry.entry_flags |= AMD_ENTRY_CUT;
if (!add_location()) {
amd_msg("failed to allocate new location");
YYABORT;
@@ -168,11 +168,11 @@ location: location_entry
}
| HYPHEN location_entry
{
- entry.flags |= AMD_DEFAULTS_MERGE;
+ entry.entry_flags |= AMD_DEFAULTS_MERGE;
}
| HYPHEN
{
- entry.flags |= AMD_DEFAULTS_RESET;
+ entry.entry_flags |= AMD_DEFAULTS_RESET;
}
;
@@ -889,6 +889,7 @@ static int add_location(void)
}
new->flags = entry.flags;
new->cache_opts = entry.cache_opts;
+ new->entry_flags = entry.entry_flags;
new->type = entry.type;
new->map_type = entry.map_type;
new->pref = entry.pref;
--- autofs-5.1.4.orig/modules/parse_amd.c
+++ autofs-5.1.4/modules/parse_amd.c
@@ -2022,13 +2022,13 @@ static struct amd_entry *select_default_
p = p->next;
- if (this->flags & AMD_DEFAULTS_MERGE) {
+ if (this->entry_flags & AMD_DEFAULTS_MERGE) {
if (entry_default)
free_amd_entry(entry_default);
list_del_init(&this->list);
entry_default = this;
continue;
- } else if (this->flags & AMD_DEFAULTS_RESET) {
+ } else if (this->entry_flags & AMD_DEFAULTS_RESET) {
struct amd_entry *new;
new = dup_defaults_entry(defaults_entry);
if (new) {
@@ -2259,14 +2259,14 @@ int parse_mount(struct autofs_point *ap,
struct amd_entry *this = list_entry(p, struct amd_entry, list);
p = p->next;
- if (this->flags & AMD_DEFAULTS_MERGE) {
+ if (this->entry_flags & AMD_DEFAULTS_MERGE) {
free_amd_entry(cur_defaults);
list_del_init(&this->list);
cur_defaults = this;
update_with_defaults(defaults_entry, cur_defaults, sv);
debug(ap->logopt, "merged /defaults entry with defaults");
continue;
- } else if (this->flags & AMD_DEFAULTS_RESET) {
+ } else if (this->entry_flags & AMD_DEFAULTS_RESET) {
struct amd_entry *nd, *new;
struct substvar *nsv = NULL;
@@ -2291,7 +2291,7 @@ int parse_mount(struct autofs_point *ap,
debug(ap->logopt, "expand defaults entry");
sv = expand_entry(ap, cur_defaults, flags, sv);
- if (this->flags & AMD_ENTRY_CUT && at_least_one) {
+ if (this->entry_flags & AMD_ENTRY_CUT && at_least_one) {
info(ap->logopt, MODPREFIX
"at least one entry tried before cut selector, "
"not continuing");

View File

@ -1,36 +0,0 @@
autofs-5.1.9 - skip expire check for amd nounmount mounts
From: Ian Kent <raven@themaw.net>
There's no need to check amd mounts with the "nounmount" option set.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/indirect.c | 5 +++++
2 files changed, 6 insertions(+)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -178,6 +178,7 @@
- update per-mount expire timeout on readmap.
- clear per-mount timeout if not set.
- fix incorrect flags update in update_with_defaults().
+- skip expire check for amd nounmount mounts.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/indirect.c
+++ autofs-5.1.4/daemon/indirect.c
@@ -377,6 +377,11 @@ void *expire_proc_indirect(void *arg)
char *ind_key;
int ret;
+ /* No need to check "nounmount" amd mounts */
+ if (mnt->flags & MNTS_AMD_MOUNT &&
+ mnt->amd_flags & AMD_MOUNT_OPT_NOUNMOUNT)
+ continue;
+
if (mnt->flags & (MNTS_AUTOFS|MNTS_OFFSET)) {
/*
* If we have submounts check if this path lives below

View File

@ -1,225 +0,0 @@
autofs-5.1.9 - update per-mount expire timeout on readmap
From: Ian Kent <raven@themaw.net>
Ensure read map requests are propagated to child submounts and update
the amd per-mount timeout.
Also update the logging text to remove the use of the word dentry as
it might not make sense to users.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1
daemon/master.c | 2
daemon/state.c | 1
include/master.h | 1
include/mounts.h | 1
lib/mounts.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/parse_amd.c | 6 +-
7 files changed, 130 insertions(+), 4 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -175,6 +175,7 @@
- fix lookup search type in umount_subtree_mounts().
- fix remount_active_mount() not remounting symlinks.
- log when setting amd per-mount timeout.
+- update per-mount expire timeout on readmap.
xx/xx/2018 autofs-5.1.5
- fix flag file permission.
--- autofs-5.1.4.orig/daemon/master.c
+++ autofs-5.1.4/daemon/master.c
@@ -1378,7 +1378,7 @@ static int master_do_mount(struct master
return 1;
}
-static void check_update_map_sources(struct master_mapent *entry, int readall)
+void check_update_map_sources(struct master_mapent *entry, int readall)
{
struct map_source *source, *last;
struct autofs_point *ap;
--- autofs-5.1.4.orig/daemon/state.c
+++ autofs-5.1.4/daemon/state.c
@@ -456,6 +456,7 @@ static void *do_readmap(void *arg)
time_t timeout = get_exp_timeout(ap, ap->entry->maps);
ap->exp_runfreq = (timeout + CHECK_RATIO - 1) / CHECK_RATIO;
ops->timeout(ap->logopt, ap->ioctlfd, NULL, timeout);
+ update_mounted_mounts_timeout(ap, ap->path);
lookup_prune_cache(ap, now);
status = lookup_ghost(ap);
} else {
--- autofs-5.1.4.orig/include/master.h
+++ autofs-5.1.4/include/master.h
@@ -115,6 +115,7 @@ struct master *master_new(const char *,
int master_read_master(struct master *, time_t);
int master_notify_submount(struct autofs_point *, const char *path, enum states);
void master_notify_state_change(struct master *, int);
+void check_update_map_sources(struct master_mapent *, int);
int master_mount_mounts(struct master *, time_t);
int dump_map(struct master *, const char *, const char *);
int master_show_mounts(struct master *);
--- autofs-5.1.4.orig/include/mounts.h
+++ autofs-5.1.4/include/mounts.h
@@ -197,6 +197,7 @@ const char *mount_type_str(unsigned int)
void set_exp_timeout(struct autofs_point *ap, struct map_source *source, time_t timeout);
time_t get_exp_timeout(struct autofs_point *ap, struct map_source *source);
void notify_mount_result(struct autofs_point *, const char *, time_t, const char *);
+void update_mounted_mounts_timeout(struct autofs_point *, const char *);
int try_remount(struct autofs_point *, struct mapent *, unsigned int);
void set_indirect_mount_tree_catatonic(struct autofs_point *);
void set_direct_mount_tree_catatonic(struct autofs_point *, struct mapent *);
--- autofs-5.1.4.orig/lib/mounts.c
+++ autofs-5.1.4/lib/mounts.c
@@ -2622,6 +2622,128 @@ void notify_mount_result(struct autofs_p
return;
}
+void update_mounted_mounts_timeout(struct autofs_point *ap, const char *path)
+{
+ struct ioctl_ops *ops = get_ioctl_ops();
+ struct dirent **de;
+ char buf[PATH_MAX + 1];
+ int n, size;
+
+ n = scandir(path, &de, 0, alphasort);
+ if (n < 0)
+ return;
+
+ size = sizeof(buf);
+
+ while (n--) {
+ unsigned int mounted = 0;
+ struct mnt_list *mnt;
+ int ret;
+
+ if (strcmp(de[n]->d_name, ".") == 0 ||
+ strcmp(de[n]->d_name, "..") == 0) {
+ free(de[n]);
+ continue;
+ }
+
+ ret = cat_path(buf, size, path, de[n]->d_name);
+ if (!ret) {
+ do {
+ free(de[n]);
+ } while (n--);
+ free(de);
+ return;
+ }
+
+ ops->ismountpoint(ap->logopt, -1, buf, &mounted);
+ if (!mounted) {
+ struct dirent **de2;
+ int i, j;
+
+ i = j = scandir(buf, &de2, 0, alphasort);
+ if (i < 0) {
+ free(de[n]);
+ continue;
+ }
+ while (i--)
+ free(de2[i]);
+ free(de2);
+ if (j <= 2) {
+ free(de[n]);
+ continue;
+ }
+ }
+
+ /* For submounts we need to propogate the read map
+ * request.
+ */
+ mnt = mnts_find_submount(buf);
+ if (mnt) {
+ check_update_map_sources(mnt->ap->entry, 1);
+ mnts_put_mount(mnt);
+ }
+
+ mnt = mnts_find_amdmount(buf);
+ if (!mnt) {
+ free(de[n]);
+ continue;
+ }
+
+ /* For amd type auto mounts the timeout is the per-mount
+ * timeout.
+ */
+ if (mnt->amd_flags & AMD_MOUNT_TYPE_AUTO)
+ goto next;
+
+ /* No per-mount timeout set? */
+ if (!(mnt->amd_flags & AMD_MOUNT_OPT_MASK))
+ goto next;
+
+ /* The default in autofs is to always expire mounts according to
+ * a timeout set in the autofs mount super block information
+ * structure. But amd allows for differing expire timeouts on a
+ * per-mount basis. It also has (context sensitive) options "unmount"
+ * to say expire this mount and "nounmount" to say don't expire this
+ * mount. In amd mounts these options are set by default according
+ * to whether a mount should expire or not, for example a cd mount
+ * is set "nounmount". Setting defaults like this is not used in the
+ * autofs amd implementation because there's only one, little used,
+ * removable file system available.
+ *
+ * But the "nounmount" and "utimeout" options can be useful.
+ */
+ if (mnt->amd_flags & AMD_MOUNT_OPT_NOUNMOUNT) {
+ if (mnt->amd_utimeout)
+ warn(ap->logopt,
+ "non-zero timeout set, possible conflicting options");
+
+ /* "nounmount" option, don't expire this mount. */
+ if (ops) {
+ info(ap->logopt,
+ "set amd per-mount expire timeout to 0 for %s",
+ buf);
+ ops->timeout(ap->logopt, ap->ioctlfd, de[n]->d_name, 0);
+ }
+ } else if (mnt->amd_flags & AMD_MOUNT_OPT_UTIMEOUT) {
+ if (!mnt->amd_utimeout)
+ warn(ap->logopt,
+ "zero timeout set, possible conflicting options");
+
+ /* "utimeout" option, expire this mount according to a timeout. */
+ if (ops) {
+ info(ap->logopt,
+ "set amd per-mount expire timeout to %d for %s",
+ mnt->amd_utimeout, buf);
+ ops->timeout(ap->logopt, ap->ioctlfd, de[n]->d_name, mnt->amd_utimeout);
+ }
+ }
+next:
+ mnts_put_mount(mnt);
+ free(de[n]);
+ }
+ free(de);
+}
+
static int do_remount_direct(struct autofs_point *ap,
const unsigned int type, int fd, const char *path)
{
--- autofs-5.1.4.orig/modules/parse_amd.c
+++ autofs-5.1.4/modules/parse_amd.c
@@ -1758,7 +1758,7 @@ static int amd_mount(struct autofs_point
if (ops) {
info(ap->logopt,
"set amd per-mount expire timeout to 0 for %s",
- name);
+ entry->path);
ops->timeout(ap->logopt, ap->ioctlfd, name, 0);
}
} else if (per_mnt_flags & AMD_MOUNT_OPT_UTIMEOUT) {
@@ -1769,8 +1769,8 @@ static int amd_mount(struct autofs_point
/* "utimeout" option, expire this mount according to a timeout. */
if (ops) {
info(ap->logopt,
- "set amd per-dentry expire timeout to %d for %s",
- entry->utimeout, name);
+ "set amd per-mount expire timeout to %d for %s",
+ entry->utimeout, entry->path);
ops->timeout(ap->logopt, ap->ioctlfd, name, entry->utimeout);
}
}

View File

@ -8,7 +8,7 @@
Summary: A tool for automatically mounting and unmounting filesystems
Name: autofs
Version: 5.1.4
Release: 114%{?dist}.8
Release: 113%{?dist}
Epoch: 1
License: GPLv2+
Group: System Environment/Daemons
@ -332,57 +332,6 @@ Patch328: autofs-5.1.8-fix-multi-mount-check.patch
Patch329: autofs-5.1.9-fix-get-parent-multi-mount-check-in-try_remount.patch
Patch330: autofs-5.1.9-fix-deadlock-in-remount.patch
Patch331: autofs-5.1.9-fix-submount-shutdown-race.patch
Patch332: autofs-5.1.9-fix-amd-external-mount-error-handling.patch
Patch333: autofs-5.1.9-fix-amd-external-mount-mount-handling.patch
Patch334: autofs-5.1.9-dont-free-ext-mount-if-mounted.patch
Patch335: autofs-5.1.9-refactor-amd-function-do_program_mount.patch
Patch336: autofs-5.1.9-refactor-amd-function-umount_amd_ext_mount.patch
Patch337: autofs-5.1.9-add-flags-argument-to-amd-do_program_mount.patch
Patch338: autofs-5.1.9-fix-deadlock-in-master_notify_submount.patch
Patch339: autofs-5.1.9-fix-lock-ordering-deadlock-in-expire_cleanup.patch
# JIRA: RHEL-90238
Patch340: autofs-5.1.6-fix-ldap-sasl-reconnect-problem.patch
Patch341: autofs-5.1.8-always-recreate-credential-cache.patch
Patch342: autofs-5.1.9-fix-always-recreate-credential-cache.patch
# JIRA: RHEL-111930
Patch343: autofs-5.1.8-fix-missing-unlock-in-sasl_do_kinit_ext_cc.patch
# JIRA: RHEL-127179
Patch344: autofs-5.1.9-handle-sss-special-case-getautomntbyname-error.patch
# JIRA: RHEL-46409
Patch350: autofs-5.1.9-fix-amd-cache-options-not-copied.patch
Patch351: autofs-5.1.9-seperate-amd-mount-and-entry-flags.patch
Patch352: autofs-5.1.9-make-ioctl-ops-timeout-handle-per-dentry-expire.patch
Patch353: autofs-5.1.9-refactor-amd-mount-options-handling.patch
Patch354: autofs-5.1.9-add-some-unimplemented-amd-map-options.patch
Patch355: autofs-5.1.9-fix-lookup-search-type-in-umount_subtree_mounts.patch
Patch356: autofs-5.1.9-fix-remount_active_mount-not-remounting-symlinks.patch
Patch357: autofs-5.1.9-log-when-setting-amd-per-mount-timeout.patch
Patch358: autofs-5.1.9-update-per-mount-expire-timeout-on-readmap.patch
Patch359: autofs-5.1.7-clear-per-mount-timeout-if-not-set.patch
Patch360: autofs-5.1.9-fix-incorrect-flags-update-in-update_with_defaults.patch
Patch361: autofs-5.1.9-skip-expire-check-for-amd-nounmount-mounts.patch
# JIRA: RHEL-RHEL-97546
Patch370: autofs-5.1.9-quiet-possibly-noisy-log-message.patch
Patch371: autofs-5.1.9-fix-devid-update-on-reload.patch
Patch372: autofs-5.1.9-fix-cache-writelock-must-be-taken-in-update_map_cache.patch
Patch373: autofs-5.1.9-fix-skip-valid-map-entries-on-expire-cleanup.patch
Patch374: autofs-5.1.9-remove-unnecessary-call-to-set_direct_mount_tree_catatonic.patch
Patch375: autofs-5.1.9-remove-unnecessary-assignment-in-umount_multi.patch
Patch376: autofs-5.1.9-fix-direct-mount-trigger-umount-failure-case.patch
Patch377: autofs-5.1.9-refactor-do_umount_autofs_direct.patch
Patch378: autofs-5.1.9-fix-stale-direct-mount-trigger-not-umounted-on-expire.patch
Patch379: autofs-5.1.9-add-function-table_lookup_ino.patch
Patch380: autofs-5.1.9-improve-handling-of-missing-map-entry-for-mount-request.patch
%if %{with_systemd}
BuildRequires: systemd-units
BuildRequires: systemd-devel
@ -442,364 +391,318 @@ echo %{version}-%{release} > .version
%define unitdir %{?_unitdir:/usr/lib/systemd/system}
%define systemd_configure_arg --with-systemd
%endif
%patch -P 1 -p1
%patch -P 2 -p1
%patch -P 3 -p1
%patch -P 4 -p1
%patch -P 5 -p1
%patch -P 6 -p1
%patch -P 7 -p1
%patch -P 8 -p1
%patch -P 9 -p1
%patch -P 10 -p1
%patch -P 11 -p1
%patch -P 12 -p1
%patch -P 13 -p1
%patch -P 14 -p1
%patch -P 15 -p1
%patch -P 16 -p1
%patch -P 17 -p1
%patch -P 18 -p1
%patch -P 19 -p1
%patch -P 20 -p1
%patch -P 21 -p1
%patch -P 22 -p1
%patch -P 23 -p1
%patch -P 24 -p1
%patch -P 25 -p1
%patch -P 26 -p1
%patch -P 27 -p1
%patch -P 28 -p1
%patch -P 29 -p1
%patch -P 30 -p1
%patch -P 31 -p1
%patch -P 32 -p1
%patch -P 33 -p1
%patch -P 34 -p1
%patch -P 35 -p1
%patch -P 36 -p1
%patch -P 37 -p1
%patch -P 38 -p1
%patch -P 39 -p1
%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
%patch -P 40 -p1
%patch -P 41 -p1
%patch -P 42 -p1
%patch -P 43 -p1
%patch -P 44 -p1
%patch -P 45 -p1
%patch -P 46 -p1
%patch -P 47 -p1
%patch -P 48 -p1
%patch -P 49 -p1
%patch -P 50 -p1
%patch -P 51 -p1
%patch -P 52 -p1
%patch -P 53 -p1
%patch -P 54 -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
%patch53 -p1
%patch54 -p1
%patch -P 60 -p1
%patch -P 61 -p1
%patch -P 62 -p1
%patch -P 63 -p1
%patch -P 64 -p1
%patch -P 65 -p1
%patch -P 66 -p1
%patch -P 67 -p1
%patch -P 68 -p1
%patch -P 69 -p1
%patch -P 70 -p1
%patch -P 71 -p1
%patch -P 72 -p1
%patch -P 73 -p1
%patch -P 74 -p1
%patch -P 75 -p1
%patch -P 76 -p1
%patch -P 77 -p1
%patch -P 78 -p1
%patch -P 79 -p1
%patch -P 80 -p1
%patch -P 81 -p1
%patch -P 82 -p1
%patch60 -p1
%patch61 -p1
%patch62 -p1
%patch63 -p1
%patch64 -p1
%patch65 -p1
%patch66 -p1
%patch67 -p1
%patch68 -p1
%patch69 -p1
%patch70 -p1
%patch71 -p1
%patch72 -p1
%patch73 -p1
%patch74 -p1
%patch75 -p1
%patch76 -p1
%patch77 -p1
%patch78 -p1
%patch79 -p1
%patch80 -p1
%patch81 -p1
%patch82 -p1
%patch -P 83 -p1
%patch -P 84 -p1
%patch83 -p1
%patch84 -p1
%patch -P 85 -p1
%patch -P 86 -p1
%patch -P 87 -p1
%patch -P 88 -p1
%patch85 -p1
%patch86 -p1
%patch87 -p1
%patch88 -p1
%patch -P 89 -p1
%patch -P 90 -p1
%patch89 -p1
%patch90 -p1
%patch -P 91 -p1
%patch -P 92 -p1
%patch -P 93 -p1
%patch -P 94 -p1
%patch -P 95 -p1
%patch -P 96 -p1
%patch -P 97 -p1
%patch -P 98 -p1
%patch91 -p1
%patch92 -p1
%patch93 -p1
%patch94 -p1
%patch95 -p1
%patch96 -p1
%patch97 -p1
%patch98 -p1
%patch -P 100 -p1
%patch -P 101 -p1
%patch -P 102 -p1
%patch -P 103 -p1
%patch -P 104 -p1
%patch -P 105 -p1
%patch -P 106 -p1
%patch -P 107 -p1
%patch -P 108 -p1
%patch -P 109 -p1
%patch -P 110 -p1
%patch -P 111 -p1
%patch -P 112 -p1
%patch -P 113 -p1
%patch -P 114 -p1
%patch -P 115 -p1
%patch -P 116 -p1
%patch -P 117 -p1
%patch -P 118 -p1
%patch -P 119 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch107 -p1
%patch108 -p1
%patch109 -p1
%patch110 -p1
%patch111 -p1
%patch112 -p1
%patch113 -p1
%patch114 -p1
%patch115 -p1
%patch116 -p1
%patch117 -p1
%patch118 -p1
%patch119 -p1
%patch -P 120 -p1
%patch -P 121 -p1
%patch -P 122 -p1
%patch -P 123 -p1
%patch -P 124 -p1
%patch -P 125 -p1
%patch -P 126 -p1
%patch -P 127 -p1
%patch -P 128 -p1
%patch -P 129 -p1
%patch -P 130 -p1
%patch -P 131 -p1
%patch -P 132 -p1
%patch -P 133 -p1
%patch -P 134 -p1
%patch -P 135 -p1
%patch -P 136 -p1
%patch -P 137 -p1
%patch -P 138 -p1
%patch -P 139 -p1
%patch -P 140 -p1
%patch -P 141 -p1
%patch -P 142 -p1
%patch -P 143 -p1
%patch -P 144 -p1
%patch -P 145 -p1
%patch -P 146 -p1
%patch -P 147 -p1
%patch -P 148 -p1
%patch -P 149 -p1
%patch -P 150 -p1
%patch -P 151 -p1
%patch -P 152 -p1
%patch -P 153 -p1
%patch -P 154 -p1
%patch -P 155 -p1
%patch -P 156 -p1
%patch -P 157 -p1
%patch -P 158 -p1
%patch -P 159 -p1
%patch -P 160 -p1
%patch -P 161 -p1
%patch -P 162 -p1
%patch -P 163 -p1
%patch -P 164 -p1
%patch -P 165 -p1
%patch -P 166 -p1
%patch -P 167 -p1
%patch -P 168 -p1
%patch -P 169 -p1
%patch -P 170 -p1
%patch -P 171 -p1
%patch -P 172 -p1
%patch -P 173 -p1
%patch -P 174 -p1
%patch -P 175 -p1
%patch -P 176 -p1
%patch -P 177 -p1
%patch -P 178 -p1
%patch -P 179 -p1
%patch -P 180 -p1
%patch -P 181 -p1
%patch -P 182 -p1
%patch -P 183 -p1
%patch -P 184 -p1
%patch -P 185 -p1
%patch -P 186 -p1
%patch -P 187 -p1
%patch -P 188 -p1
%patch -P 189 -p1
%patch -P 190 -p1
%patch -P 191 -p1
%patch -P 192 -p1
%patch -P 193 -p1
%patch -P 194 -p1
%patch -P 195 -p1
%patch -P 196 -p1
%patch -P 197 -p1
%patch -P 198 -p1
%patch -P 199 -p1
%patch -P 200 -p1
%patch -P 201 -p1
%patch -P 202 -p1
%patch -P 203 -p1
%patch -P 204 -p1
%patch -P 205 -p1
%patch -P 206 -p1
%patch -P 207 -p1
%patch -P 208 -p1
%patch -P 209 -p1
%patch -P 210 -p1
%patch -P 211 -p1
%patch120 -p1
%patch121 -p1
%patch122 -p1
%patch123 -p1
%patch124 -p1
%patch125 -p1
%patch126 -p1
%patch127 -p1
%patch128 -p1
%patch129 -p1
%patch130 -p1
%patch131 -p1
%patch132 -p1
%patch133 -p1
%patch134 -p1
%patch135 -p1
%patch136 -p1
%patch137 -p1
%patch138 -p1
%patch139 -p1
%patch140 -p1
%patch141 -p1
%patch142 -p1
%patch143 -p1
%patch144 -p1
%patch145 -p1
%patch146 -p1
%patch147 -p1
%patch148 -p1
%patch149 -p1
%patch150 -p1
%patch151 -p1
%patch152 -p1
%patch153 -p1
%patch154 -p1
%patch155 -p1
%patch156 -p1
%patch157 -p1
%patch158 -p1
%patch159 -p1
%patch160 -p1
%patch161 -p1
%patch162 -p1
%patch163 -p1
%patch164 -p1
%patch165 -p1
%patch166 -p1
%patch167 -p1
%patch168 -p1
%patch169 -p1
%patch170 -p1
%patch171 -p1
%patch172 -p1
%patch173 -p1
%patch174 -p1
%patch175 -p1
%patch176 -p1
%patch177 -p1
%patch178 -p1
%patch179 -p1
%patch180 -p1
%patch181 -p1
%patch182 -p1
%patch183 -p1
%patch184 -p1
%patch185 -p1
%patch186 -p1
%patch187 -p1
%patch188 -p1
%patch189 -p1
%patch190 -p1
%patch191 -p1
%patch192 -p1
%patch193 -p1
%patch194 -p1
%patch195 -p1
%patch196 -p1
%patch197 -p1
%patch198 -p1
%patch199 -p1
%patch200 -p1
%patch201 -p1
%patch202 -p1
%patch203 -p1
%patch204 -p1
%patch205 -p1
%patch206 -p1
%patch207 -p1
%patch208 -p1
%patch209 -p1
%patch210 -p1
%patch211 -p1
%patch -P 212 -p1
%patch -P 213 -p1
%patch -P 214 -p1
%patch -P 215 -p1
%patch -P 216 -p1
%patch -P 217 -p1
%patch -P 218 -p1
%patch212 -p1
%patch213 -p1
%patch214 -p1
%patch215 -p1
%patch216 -p1
%patch217 -p1
%patch218 -p1
%patch -P 219 -p1
%patch -P 220 -p1
%patch -P 221 -p1
%patch219 -p1
%patch220 -p1
%patch221 -p1
%patch -P 222 -p1
%patch -P 223 -p1
%patch222 -p1
%patch223 -p1
%patch -P 224 -p1
%patch -P 225 -p1
%patch -P 226 -p1
%patch -P 227 -p1
%patch -P 228 -p1
%patch224 -p1
%patch225 -p1
%patch226 -p1
%patch227 -p1
%patch228 -p1
%patch -P 229 -p1
%patch -P 230 -p1
%patch -P 231 -p1
%patch -P 232 -p1
%patch -P 233 -p1
%patch -P 234 -p1
%patch -P 235 -p1
%patch -P 236 -p1
%patch -P 237 -p1
%patch -P 238 -p1
%patch -P 239 -p1
%patch -P 240 -p1
%patch -P 241 -p1
%patch -P 242 -p1
%patch -P 243 -p1
%patch -P 244 -p1
%patch -P 245 -p1
%patch -P 246 -p1
%patch -P 247 -p1
%patch -P 248 -p1
%patch -P 249 -p1
%patch -P 250 -p1
%patch -P 251 -p1
%patch -P 252 -p1
%patch -P 253 -p1
%patch -P 254 -p1
%patch229 -p1
%patch230 -p1
%patch231 -p1
%patch232 -p1
%patch233 -p1
%patch234 -p1
%patch235 -p1
%patch236 -p1
%patch237 -p1
%patch238 -p1
%patch239 -p1
%patch240 -p1
%patch241 -p1
%patch242 -p1
%patch243 -p1
%patch244 -p1
%patch245 -p1
%patch246 -p1
%patch247 -p1
%patch248 -p1
%patch249 -p1
%patch250 -p1
%patch251 -p1
%patch252 -p1
%patch253 -p1
%patch254 -p1
%patch -P 260 -p1
%patch -P 261 -p1
%patch -P 262 -p1
%patch -P 263 -p1
%patch -P 264 -p1
%patch -P 265 -p1
%patch -P 266 -p1
%patch -P 267 -p1
%patch -P 268 -p1
%patch -P 269 -p1
%patch -P 270 -p1
%patch -P 271 -p1
%patch -P 272 -p1
%patch -P 273 -p1
%patch -P 274 -p1
%patch -P 275 -p1
%patch260 -p1
%patch261 -p1
%patch262 -p1
%patch263 -p1
%patch264 -p1
%patch265 -p1
%patch266 -p1
%patch267 -p1
%patch268 -p1
%patch269 -p1
%patch270 -p1
%patch271 -p1
%patch272 -p1
%patch273 -p1
%patch274 -p1
%patch275 -p1
%patch -P 300 -p1
%patch -P 301 -p1
%patch -P 302 -p1
%patch -P 303 -p1
%patch -P 304 -p1
%patch -P 305 -p1
%patch -P 306 -p1
%patch -P 307 -p1
%patch -P 308 -p1
%patch -P 309 -p1
%patch -P 310 -p1
%patch -P 311 -p1
%patch -P 312 -p1
%patch -P 313 -p1
%patch -P 314 -p1
%patch -P 315 -p1
%patch -P 316 -p1
%patch -P 317 -p1
%patch -P 318 -p1
%patch -P 319 -p1
%patch -P 320 -p1
%patch -P 321 -p1
%patch -P 322 -p1
%patch -P 323 -p1
%patch -P 324 -p1
%patch -P 325 -p1
%patch -P 326 -p1
%patch300 -p1
%patch301 -p1
%patch302 -p1
%patch303 -p1
%patch304 -p1
%patch305 -p1
%patch306 -p1
%patch307 -p1
%patch308 -p1
%patch309 -p1
%patch310 -p1
%patch311 -p1
%patch312 -p1
%patch313 -p1
%patch314 -p1
%patch315 -p1
%patch316 -p1
%patch317 -p1
%patch318 -p1
%patch319 -p1
%patch320 -p1
%patch321 -p1
%patch322 -p1
%patch323 -p1
%patch324 -p1
%patch325 -p1
%patch326 -p1
%patch -P 327 -p1
%patch -P 328 -p1
%patch327 -p1
%patch328 -p1
%patch -P 329 -p1
%patch -P 330 -p1
%patch -P 331 -p1
%patch -P 332 -p1
%patch -P 333 -p1
%patch -P 334 -p1
%patch -P 335 -p1
%patch -P 336 -p1
%patch -P 337 -p1
%patch -P 338 -p1
%patch -P 339 -p1
%patch -P 340 -p1
%patch -P 341 -p1
%patch -P 342 -p1
%patch -P 343 -p1
%patch -P 344 -p1
%patch -P 350 -p1
%patch -P 351 -p1
%patch -P 352 -p1
%patch -P 353 -p1
%patch -P 354 -p1
%patch -P 355 -p1
%patch -P 356 -p1
%patch -P 357 -p1
%patch -P 358 -p1
%patch -P 359 -p1
%patch -P 360 -p1
%patch -P 361 -p1
%patch -P 370 -p1
%patch -P 371 -p1
%patch -P 372 -p1
%patch -P 373 -p1
%patch -P 374 -p1
%patch -P 375 -p1
%patch -P 376 -p1
%patch -P 377 -p1
%patch -P 378 -p1
%patch -P 379 -p1
%patch -P 380 -p1
%patch329 -p1
%patch330 -p1
%build
LDFLAGS=-Wl,-z,now
@ -895,79 +798,6 @@ fi
%dir /etc/auto.master.d
%changelog
* Fri Feb 27 2026 Ian Kent <ikent@redhat.com> - 5.1.4-114.el8_10.8
- RHEL-97546 - hung tasks after autofs reload
- quiet possibly noisy log message.
- fix devid update on reload.
- fix cache writelock must be taken in update_map_cache().
- fix skip valid map entries on expire cleanup.
- remove unnecessary call to set_direct_mount_tree_catatonic().
- remove unnecessary assignment in umount_multi().
- fix direct mount trigger umount failure case.
- refactor do_umount_autofs_direct().
- fix stale direct mount trigger not umounted on expire.
- add function table_lookup_ino().
- improve handling of missing map entry for mount request.
- Resolves: RHEL-97546
* Fri Jan 30 2026 Ian Kent <ikent@redhat.com> - 5.1.4-114.el8_10.7
- RHEL-46409 - RFE: autofs: add handling for AMD 'nounmount' option
- fix amd cache options not copied.
- seperate amd mount and entry flags.
- make iocl ops ->timeout() handle per-dentry expire.
- refactor amd mount options handling.
- add some unimplemented amd map options.
- fix lookup search type in umount_subtree_mounts().
- fix remount_active_mount() not remounting symlinks.
- log when setting amd per-mount timeout.
- update per-mount expire timeout on readmap.
- clear per-mount timeout if not set.
- fix incorrect flags update in update_with_defaults().
- skip expire check for amd nounmount mounts.
- Resolves: RHEL-46409
* Tue Nov 25 2025 Ian Kent <ikent@redhat.com> - 5.1.4-114.el8_10.6
- RHEL-127179 - sssd autofs fails to get correct EHOSTDOWN if requested
incorrect mount after upgrade to sssd-2.9.1-4.el8_9.5.x86_64
[rhel-8.10.z]
- handle sss special case getautomntbyname() error.
- Resolves: RHEL-127179
* Mon Sep 01 2025 Ian Kent <ikent@redhat.com> - 5.1.4-114.el8_10.5
- RHEL-111930 - automount blocked when attempting to lookup ldap maps
- fix missing unlock in sasl_do_kinit_ext_cc().
- Resolves: RHEL-111930
* Mon Jun 09 2025 Ian Kent <ikent@redhat.com> - 5.1.4-114.el8_10.4
- RHEL-90238 - autofs fails to mount shares when using kerberised LDAP (RHEL 8)
- fix ldap sasl reconnect problem.
- always recreate credential cache.
- fix always recreate credential cache.
- Resolves: RHEL-90238
* Mon Apr 07 2025 Ian Kent <ikent@redhat.com> - 5.1.4-114.el8_10.3
- RHEL-84118 - autofs hang - autofs-5.1.4-114.el8_10.2
- fix lock ordering deadlock in expire_cleanup().
- change spec file %patchN to %patch -P N as required by rpm(8).
- Resolves: RHEL-84118
* Wed Jan 15 2025 Ian Kent <ikent@redhat.com> - 5.1.4-114.el8_10.2
- RHEL-72524 - autofs: deadlock between mnts_lookup_mount and mnts_remove_mount
- fix deadlock in master_notify_submount().
-Resolves: RHEL-72524
* Fri Nov 08 2024 Ian Kent <ikent@redhat.com> - 5.1.4-114
- RHEL-61670 - sporadic autofs daemon segfaults
- fix submount shutdown race.
- RHEL-52402 - Sporadic mount failures with amd program maps on RHEL8
- fix amd external mount error handling.
- fix amd external mount mount handling.
- don't free ext mount if mounted.
- refactor amd function do_program_mount().
- refactor umount_amd_ext_mount().
- add flags argument to amd do_program_mount().
- Resolves: RHEL-61670 RHEL-52402
* Mon Dec 18 2023 Ian Kent <ikent@redhat.com> - 5.1.4-113
- RHEL-18035 - SIGSEGV using hierarchical map entries on reload with
autofs-5.1.4-109