autofs/autofs-5.1.8-remove-redundant-stat-from-do_mount_direct.patch

49 lines
1.4 KiB
Diff
Raw Normal View History

2023-06-13 02:51:59 +00:00
autofs-5.1.8 - remove redundant stat from do_mount_direct()
From: Ian Kent <raven@themaw.net>
In do_mount_direct() a stat() call is used to check mount point
attributes but the fstat() of the ioctlfd is for the same path so
the lower overhead fstat() call can be used to do these checks as
well.
Signed-off-by: Ian Kent <raven@themaw.net>
---
CHANGELOG | 1 +
daemon/direct.c | 10 +---------
2 files changed, 2 insertions(+), 9 deletions(-)
--- autofs-5.1.4.orig/CHANGELOG
+++ autofs-5.1.4/CHANGELOG
@@ -133,6 +133,7 @@
- continue expire immediately after submount check.
- add buffer length checks to autofs mount_mount().
- eliminate root param from autofs mount and umount.
+- remove redundant fstat from do_mount_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
@@ -1197,19 +1197,11 @@ static void *do_mount_direct(void *arg)
}
status = fstat(mt.ioctlfd, &st);
- if (status == -1) {
- error(ap->logopt,
- "can't stat direct mount trigger %s", mt.name);
- mt.status = -ENOENT;
- pthread_setcancelstate(state, NULL);
- pthread_exit(NULL);
- }
-
- status = stat(mt.name, &st);
if (status != 0 || !S_ISDIR(st.st_mode) || st.st_dev != mt.dev) {
error(ap->logopt,
"direct trigger not valid or already mounted %s",
mt.name);
+ mt.status = -EINVAL;
pthread_setcancelstate(state, NULL);
pthread_exit(NULL);
}