|
|
f3080c |
autofs-5.1.8 - fix kernel mount status notification
|
|
|
f3080c |
|
|
|
f3080c |
From: Ian Kent <raven@themaw.net>
|
|
|
f3080c |
|
|
|
f3080c |
The status return for attempted mount notification is not done
|
|
|
f3080c |
correctly in some cases leading to a status being sent to the
|
|
|
f3080c |
kernel multiple times or the send causing an error.
|
|
|
f3080c |
|
|
|
f3080c |
We must send a status to the kernel but it needs to be the correct
|
|
|
f3080c |
one. It definitely shouldn't be sent twice for the same mount attempt
|
|
|
f3080c |
and shouldn't be failing.
|
|
|
f3080c |
|
|
|
f3080c |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
f3080c |
---
|
|
|
f3080c |
CHANGELOG | 1 +
|
|
|
f3080c |
daemon/direct.c | 19 +++++++++++--------
|
|
|
f3080c |
daemon/indirect.c | 19 +++++++++++--------
|
|
|
f3080c |
3 files changed, 23 insertions(+), 16 deletions(-)
|
|
|
f3080c |
|
|
|
f3080c |
--- autofs-5.1.4.orig/CHANGELOG
|
|
|
f3080c |
+++ autofs-5.1.4/CHANGELOG
|
|
|
f3080c |
@@ -78,6 +78,7 @@
|
|
|
f3080c |
- fix empty mounts list return from unlink_mount_tree().
|
|
|
f3080c |
- fix nonstrict offset mount fail handling.
|
|
|
f3080c |
- remove intr hosts map mount option.
|
|
|
f3080c |
+- fix kernel mount status notification.
|
|
|
f3080c |
|
|
|
f3080c |
xx/xx/2018 autofs-5.1.5
|
|
|
f3080c |
- fix flag file permission.
|
|
|
f3080c |
--- autofs-5.1.4.orig/daemon/direct.c
|
|
|
f3080c |
+++ autofs-5.1.4/daemon/direct.c
|
|
|
f3080c |
@@ -1143,12 +1143,18 @@ int handle_packet_expire_direct(struct a
|
|
|
f3080c |
return 0;
|
|
|
f3080c |
}
|
|
|
f3080c |
|
|
|
f3080c |
-static void mount_send_fail(void *arg)
|
|
|
f3080c |
+static void mount_send_status(void *arg)
|
|
|
f3080c |
{
|
|
|
f3080c |
struct ioctl_ops *ops = get_ioctl_ops();
|
|
|
f3080c |
struct pending_args *mt = arg;
|
|
|
f3080c |
struct autofs_point *ap = mt->ap;
|
|
|
f3080c |
- ops->send_fail(ap->logopt, mt->ioctlfd, mt->wait_queue_token, -ENOENT);
|
|
|
f3080c |
+
|
|
|
f3080c |
+ if (mt->status)
|
|
|
f3080c |
+ ops->send_fail(ap->logopt, mt->ioctlfd,
|
|
|
f3080c |
+ mt->wait_queue_token, mt->status);
|
|
|
f3080c |
+ else
|
|
|
f3080c |
+ ops->send_ready(ap->logopt,
|
|
|
f3080c |
+ mt->ioctlfd, mt->wait_queue_token);
|
|
|
f3080c |
ops->close(ap->logopt, mt->ioctlfd);
|
|
|
f3080c |
}
|
|
|
f3080c |
|
|
|
f3080c |
@@ -1177,7 +1183,8 @@ static void *do_mount_direct(void *arg)
|
|
|
f3080c |
|
|
|
f3080c |
pending_mutex_unlock(args);
|
|
|
f3080c |
|
|
|
f3080c |
- pthread_cleanup_push(mount_send_fail, &mt;;
|
|
|
f3080c |
+ mt.status = 0;
|
|
|
f3080c |
+ pthread_cleanup_push(mount_send_status, &mt;;
|
|
|
f3080c |
|
|
|
f3080c |
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state);
|
|
|
f3080c |
|
|
|
f3080c |
@@ -1191,9 +1198,7 @@ static void *do_mount_direct(void *arg)
|
|
|
f3080c |
if (status == -1) {
|
|
|
f3080c |
error(ap->logopt,
|
|
|
f3080c |
"can't stat direct mount trigger %s", mt.name);
|
|
|
f3080c |
- ops->send_fail(ap->logopt,
|
|
|
f3080c |
- mt.ioctlfd, mt.wait_queue_token, -ENOENT);
|
|
|
f3080c |
- ops->close(ap->logopt, mt.ioctlfd);
|
|
|
f3080c |
+ mt.status = -ENOENT;
|
|
|
f3080c |
pthread_setcancelstate(state, NULL);
|
|
|
f3080c |
pthread_exit(NULL);
|
|
|
f3080c |
}
|
|
|
f3080c |
@@ -1203,8 +1208,6 @@ static void *do_mount_direct(void *arg)
|
|
|
f3080c |
error(ap->logopt,
|
|
|
f3080c |
"direct trigger not valid or already mounted %s",
|
|
|
f3080c |
mt.name);
|
|
|
f3080c |
- ops->send_ready(ap->logopt, mt.ioctlfd, mt.wait_queue_token);
|
|
|
f3080c |
- ops->close(ap->logopt, mt.ioctlfd);
|
|
|
f3080c |
pthread_setcancelstate(state, NULL);
|
|
|
f3080c |
pthread_exit(NULL);
|
|
|
f3080c |
}
|
|
|
f3080c |
--- autofs-5.1.4.orig/daemon/indirect.c
|
|
|
f3080c |
+++ autofs-5.1.4/daemon/indirect.c
|
|
|
f3080c |
@@ -674,13 +674,18 @@ int handle_packet_expire_indirect(struct
|
|
|
f3080c |
return 0;
|
|
|
f3080c |
}
|
|
|
f3080c |
|
|
|
f3080c |
-static void mount_send_fail(void *arg)
|
|
|
f3080c |
+static void mount_send_status(void *arg)
|
|
|
f3080c |
{
|
|
|
f3080c |
struct ioctl_ops *ops = get_ioctl_ops();
|
|
|
f3080c |
struct pending_args *mt = arg;
|
|
|
f3080c |
struct autofs_point *ap = mt->ap;
|
|
|
f3080c |
- ops->send_fail(ap->logopt,
|
|
|
f3080c |
- ap->ioctlfd, mt->wait_queue_token, -ENOENT);
|
|
|
f3080c |
+
|
|
|
f3080c |
+ if (mt->status)
|
|
|
f3080c |
+ ops->send_fail(ap->logopt, ap->ioctlfd,
|
|
|
f3080c |
+ mt->wait_queue_token, mt->status);
|
|
|
f3080c |
+ else
|
|
|
f3080c |
+ ops->send_ready(ap->logopt,
|
|
|
f3080c |
+ ap->ioctlfd, mt->wait_queue_token);
|
|
|
f3080c |
}
|
|
|
f3080c |
|
|
|
f3080c |
static void *do_mount_indirect(void *arg)
|
|
|
f3080c |
@@ -709,7 +714,8 @@ static void *do_mount_indirect(void *arg
|
|
|
f3080c |
|
|
|
f3080c |
pending_mutex_unlock(args);
|
|
|
f3080c |
|
|
|
f3080c |
- pthread_cleanup_push(mount_send_fail, &mt;;
|
|
|
f3080c |
+ mt.status = 0;
|
|
|
f3080c |
+ pthread_cleanup_push(mount_send_status, &mt;;
|
|
|
f3080c |
|
|
|
f3080c |
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &state);
|
|
|
f3080c |
|
|
|
f3080c |
@@ -722,9 +728,7 @@ static void *do_mount_indirect(void *arg
|
|
|
f3080c |
len = ncat_path(buf, sizeof(buf), ap->path, mt.name, mt.len);
|
|
|
f3080c |
if (!len) {
|
|
|
f3080c |
crit(ap->logopt, "path to be mounted is to long");
|
|
|
f3080c |
- ops->send_fail(ap->logopt,
|
|
|
f3080c |
- ap->ioctlfd, mt.wait_queue_token,
|
|
|
f3080c |
- -ENAMETOOLONG);
|
|
|
f3080c |
+ mt.status = -ENAMETOOLONG;
|
|
|
f3080c |
pthread_setcancelstate(state, NULL);
|
|
|
f3080c |
pthread_exit(NULL);
|
|
|
f3080c |
}
|
|
|
f3080c |
@@ -733,7 +737,6 @@ static void *do_mount_indirect(void *arg
|
|
|
f3080c |
if (status != -1 && !(S_ISDIR(st.st_mode) && st.st_dev == mt.dev)) {
|
|
|
f3080c |
error(ap->logopt,
|
|
|
f3080c |
"indirect trigger not valid or already mounted %s", buf);
|
|
|
f3080c |
- ops->send_ready(ap->logopt, ap->ioctlfd, mt.wait_queue_token);
|
|
|
f3080c |
pthread_setcancelstate(state, NULL);
|
|
|
f3080c |
pthread_exit(NULL);
|
|
|
f3080c |
}
|