|
Ian Kent |
cc58c1 |
autofs-5.0.6 - fix umount recovery of busy direct mount
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
From: Ian Kent <raven@themaw.net>
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
Reported by Leonardo Chiquitto (along with a problem analysis that lead
|
|
Ian Kent |
cc58c1 |
to the resolution). Thanks for the effort Leonardo.
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
When umounting direct mounts at exit, if any are busy and contain offset
|
|
Ian Kent |
cc58c1 |
trigger mounts automount will try and re-mount them when the umount fails
|
|
Ian Kent |
cc58c1 |
so they can be used to re-construct the mount tree at restart. But this
|
|
Ian Kent |
cc58c1 |
fails because the kernel communication pipe, which is used as a parameter
|
|
Ian Kent |
cc58c1 |
when mounting the offsets, has already been closed. To fix this all we
|
|
Ian Kent |
cc58c1 |
need do is delay closing the kernel pipe file handle until after the
|
|
Ian Kent |
cc58c1 |
direct mounts have been umounted since this doesn't affect the in use
|
|
Ian Kent |
cc58c1 |
status of the mounts.
|
|
Ian Kent |
cc58c1 |
---
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
CHANGELOG | 1 +
|
|
Ian Kent |
cc58c1 |
daemon/direct.c | 18 +++++++++---------
|
|
Ian Kent |
cc58c1 |
2 files changed, 10 insertions(+), 9 deletions(-)
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
--- autofs-5.0.6.orig/CHANGELOG
|
|
Ian Kent |
cc58c1 |
+++ autofs-5.0.6/CHANGELOG
|
|
Ian Kent |
cc58c1 |
@@ -53,6 +53,7 @@
|
|
Ian Kent |
cc58c1 |
- make autofs wait longer for shutdown completion.
|
|
Ian Kent |
cc58c1 |
- fix sss map age not updated.
|
|
Ian Kent |
cc58c1 |
- fix remount deadlock.
|
|
Ian Kent |
cc58c1 |
+- fix umount recovery of busy direct mount.
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
28/06/2011 autofs-5.0.6
|
|
Ian Kent |
cc58c1 |
-----------------------
|
|
Ian Kent |
cc58c1 |
--- autofs-5.0.6.orig/daemon/direct.c
|
|
Ian Kent |
cc58c1 |
+++ autofs-5.0.6/daemon/direct.c
|
|
Ian Kent |
cc58c1 |
@@ -193,15 +193,6 @@ int umount_autofs_direct(struct autofs_p
|
|
Ian Kent |
cc58c1 |
struct mnt_list *mnts;
|
|
Ian Kent |
cc58c1 |
struct mapent *me, *ne;
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
- close(ap->state_pipe[0]);
|
|
Ian Kent |
cc58c1 |
- close(ap->state_pipe[1]);
|
|
Ian Kent |
cc58c1 |
- if (ap->pipefd >= 0)
|
|
Ian Kent |
cc58c1 |
- close(ap->pipefd);
|
|
Ian Kent |
cc58c1 |
- if (ap->kpipefd >= 0) {
|
|
Ian Kent |
cc58c1 |
- close(ap->kpipefd);
|
|
Ian Kent |
cc58c1 |
- ap->kpipefd = -1;
|
|
Ian Kent |
cc58c1 |
- }
|
|
Ian Kent |
cc58c1 |
-
|
|
Ian Kent |
cc58c1 |
mnts = tree_make_mnt_tree(_PROC_MOUNTS, "/");
|
|
Ian Kent |
cc58c1 |
pthread_cleanup_push(mnts_cleanup, mnts);
|
|
Ian Kent |
cc58c1 |
nc = ap->entry->master->nc;
|
|
Ian Kent |
cc58c1 |
@@ -231,6 +222,15 @@ int umount_autofs_direct(struct autofs_p
|
|
Ian Kent |
cc58c1 |
pthread_cleanup_pop(1);
|
|
Ian Kent |
cc58c1 |
pthread_cleanup_pop(1);
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
+ close(ap->state_pipe[0]);
|
|
Ian Kent |
cc58c1 |
+ close(ap->state_pipe[1]);
|
|
Ian Kent |
cc58c1 |
+ if (ap->pipefd >= 0)
|
|
Ian Kent |
cc58c1 |
+ close(ap->pipefd);
|
|
Ian Kent |
cc58c1 |
+ if (ap->kpipefd >= 0) {
|
|
Ian Kent |
cc58c1 |
+ close(ap->kpipefd);
|
|
Ian Kent |
cc58c1 |
+ ap->kpipefd = -1;
|
|
Ian Kent |
cc58c1 |
+ }
|
|
Ian Kent |
cc58c1 |
+
|
|
Ian Kent |
cc58c1 |
return 0;
|
|
Ian Kent |
cc58c1 |
}
|
|
Ian Kent |
cc58c1 |
|