|
|
306fa1 |
autofs-5.1.4 - set bind mount as propagation slave
|
|
|
306fa1 |
|
|
|
306fa1 |
From: Ian Kent <raven@themaw.net>
|
|
|
306fa1 |
|
|
|
306fa1 |
When using a multi-mount with mount targets that are on the
|
|
|
306fa1 |
local machine and resulting bind mounts are made to a file
|
|
|
306fa1 |
system that is mount propagation shared (such as the root
|
|
|
306fa1 |
file system on systemd managed systems) the autofs offset
|
|
|
306fa1 |
mount triggers made within the bind mount will be propagated
|
|
|
306fa1 |
back to the target file system.
|
|
|
306fa1 |
|
|
|
306fa1 |
When this happens the target of the offset (the unwanted
|
|
|
306fa1 |
propagated mount) is itself an autofs trigger mount and
|
|
|
306fa1 |
accessing the path results in a deadlock.
|
|
|
306fa1 |
|
|
|
306fa1 |
In order for these multi-mounts to function properly in this
|
|
|
306fa1 |
case bind mounts that contain mount triggers must be set to
|
|
|
306fa1 |
propagation shared or private so the backward propagation
|
|
|
306fa1 |
doesn't occur.
|
|
|
306fa1 |
|
|
|
306fa1 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
306fa1 |
---
|
|
|
306fa1 |
CHANGELOG | 1 +
|
|
|
306fa1 |
modules/mount_bind.c | 16 +++++++++++++++-
|
|
|
306fa1 |
2 files changed, 16 insertions(+), 1 deletion(-)
|
|
|
306fa1 |
|
|
|
306fa1 |
--- autofs-5.0.7.orig/CHANGELOG
|
|
|
306fa1 |
+++ autofs-5.0.7/CHANGELOG
|
|
|
306fa1 |
@@ -307,6 +307,7 @@
|
|
|
306fa1 |
- add port parameter to rpc_ping().
|
|
|
306fa1 |
- dont probe NFSv2 by default.
|
|
|
306fa1 |
- add version parameter to rpc_ping().
|
|
|
306fa1 |
+- set bind mount as propagation slave.
|
|
|
306fa1 |
|
|
|
306fa1 |
25/07/2012 autofs-5.0.7
|
|
|
306fa1 |
=======================
|
|
|
306fa1 |
--- autofs-5.0.7.orig/modules/mount_bind.c
|
|
|
306fa1 |
+++ autofs-5.0.7/modules/mount_bind.c
|
|
|
306fa1 |
@@ -20,6 +20,7 @@
|
|
|
306fa1 |
#include <sys/param.h>
|
|
|
306fa1 |
#include <sys/types.h>
|
|
|
306fa1 |
#include <sys/stat.h>
|
|
|
306fa1 |
+#include <sys/mount.h>
|
|
|
306fa1 |
|
|
|
306fa1 |
#define MODULE_MOUNT
|
|
|
306fa1 |
#include "automount.h"
|
|
|
306fa1 |
@@ -184,8 +185,21 @@ int mount_mount(struct autofs_point *ap,
|
|
|
306fa1 |
debug(ap->logopt,
|
|
|
306fa1 |
MODPREFIX "mounted %s type %s on %s",
|
|
|
306fa1 |
what, fstype, fullpath);
|
|
|
306fa1 |
- return 0;
|
|
|
306fa1 |
}
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ /* The bind mount has succeeded but if the target
|
|
|
306fa1 |
+ * mount is propagation shared propagation of child
|
|
|
306fa1 |
+ * mounts (autofs offset mounts for example) back to
|
|
|
306fa1 |
+ * the target of the bind mount must be avoided or
|
|
|
306fa1 |
+ * autofs trigger mounts will deadlock.
|
|
|
306fa1 |
+ */
|
|
|
306fa1 |
+ err = mount(NULL, fullpath, NULL, MS_SLAVE, NULL);
|
|
|
306fa1 |
+ if (err)
|
|
|
306fa1 |
+ warn(ap->logopt,
|
|
|
306fa1 |
+ "failed to set propagation type for %s",
|
|
|
306fa1 |
+ fullpath);
|
|
|
306fa1 |
+
|
|
|
306fa1 |
+ return 0;
|
|
|
306fa1 |
} else {
|
|
|
306fa1 |
char *cp;
|
|
|
306fa1 |
char basepath[PATH_MAX];
|