2016-09-14 09:33:58 +00:00
|
|
|
am-utils-6.2 - fix umount to mount race
|
|
|
|
|
|
|
|
From: Richard P <richardp345@gmail.com>
|
|
|
|
|
|
|
|
If a mount request arrives while its mount fs is being umounted the
|
|
|
|
the reference count of the mount fs never reaches 1 so the location
|
|
|
|
MF_MOUNTED is not cleared and the mount fs instance is not freed.
|
|
|
|
|
|
|
|
This leads to amd thinking the mount fs is still mounted and the
|
|
|
|
mount request succeeds without its corresponding target being
|
|
|
|
mounted.
|
|
|
|
|
|
|
|
This patch from Richard P (with an added fix to a log message)
|
|
|
|
fixes the problem.
|
|
|
|
|
|
|
|
Signed-off-by: Richard P <richardp345@gmail.com>
|
|
|
|
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
|
---
|
2016-10-03 08:54:15 +00:00
|
|
|
amd/amfs_generic.c | 8 ++++++--
|
2016-09-14 09:33:58 +00:00
|
|
|
amd/autil.c | 6 ++++++
|
2016-10-03 08:54:15 +00:00
|
|
|
2 files changed, 12 insertions(+), 2 deletions(-)
|
2016-09-14 09:33:58 +00:00
|
|
|
|
|
|
|
--- am-utils-6.2.orig/amd/amfs_generic.c
|
|
|
|
+++ am-utils-6.2/amd/amfs_generic.c
|
2016-10-03 08:54:15 +00:00
|
|
|
@@ -743,9 +743,13 @@ amfs_bgmount(struct continuation *cp)
|
2016-09-14 09:33:58 +00:00
|
|
|
|
|
|
|
if (mf->mf_flags & (MFF_MOUNTING | MFF_UNMOUNTING)) {
|
|
|
|
/*
|
|
|
|
- * Still mounting - retry later
|
|
|
|
+ * Still mounting or umounting - retry later
|
|
|
|
*/
|
|
|
|
- dlog("mount of \"%s\" already pending", mf->mf_info);
|
2016-10-03 08:54:15 +00:00
|
|
|
+ if (mf->mf_flags & MFF_MOUNTING) {
|
2016-09-14 09:33:58 +00:00
|
|
|
+ dlog("mount of \"%s\" already pending", mf->mf_info);
|
2016-10-03 08:54:15 +00:00
|
|
|
+ } else {
|
2016-09-14 09:33:58 +00:00
|
|
|
+ dlog("unmount of \"%s\" already pending", mf->mf_info);
|
2016-10-03 08:54:15 +00:00
|
|
|
+ }
|
2016-09-14 09:33:58 +00:00
|
|
|
goto retry;
|
|
|
|
}
|
|
|
|
|
|
|
|
--- am-utils-6.2.orig/amd/autil.c
|
|
|
|
+++ am-utils-6.2/amd/autil.c
|
|
|
|
@@ -703,6 +703,12 @@ am_unmounted(am_node *mp)
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
+ * Clear the mounted flag in case there is a pending mount with
|
|
|
|
+ * the same target fs.
|
|
|
|
+ */
|
|
|
|
+ mf->mf_flags &= ~MFF_MOUNTED;
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
* If this is a pseudo-directory then adjust the link count
|
|
|
|
* in the parent
|
|
|
|
*/
|