This MR adds fixes for several Jiras. - RHEL-57466 - autofs crashes on startup after IDM client configuration We have had several different reports caused by this bug which leads to a SEGV with very little information about the cuase. - Resolves: RHEL-57466 - RHEL-69485 - Sporadic mount failures with amd program maps on RHEL8. This bug causes AMD-style program map mounts to sporadically not work. - Resolves: RHEL-69485 - RHEL-71359 - RFE: autofs: add handling for AMD 'nounmount' option This Jira adds support for a map option that was deferred in the original implementtion. One of our customers needs this so it has been implemented. - Resolves: RHEL-71359 Signed-off-by: Ian Kent <ikent@redhat.com>
193 lines
7.1 KiB
Diff
193 lines
7.1 KiB
Diff
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.7.orig/CHANGELOG
|
|
+++ autofs-5.1.7/CHANGELOG
|
|
@@ -169,6 +169,7 @@
|
|
- add flags argument to amd do_program_mount().
|
|
- fix amd cache options not copied.
|
|
- seperate amd mount and entry flags.
|
|
+- make iocl ops ->timeout() handle per-dentry expire.
|
|
|
|
25/01/2021 autofs-5.1.7
|
|
- make bind mounts propagation slave by default.
|
|
--- autofs-5.1.7.orig/daemon/direct.c
|
|
+++ autofs-5.1.7/daemon/direct.c
|
|
@@ -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.7.orig/daemon/indirect.c
|
|
+++ autofs-5.1.7/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.7.orig/daemon/state.c
|
|
+++ autofs-5.1.7/daemon/state.c
|
|
@@ -366,7 +366,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)
|
|
@@ -427,7 +427,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.7.orig/include/dev-ioctl-lib.h
|
|
+++ autofs-5.1.7/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.7.orig/lib/dev-ioctl-lib.c
|
|
+++ autofs-5.1.7/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(¶m);
|
|
- param.ioctlfd = ioctlfd;
|
|
- param.timeout.timeout = timeout;
|
|
+ if (!mp) {
|
|
+ struct autofs_dev_ioctl param;
|
|
|
|
- if (ioctl(ctl.devfd, AUTOFS_DEV_IOCTL_TIMEOUT, ¶m) == -1)
|
|
- return -1;
|
|
+ init_autofs_dev_ioctl(¶m);
|
|
+ param.ioctlfd = ioctlfd;
|
|
+ param.timeout.timeout = timeout;
|
|
+ if (ioctl(ctl.devfd, AUTOFS_DEV_IOCTL_TIMEOUT, ¶m) == -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.7.orig/lib/mounts.c
|
|
+++ autofs-5.1.7/lib/mounts.c
|
|
@@ -2757,7 +2757,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;
|
|
}
|
|
@@ -2779,7 +2779,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);
|