From e09ebe2e5600c387a75c43a067836db0a69fdcf7 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 07 2023 09:27:34 +0000 Subject: import autofs-5.0.7-116.el7_9.1 --- diff --git a/SOURCES/autofs-5.1.8-fix-kernel-mount-status-notification.patch b/SOURCES/autofs-5.1.8-fix-kernel-mount-status-notification.patch new file mode 100644 index 0000000..3df4710 --- /dev/null +++ b/SOURCES/autofs-5.1.8-fix-kernel-mount-status-notification.patch @@ -0,0 +1,135 @@ +autofs-5.1.8 - fix kernel mount status notification + +From: Ian Kent + +The status return for attempted mount notification is not done +correctly in some cases leading to a status being sent to the +kernel multiple times or the send causing an error. + +We must send a status to the kernel but it needs to be the correct +one. It definitely shouldn't be sent twice for the same mount attempt +and shouldn't be failing. + +Signed-off-by: Ian Kent +--- + CHANGELOG | 1 + + daemon/direct.c | 19 +++++++++++-------- + daemon/indirect.c | 19 +++++++++++-------- + 3 files changed, 23 insertions(+), 16 deletions(-) + +--- autofs-5.0.7.orig/CHANGELOG ++++ autofs-5.0.7/CHANGELOG +@@ -358,6 +358,7 @@ + - fix direct mount unlink_mount_tree() path. + - fix unlink mounts umount order. + - fix incorrect logical compare in unlink_mount_tree(). ++- fix kernel mount status notification. + + 25/07/2012 autofs-5.0.7 + ======================= +--- autofs-5.0.7.orig/daemon/direct.c ++++ autofs-5.0.7/daemon/direct.c +@@ -1122,12 +1122,18 @@ int handle_packet_expire_direct(struct a + return 0; + } + +-static void mount_send_fail(void *arg) ++static void mount_send_status(void *arg) + { + struct ioctl_ops *ops = get_ioctl_ops(); + struct pending_args *mt = arg; + struct autofs_point *ap = mt->ap; +- ops->send_fail(ap->logopt, mt->ioctlfd, mt->wait_queue_token, -ENOENT); ++ ++ if (mt->status) ++ ops->send_fail(ap->logopt, mt->ioctlfd, ++ mt->wait_queue_token, mt->status); ++ else ++ ops->send_ready(ap->logopt, ++ mt->ioctlfd, mt->wait_queue_token); + ops->close(ap->logopt, mt->ioctlfd); + } + +@@ -1156,7 +1162,8 @@ static void *do_mount_direct(void *arg) + + pending_mutex_unlock(args); + +- pthread_cleanup_push(mount_send_fail, &mt); ++ mt.status = 0; ++ pthread_cleanup_push(mount_send_status, &mt); + + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state); + +@@ -1170,9 +1177,7 @@ static void *do_mount_direct(void *arg) + if (status == -1) { + error(ap->logopt, + "can't stat direct mount trigger %s", mt.name); +- ops->send_fail(ap->logopt, +- mt.ioctlfd, mt.wait_queue_token, -ENOENT); +- ops->close(ap->logopt, mt.ioctlfd); ++ mt.status = -ENOENT; + pthread_setcancelstate(state, NULL); + pthread_exit(NULL); + } +@@ -1182,8 +1187,6 @@ static void *do_mount_direct(void *arg) + error(ap->logopt, + "direct trigger not valid or already mounted %s", + mt.name); +- ops->send_ready(ap->logopt, mt.ioctlfd, mt.wait_queue_token); +- ops->close(ap->logopt, mt.ioctlfd); + pthread_setcancelstate(state, NULL); + pthread_exit(NULL); + } +--- autofs-5.0.7.orig/daemon/indirect.c ++++ autofs-5.0.7/daemon/indirect.c +@@ -662,13 +662,18 @@ int handle_packet_expire_indirect(struct + return 0; + } + +-static void mount_send_fail(void *arg) ++static void mount_send_status(void *arg) + { + struct ioctl_ops *ops = get_ioctl_ops(); + struct pending_args *mt = arg; + struct autofs_point *ap = mt->ap; +- ops->send_fail(ap->logopt, +- ap->ioctlfd, mt->wait_queue_token, -ENOENT); ++ ++ if (mt->status) ++ ops->send_fail(ap->logopt, ap->ioctlfd, ++ mt->wait_queue_token, mt->status); ++ else ++ ops->send_ready(ap->logopt, ++ ap->ioctlfd, mt->wait_queue_token); + } + + static void *do_mount_indirect(void *arg) +@@ -697,7 +702,8 @@ static void *do_mount_indirect(void *arg + + pending_mutex_unlock(args); + +- pthread_cleanup_push(mount_send_fail, &mt); ++ mt.status = 0; ++ pthread_cleanup_push(mount_send_status, &mt); + + pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state); + +@@ -710,9 +716,7 @@ static void *do_mount_indirect(void *arg + len = ncat_path(buf, sizeof(buf), ap->path, mt.name, mt.len); + if (!len) { + crit(ap->logopt, "path to be mounted is to long"); +- ops->send_fail(ap->logopt, +- ap->ioctlfd, mt.wait_queue_token, +- -ENAMETOOLONG); ++ mt.status = -ENAMETOOLONG; + pthread_setcancelstate(state, NULL); + pthread_exit(NULL); + } +@@ -721,7 +725,6 @@ static void *do_mount_indirect(void *arg + if (status != -1 && !(S_ISDIR(st.st_mode) && st.st_dev == mt.dev)) { + error(ap->logopt, + "indirect trigger not valid or already mounted %s", buf); +- ops->send_ready(ap->logopt, ap->ioctlfd, mt.wait_queue_token); + pthread_setcancelstate(state, NULL); + pthread_exit(NULL); + } diff --git a/SPECS/autofs.spec b/SPECS/autofs.spec index 62e01b8..a85c5a9 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.0.7 -Release: 116%{?dist} +Release: 116%{?dist}.1 Epoch: 1 License: GPLv2+ Group: System Environment/Daemons @@ -532,6 +532,7 @@ Patch927: autofs-5.1.6-fix-unlink-mounts-umount-order.patch Patch928: autofs-5.1.6-mount_nfs_c-fix-local-rdma-share-not-mounting.patch Patch929: autofs-5.1.6-fix-incorrect-logical-compare-in-unlink_mount_tree.patch +Patch930: autofs-5.1.8-fix-kernel-mount-status-notification.patch Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %if %{with_systemd} @@ -1103,6 +1104,7 @@ echo %{version}-%{release} > .version %patch928 -p1 %patch929 -p1 +%patch930 -p1 %build LDFLAGS=-Wl,-z,now @@ -1200,6 +1202,12 @@ fi %dir /etc/auto.master.d %changelog +* Wed Feb 08 2023 Ian Kent - 5.0.7-116el7_9.1 +- bz2107752 - autofs: send FAIL cmd/ioctl mess when encountering problems + with mount trigger + - fix kernel mount status notification. +- Resolves: rhbz#2107752 + * Fri Oct 30 2020 Ian Kent - 5.0.7-116 - bz1885511 - automount force unlink option (-F) does not work as expected on autofs-5.0.7-109.el7