From 213b36c4700d9591d9c57273d9355e1f42f5aad3 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 06 2020 06:09:08 +0000 Subject: import autofs-5.1.4-47.el8 --- diff --git a/SOURCES/autofs-5.1.6-add-force-unlink-mounts-and-exit-option.patch b/SOURCES/autofs-5.1.6-add-force-unlink-mounts-and-exit-option.patch new file mode 100644 index 0000000..cdd2553 --- /dev/null +++ b/SOURCES/autofs-5.1.6-add-force-unlink-mounts-and-exit-option.patch @@ -0,0 +1,248 @@ +autofs-5.1.6 - add force unlink mounts and exit option + +From: Ian Kent + +Add a automount program option to force an unlink umount of all +existing mounts under configured autofs mount points then exit. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 51 +++++++++++++++++++++++++++++++++------------------ + daemon/direct.c | 12 +++++++++++- + daemon/indirect.c | 21 ++++++++++++++++----- + include/automount.h | 1 + + lib/master.c | 6 ++++-- + man/automount.8 | 6 ++++++ + 7 files changed, 72 insertions(+), 26 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -89,6 +89,7 @@ xx/xx/2018 autofs-5.1.5 + - use bit flag for force unlink mounts. + - improve force unlink option description. + - remove command fifo on autofs mount fail. ++- add force unlink mounts and exit option. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/automount.c ++++ autofs-5.1.4/daemon/automount.c +@@ -1153,8 +1153,13 @@ static int mount_autofs(struct autofs_po + { + int status = 0; + +- if (autofs_init_ap(ap) != 0) +- return -1; ++ /* No need to create comms fds and command fifo if ++ * unlinking mounts and exiting. ++ */ ++ if (!(do_force_unlink & UNLINK_AND_EXIT)) { ++ if (autofs_init_ap(ap) != 0) ++ return -1; ++ } + + if (ap->type == LKP_DIRECT) + status = mount_autofs_direct(ap); +@@ -1859,7 +1864,8 @@ void *handle_mounts(void *arg) + } + + if (mount_autofs(ap, root) < 0) { +- crit(ap->logopt, "mount of %s failed!", ap->path); ++ if (!(do_force_unlink & UNLINK_AND_EXIT)) ++ crit(ap->logopt, "mount of %s failed!", ap->path); + suc->status = 1; + umount_autofs(ap, root, 1); + free(root); +@@ -1951,6 +1957,7 @@ static void usage(void) + " -C --dont-check-daemon\n" + " don't check if daemon is already running\n" + " -F --force forceably clean up known automounts at start\n" ++ " -U --force-exit forceably clean up known automounts and exit\n" + " -V --version print version, build config and exit\n" + , program); + } +@@ -2202,7 +2209,7 @@ int main(int argc, char *argv[]) + time_t timeout; + time_t age = monotonic_time(NULL); + struct rlimit rlim; +- const char *options = "+hp:t:vmdD:SfVrO:l:n:CFM"; ++ const char *options = "+hp:t:vmdD:SfVrO:l:n:CFUM"; + static const struct option long_options[] = { + {"help", 0, 0, 'h'}, + {"pid-file", 1, 0, 'p'}, +@@ -2220,6 +2227,7 @@ int main(int argc, char *argv[]) + {"set-log-priority", 1, 0, 'l'}, + {"dont-check-daemon", 0, 0, 'C'}, + {"force", 0, 0, 'F'}, ++ {"force-exit", 0, 0, 'U'}, + {"master-wait", 1, 0, 'M'}, + {0, 0, 0, 0} + }; +@@ -2342,6 +2350,11 @@ int main(int argc, char *argv[]) + do_force_unlink = UNLINK_AND_CONT; + break; + ++ case 'U': ++ flags |= DAEMON_FLAGS_FOREGROUND; ++ do_force_unlink = UNLINK_AND_EXIT; ++ break; ++ + case '?': + case ':': + printf("%s: Ambiguous or unknown options\n", program); +@@ -2657,25 +2670,27 @@ int main(int argc, char *argv[]) + } + } + +- /* +- * Mmm ... reset force unlink umount so we don't also do this +- * in future when we receive a HUP signal. +- */ +- do_force_unlink = 0; ++ if (!(do_force_unlink & UNLINK_AND_EXIT)) { ++ /* ++ * Mmm ... reset force unlink umount so we don't also do ++ * this in future when we receive a HUP signal. ++ */ ++ do_force_unlink = 0; + +- if (start_pipefd[1] != -1) { +- st_stat = 0; +- res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); +- close(start_pipefd[1]); +- } ++ if (start_pipefd[1] != -1) { ++ st_stat = 0; ++ res = write(start_pipefd[1], pst_stat, sizeof(*pst_stat)); ++ close(start_pipefd[1]); ++ } + + #ifdef WITH_SYSTEMD +- if (flags & DAEMON_FLAGS_SYSTEMD_SERVICE) +- sd_notify(1, "READY=1"); ++ if (flags & DAEMON_FLAGS_SYSTEMD_SERVICE) ++ sd_notify(1, "READY=1"); + #endif + +- state_mach_thid = pthread_self(); +- statemachine(NULL); ++ state_mach_thid = pthread_self(); ++ statemachine(NULL); ++ } + + master_kill(master_list); + +--- autofs-5.1.4.orig/daemon/direct.c ++++ autofs-5.1.4/daemon/direct.c +@@ -286,7 +286,14 @@ int do_mount_autofs_direct(struct autofs + if (ret == 0) + return -1; + } else { +- if (ap->state == ST_READMAP && is_mounted(me->key, MNTS_ALL)) { ++ /* I don't remember why this is here for the force ++ * unlink case. I don't think it should be but I may ++ * have done it for a reason so keep it for the unlink ++ * and continue case but not for the unlink and exit ++ * case. ++ */ ++ if (!(do_force_unlink & UNLINK_AND_EXIT) && ++ ap->state == ST_READMAP && is_mounted(me->key, MNTS_ALL)) { + time_t tout = get_exp_timeout(ap, me->source); + int save_ioctlfd, ioctlfd; + +@@ -319,6 +326,9 @@ int do_mount_autofs_direct(struct autofs + goto out_err; + } + ++ if (do_force_unlink & UNLINK_AND_EXIT) ++ return -1; ++ + if (me->ioctlfd != -1) { + error(ap->logopt, "active direct mount %s", me->key); + return -1; +--- autofs-5.1.4.orig/daemon/indirect.c ++++ autofs-5.1.4/daemon/indirect.c +@@ -76,6 +76,9 @@ static int do_mount_autofs_indirect(stru + "or failed to unlink entry in tree"); + goto out_err; + } ++ ++ if (do_force_unlink & UNLINK_AND_EXIT) ++ return -1; + } + + options = make_options_string(ap->path, +@@ -163,12 +166,20 @@ int mount_autofs_indirect(struct autofs_ + int status; + int map; + ++ /* Don't read the map if the unlink and exit option has been ++ * given. do_mount_autofs_indirect() will return -1 if this ++ * option has been given so there's no need to do anything ++ * else. ++ */ ++ + /* TODO: read map, determine map type is OK */ +- if (lookup_nss_read_map(ap, NULL, now)) +- lookup_prune_cache(ap, now); +- else { +- error(ap->logopt, "failed to read map for %s", ap->path); +- return -1; ++ if (!(do_force_unlink & UNLINK_AND_EXIT)) { ++ if (lookup_nss_read_map(ap, NULL, now)) ++ lookup_prune_cache(ap, now); ++ else { ++ error(ap->logopt, "failed to read map for %s", ap->path); ++ return -1; ++ } + } + + status = do_mount_autofs_indirect(ap, root); +--- autofs-5.1.4.orig/include/automount.h ++++ autofs-5.1.4/include/automount.h +@@ -591,6 +591,7 @@ struct autofs_point { + }; + + #define UNLINK_AND_CONT 0x01 ++#define UNLINK_AND_EXIT 0x02 + + /* Foreably unlink existing mounts at startup. */ + extern int do_force_unlink; +--- autofs-5.1.4.orig/lib/master.c ++++ autofs-5.1.4/lib/master.c +@@ -1358,7 +1358,8 @@ static int master_do_mount(struct master + suc.done = 0; + suc.status = 0; + +- debug(ap->logopt, "mounting %s", entry->path); ++ if (!(do_force_unlink & UNLINK_AND_EXIT)) ++ debug(ap->logopt, "mounting %s", entry->path); + + status = pthread_create(&thid, &th_attr, handle_mounts, &suc); + if (status) { +@@ -1376,7 +1377,8 @@ static int master_do_mount(struct master + } + + if (suc.status) { +- error(ap->logopt, "failed to startup mount"); ++ if (!(do_force_unlink & UNLINK_AND_EXIT)) ++ error(ap->logopt, "failed to startup mount"); + handle_mounts_startup_cond_destroy(&suc); + return 0; + } +--- autofs-5.1.4.orig/man/automount.8 ++++ autofs-5.1.4/man/automount.8 +@@ -121,6 +121,12 @@ Don't check if the daemon is currently r + Force an unlink umount of existing mounts under configured autofs managed + mount points during startup. This can cause problems for processes with + working directories within these mounts (see NOTES). ++.TP ++.I "\-U, \-\-force-exit" ++Force an unlink umount of existing mounts under configured autofs managed ++mount points and exit rather than continuing the startup. This can cause ++problems for processes with working directories within these mounts (see ++NOTES). + .SH ARGUMENTS + \fBautomount\fP takes one optional argument, the name of the master map to + use. diff --git a/SOURCES/autofs-5.1.6-cleanup-stale-logpri-fifo-pipes-on-unlink-and-exit.patch b/SOURCES/autofs-5.1.6-cleanup-stale-logpri-fifo-pipes-on-unlink-and-exit.patch new file mode 100644 index 0000000..5236ac1 --- /dev/null +++ b/SOURCES/autofs-5.1.6-cleanup-stale-logpri-fifo-pipes-on-unlink-and-exit.patch @@ -0,0 +1,101 @@ +autofs-5.1.6 - cleanup stale logpri fifo pipes on unlink and exit + +From: Ian Kent + +If the unlink and exit option is given then stale fifo pipe files +need to be cleaned up since the entire tree of mounts below autofs +managed directories will be unlinked as well as the autofs mounts +themselves. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++-- + 2 files changed, 52 insertions(+), 2 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -90,6 +90,7 @@ xx/xx/2018 autofs-5.1.5 + - improve force unlink option description. + - remove command fifo on autofs mount fail. + - add force unlink mounts and exit option. ++- cleanup stale logpri fifo pipes on unlink and exit. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/automount.c ++++ autofs-5.1.4/daemon/automount.c +@@ -60,7 +60,8 @@ unsigned int nfs_mount_uses_string_optio + static struct nfs_mount_vers vers, check = {1, 1, 1}; + + /* autofs fifo name prefix */ +-const char *fifodir = AUTOFS_FIFO_DIR "/autofs.fifo"; ++#define FIFO_NAME_PREFIX "autofs.fifo" ++const char *fifodir = AUTOFS_FIFO_DIR "/" FIFO_NAME_PREFIX; + + const char *global_options; /* Global option, from command line */ + +@@ -887,6 +888,48 @@ out_free: + return ret; + } + ++static void cleanup_stale_logpri_fifo_pipes(void) ++{ ++ size_t prefix_len = strlen(FIFO_NAME_PREFIX); ++ char *dir = AUTOFS_FIFO_DIR; ++ size_t dir_len = strlen(dir); ++ struct dirent *dent; ++ DIR *dfd; ++ int ret; ++ ++ dfd = opendir(dir); ++ if (!dfd) { ++ warn(LOGOPT_ANY, "failed to open fifo dir %s", dir); ++ return; ++ } ++ ++ while ((dent = readdir(dfd))) { ++ char fifo_path[PATH_MAX]; ++ ++ if (!(dent->d_type & DT_FIFO)) ++ continue; ++ if (strncmp(FIFO_NAME_PREFIX, dent->d_name, prefix_len)) ++ continue; ++ if ((dir_len + 1 + strlen(dent->d_name)) >= PATH_MAX) { ++ warn(LOGOPT_ANY, "fifo path too long for buffer"); ++ continue; ++ } ++ ++ strcpy(fifo_path, dir); ++ strcat(fifo_path, "/"); ++ strcat(fifo_path, dent->d_name); ++ ++ ret = unlink(fifo_path); ++ if (ret == -1) { ++ char buf[MAX_ERR_BUF]; ++ char *estr = strerror_r(errno, buf, MAX_ERR_BUF); ++ warn(LOGOPT_ANY, "unlink of fifo failed: %s", estr); ++ } ++ } ++ ++ closedir(dfd); ++} ++ + static void handle_fifo_message(struct autofs_point *ap, int fd) + { + int ret; +@@ -2670,7 +2713,13 @@ int main(int argc, char *argv[]) + } + } + +- if (!(do_force_unlink & UNLINK_AND_EXIT)) { ++ /* If the option to unlink all autofs mounts and exit has ++ * been given remove logpri fifo files as all the mounts ++ * will be detached leaving them stale. ++ */ ++ if (do_force_unlink & UNLINK_AND_EXIT) ++ cleanup_stale_logpri_fifo_pipes(); ++ else { + /* + * Mmm ... reset force unlink umount so we don't also do + * this in future when we receive a HUP signal. diff --git a/SOURCES/autofs-5.1.6-fix-direct-mount-unlink_mount_tree-path.patch b/SOURCES/autofs-5.1.6-fix-direct-mount-unlink_mount_tree-path.patch new file mode 100644 index 0000000..51b4b5e --- /dev/null +++ b/SOURCES/autofs-5.1.6-fix-direct-mount-unlink_mount_tree-path.patch @@ -0,0 +1,40 @@ +autofs-5.1.6 - fix direct mount unlink_mount_tree() path + +From: Ian Kent + +Oops! + +The path used if unlink_mount_tree() is called for direct mount entries +is not correct, fix it. + +Note: the mount table handling has changed and using the --force option +with automount when direct mount maps are large will result in somewhat +larger overhead. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/direct.c | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -83,6 +83,7 @@ xx/xx/2018 autofs-5.1.5 + - fix autofs mount options construction. + - mount_nfs.c fix local rdma share not mounting. + - fix incorrect systemctl command syntax in autofs(8). ++- fix direct mount unlink_mount_tree() path. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/direct.c ++++ autofs-5.1.4/daemon/direct.c +@@ -311,7 +311,7 @@ int do_mount_autofs_direct(struct autofs + return 0; + } + +- ret = unlink_mount_tree(ap, ap->path); ++ ret = unlink_mount_tree(ap, me->key); + if (!ret) { + error(ap->logopt, + "already mounted as other than autofs " diff --git a/SOURCES/autofs-5.1.6-fix-incorrect-logical-compare-in-unlink_mount_tree.patch b/SOURCES/autofs-5.1.6-fix-incorrect-logical-compare-in-unlink_mount_tree.patch new file mode 100644 index 0000000..4556683 --- /dev/null +++ b/SOURCES/autofs-5.1.6-fix-incorrect-logical-compare-in-unlink_mount_tree.patch @@ -0,0 +1,33 @@ +autofs-5.1.6 - fix incorrect logical compare in unlink_mount_tree() + +From: Ian Kent + +Fix silly mistake using or instead of and in unlink_mount_tree(). + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/mounts.c | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -85,6 +85,7 @@ xx/xx/2018 autofs-5.1.5 + - fix incorrect systemctl command syntax in autofs(8). + - fix direct mount unlink_mount_tree() path. + - fix unlink mounts umount order. ++- fix incorrect logical compare in unlink_mount_tree(). + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/lib/mounts.c ++++ autofs-5.1.4/lib/mounts.c +@@ -959,7 +959,7 @@ int unlink_mount_tree(struct autofs_poin + return 0; + + for (mnt = mnts; mnt; mnt = mnt->next) { +- if (mnt->flags | MNTS_AUTOFS) ++ if (mnt->flags & MNTS_AUTOFS) + rv = umount2(mnt->mp, MNT_DETACH); + else + rv = spawn_umount(ap->logopt, "-l", mnt->mp, NULL); diff --git a/SOURCES/autofs-5.1.6-fix-incorrect-systemctl-command-syntax-in-autofs-8.patch b/SOURCES/autofs-5.1.6-fix-incorrect-systemctl-command-syntax-in-autofs-8.patch new file mode 100644 index 0000000..b25e644 --- /dev/null +++ b/SOURCES/autofs-5.1.6-fix-incorrect-systemctl-command-syntax-in-autofs-8.patch @@ -0,0 +1,34 @@ +autofs-5.1.6 - fix incorrect systemctl command syntax in autofs(8) + +From: Ian Kent + +In the body of the OPERATION section "systemctl autofs.service status" +is used when it should be "systemctl status autofs.service". + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + man/autofs.8.in | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -82,6 +82,7 @@ xx/xx/2018 autofs-5.1.5 + - fix quoted string length calc in expandsunent(). + - fix autofs mount options construction. + - mount_nfs.c fix local rdma share not mounting. ++- fix incorrect systemctl command syntax in autofs(8). + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/man/autofs.8.in ++++ autofs-5.1.4/man/autofs.8.in +@@ -58,7 +58,7 @@ service control reload action must be re + .P + .B @@initdir@@/autofs status + or +-.B systemctl autofs.service status ++.B systemctl status autofs.service + will display the status of, + .BR automount (8), + running or not. When using the systemd init system the status output includes diff --git a/SOURCES/autofs-5.1.6-fix-unlink-mounts-umount-order.patch b/SOURCES/autofs-5.1.6-fix-unlink-mounts-umount-order.patch new file mode 100644 index 0000000..ab45e1d --- /dev/null +++ b/SOURCES/autofs-5.1.6-fix-unlink-mounts-umount-order.patch @@ -0,0 +1,89 @@ +autofs-5.1.6 - fix unlink mounts umount order + +From: Ian Kent + +The recent changes to mount table handling to support the "ignore" +autofs pseudo option resulted in the incorrect umount order being used +in the unlink_mount_tree() function. + +To fix this change unlink_mount_tree() to use the existing get_mnt_list() +function to construct a correctly ordered list for the umounts. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + lib/mounts.c | 39 +++++++++------------------------------ + 2 files changed, 10 insertions(+), 30 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -84,6 +84,7 @@ xx/xx/2018 autofs-5.1.5 + - mount_nfs.c fix local rdma share not mounting. + - fix incorrect systemctl command syntax in autofs(8). + - fix direct mount unlink_mount_tree() path. ++- fix unlink mounts umount order. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/lib/mounts.c ++++ autofs-5.1.4/lib/mounts.c +@@ -951,42 +951,21 @@ local_getmntent_r(FILE *tab, struct mnte + + int unlink_mount_tree(struct autofs_point *ap, const char *mp) + { +- FILE *tab; +- struct mntent *mnt; +- struct mntent mnt_wrk; +- char buf[PATH_MAX * 3]; +- unsigned int mp_len = strlen(mp); ++ struct mnt_list *mnts, *mnt; + int rv, ret = 1; + +- tab = open_fopen_r(_PROC_MOUNTS); +- if (!tab) { +- char *estr = strerror_r(errno, buf, PATH_MAX - 1); +- logerr("fopen: %s", estr); ++ mnts = get_mnt_list(mp, 1); ++ if (!mnts) + return 0; +- } +- +- while ((mnt = local_getmntent_r(tab, &mnt_wrk, buf, PATH_MAX * 3))) { +- unsigned int mnt_dir_len; +- int is_autofs; +- +- if (strncmp(mnt->mnt_dir, mp, mp_len)) +- continue; +- +- mnt_dir_len = strlen(mnt->mnt_dir); +- is_autofs = !strcmp(mnt->mnt_type, "autofs"); +- +- if (mnt_dir_len == mp_len && !is_autofs) { +- ret = 0; +- break; +- } + +- if (is_autofs) +- rv = umount2(mnt->mnt_dir, MNT_DETACH); ++ for (mnt = mnts; mnt; mnt = mnt->next) { ++ if (mnt->flags | MNTS_AUTOFS) ++ rv = umount2(mnt->mp, MNT_DETACH); + else +- rv = spawn_umount(ap->logopt, "-l", mnt->mnt_dir, NULL); ++ rv = spawn_umount(ap->logopt, "-l", mnt->mp, NULL); + if (rv == -1) { + debug(ap->logopt, +- "can't unlink %s from mount tree", mnt->mnt_dir); ++ "can't unlink %s from mount tree", mnt->mp); + + switch (errno) { + case EINVAL: +@@ -1002,7 +981,7 @@ int unlink_mount_tree(struct autofs_poin + } + } + } +- fclose(tab); ++ free_mnt_list(mnts); + + return ret; + } diff --git a/SOURCES/autofs-5.1.6-improve-force-unlink-mounts-option-description.patch b/SOURCES/autofs-5.1.6-improve-force-unlink-mounts-option-description.patch new file mode 100644 index 0000000..ee414ce --- /dev/null +++ b/SOURCES/autofs-5.1.6-improve-force-unlink-mounts-option-description.patch @@ -0,0 +1,39 @@ +autofs-5.1.6 - improve force unlink mounts option description + +From: Ian Kent + +Update the automount(8) man page description of the force unlink mounts +option to indicate it operates on configured autofs mounts and mounts +under them. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + man/automount.8 | 6 +++--- + 2 files changed, 4 insertions(+), 3 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -87,6 +87,7 @@ xx/xx/2018 autofs-5.1.5 + - fix unlink mounts umount order. + - fix incorrect logical compare in unlink_mount_tree(). + - use bit flag for force unlink mounts. ++- improve force unlink option description. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/man/automount.8 ++++ autofs-5.1.4/man/automount.8 +@@ -118,9 +118,9 @@ path name as specified in the master map + Don't check if the daemon is currently running (see NOTES). + .TP + .I "\-F, \-\-force" +-Force an unlink umount of existing mounts under autofs managed mount points +-during startup. This can cause problems for processes with working directories +-within these mounts (see NOTES). ++Force an unlink umount of existing mounts under configured autofs managed ++mount points during startup. This can cause problems for processes with ++working directories within these mounts (see NOTES). + .SH ARGUMENTS + \fBautomount\fP takes one optional argument, the name of the master map to + use. diff --git a/SOURCES/autofs-5.1.6-mount_nfs_c-fix-local-rdma-share-not-mounting.patch b/SOURCES/autofs-5.1.6-mount_nfs_c-fix-local-rdma-share-not-mounting.patch new file mode 100644 index 0000000..9f90ae6 --- /dev/null +++ b/SOURCES/autofs-5.1.6-mount_nfs_c-fix-local-rdma-share-not-mounting.patch @@ -0,0 +1,49 @@ +autofs-5.1.6 - mount_nfs.c fix local rdma share not mounting + +From: Achilles Gaikwad + +When using the same system as nfs-server and nfs-client, and +using `nobind` option for autofs we would fall to the code where +we let `mount.nfs(8)` to handle the mount. However, when the +nfs-server and the nfs-client is the same system we end up calling +`rpc_ping` which gives negative return code. Due to this we fall to +the label next: and never attempt a mount of nfs share. +This patch fixes this BUG by not probing rpc_ping if we're +using rdma. + +Signed-off-by: Achilles Gaikwad +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + modules/mount_nfs.c | 9 +++++++-- + 2 files changed, 8 insertions(+), 2 deletions(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -81,6 +81,7 @@ xx/xx/2018 autofs-5.1.5 + - initialize struct addrinfo for getaddrinfo() calls. + - fix quoted string length calc in expandsunent(). + - fix autofs mount options construction. ++- mount_nfs.c fix local rdma share not mounting. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/modules/mount_nfs.c ++++ autofs-5.1.4/modules/mount_nfs.c +@@ -375,9 +375,14 @@ dont_probe: + */ + if (this->proximity == PROXIMITY_LOCAL) { + char *host = this->name ? this->name : "localhost"; +- int ret; ++ int ret = 1; + +- ret = rpc_ping(host, port, vers, 2, 0, RPC_CLOSE_DEFAULT); ++ /* If we're using RDMA, rpc_ping will fail when ++ * nfs-server is local. Therefore, don't probe ++ * when we're using RDMA. ++ */ ++ if(!rdma) ++ ret = rpc_ping(host, port, vers, 2, 0, RPC_CLOSE_DEFAULT); + if (ret <= 0) + goto next; + } diff --git a/SOURCES/autofs-5.1.6-remove-logpri-fifo-on-autofs-mount-fail.patch b/SOURCES/autofs-5.1.6-remove-logpri-fifo-on-autofs-mount-fail.patch new file mode 100644 index 0000000..23c8bfc --- /dev/null +++ b/SOURCES/autofs-5.1.6-remove-logpri-fifo-on-autofs-mount-fail.patch @@ -0,0 +1,36 @@ +autofs-5.1.6 - remove logpri fifo on autofs mount fail + +From: Ian Kent + +Don't leave log priority command fifo file around on autofs mount failure. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 4 +++- + 2 files changed, 4 insertions(+), 1 deletion(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -88,6 +88,7 @@ xx/xx/2018 autofs-5.1.5 + - fix incorrect logical compare in unlink_mount_tree(). + - use bit flag for force unlink mounts. + - improve force unlink option description. ++- remove command fifo on autofs mount fail. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/automount.c ++++ autofs-5.1.4/daemon/automount.c +@@ -1161,8 +1161,10 @@ static int mount_autofs(struct autofs_po + else + status = mount_autofs_indirect(ap, root); + +- if (status < 0) ++ if (status < 0) { ++ destroy_logpri_fifo(ap); + return -1; ++ } + + st_add_task(ap, ST_READY); + diff --git a/SOURCES/autofs-5.1.6-use-bit-flag-for-force-unlink-mounts.patch b/SOURCES/autofs-5.1.6-use-bit-flag-for-force-unlink-mounts.patch new file mode 100644 index 0000000..a850b45 --- /dev/null +++ b/SOURCES/autofs-5.1.6-use-bit-flag-for-force-unlink-mounts.patch @@ -0,0 +1,45 @@ +autofs-5.1.6 - use bit flag for force unlink mounts + +From: Ian Kent + +Change global varaiable do_force_unlink to be a bit flag. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/automount.c | 2 +- + include/automount.h | 2 ++ + 3 files changed, 4 insertions(+), 1 deletion(-) + +--- autofs-5.1.4.orig/CHANGELOG ++++ autofs-5.1.4/CHANGELOG +@@ -86,6 +86,7 @@ xx/xx/2018 autofs-5.1.5 + - fix direct mount unlink_mount_tree() path. + - fix unlink mounts umount order. + - fix incorrect logical compare in unlink_mount_tree(). ++- use bit flag for force unlink mounts. + + 19/12/2017 autofs-5.1.4 + - fix spec file url. +--- autofs-5.1.4.orig/daemon/automount.c ++++ autofs-5.1.4/daemon/automount.c +@@ -2337,7 +2337,7 @@ int main(int argc, char *argv[]) + break; + + case 'F': +- do_force_unlink = 1; ++ do_force_unlink = UNLINK_AND_CONT; + break; + + case '?': +--- autofs-5.1.4.orig/include/automount.h ++++ autofs-5.1.4/include/automount.h +@@ -590,6 +590,8 @@ struct autofs_point { + struct list_head submounts; /* List of child submounts */ + }; + ++#define UNLINK_AND_CONT 0x01 ++ + /* Foreably unlink existing mounts at startup. */ + extern int do_force_unlink; + diff --git a/SPECS/autofs.spec b/SPECS/autofs.spec index 540a7f9..5a55891 100644 --- a/SPECS/autofs.spec +++ b/SPECS/autofs.spec @@ -8,7 +8,7 @@ Summary: A tool for automatically mounting and unmounting filesystems Name: autofs Version: 5.1.4 -Release: 43%{?dist} +Release: 47%{?dist} Epoch: 1 License: GPLv2+ Group: System Environment/Daemons @@ -101,6 +101,18 @@ Patch86: autofs-5.1.6-initialize-struct-addrinfo-for-getaddrinfo-calls.patch Patch87: autofs-5.1.6-fix-quoted-string-length-calc-in-expandsunent.patch Patch88: autofs-5.1.6-fix-autofs-mount-options-construction.patch +Patch89: autofs-5.1.6-mount_nfs_c-fix-local-rdma-share-not-mounting.patch +Patch90: autofs-5.1.6-fix-incorrect-systemctl-command-syntax-in-autofs-8.patch + +Patch91: autofs-5.1.6-fix-direct-mount-unlink_mount_tree-path.patch +Patch92: autofs-5.1.6-fix-unlink-mounts-umount-order.patch +Patch93: autofs-5.1.6-fix-incorrect-logical-compare-in-unlink_mount_tree.patch +Patch94: autofs-5.1.6-use-bit-flag-for-force-unlink-mounts.patch +Patch95: autofs-5.1.6-improve-force-unlink-mounts-option-description.patch +Patch96: autofs-5.1.6-remove-logpri-fifo-on-autofs-mount-fail.patch +Patch97: autofs-5.1.6-add-force-unlink-mounts-and-exit-option.patch +Patch98: autofs-5.1.6-cleanup-stale-logpri-fifo-pipes-on-unlink-and-exit.patch + %if %{with_systemd} BuildRequires: systemd-units BuildRequires: systemd-devel @@ -248,6 +260,18 @@ echo %{version}-%{release} > .version %patch87 -p1 %patch88 -p1 +%patch89 -p1 +%patch90 -p1 + +%patch91 -p1 +%patch92 -p1 +%patch93 -p1 +%patch94 -p1 +%patch95 -p1 +%patch96 -p1 +%patch97 -p1 +%patch98 -p1 + %build LDFLAGS=-Wl,-z,now %configure --disable-mount-locking --enable-ignore-busy --with-libtirpc --without-hesiod %{?systemd_configure_arg:} @@ -342,6 +366,36 @@ fi %dir /etc/auto.master.d %changelog +* Wed Nov 04 2020 Ian Kent - 5.1.4-47 +- bz1887681 - automount force unlink option (-F) does not work as expected + on autofs-5.0.7-109.el7 + - fix direct mount unlink_mount_tree() path. + - fix unlink mounts umount order. + - fix incorrect logical compare in unlink_mount_tree(). + - use bit flag for force unlink mounts. + - improve force unlink mounts option description. + - remove logpri fifo on autofs mount fail. + - add force unlink mounts and exit option. + - cleanup stale logpri fifo pipes on unlink and exit. +- Resolves: rhbz#1887681 + +* Wed Nov 04 2020 Ian Kent - 5.1.4-46 +- bz1664561 - incorrect of start service command in autofs man page + - actually apply fix patch. +- fix dates and recent status messages in changelog. +-Related: rhbz#1664561 rhbz#1858742 + +* Tue Nov 03 2020 Ian Kent - 5.1.4-45 +- bz1664561 - incorrect of start service command in autofs man page + - fix incorrect systemctl command syntax in autofs(8). +-Resolves: rhbz#1664561 + +* Mon Nov 02 2020 Ian Kent - 5.1.4-44 +- bz1858742 - autofs share doesn't mount when using nobind over RDMA where + nfs-server and nfs-client are the same systems. + - mount_nfs.c fix local rdma share not mounting. +-Resolves: rhbz#1858742 + * Mon Jun 15 2020 Ian Kent - 5.1.4-43 - bz1841456 - automount program crashes with "malloc(): invalid next size (unsorted)