diff options
author | Ian Kent <raven@themaw.net> | 2018-07-04 11:45:06 +0800 |
---|---|---|
committer | Ian Kent <raven@themaw.net> | 2018-09-27 10:14:40 +0800 |
commit | a83bf85501b1d0d120eb552e799d75f29c1e346d (patch) | |
tree | 1eb1aa4ae72f913ff28b86390477f1f0a92c396f /modules | |
parent | be27353b607f96cb4ea025e7779d707dae08c6a9 (diff) | |
download | autofs-a83bf85501b1d0d120eb552e799d75f29c1e346d.tar.gz |
autofs-5.1.4 - add master map pseudo options for mount propagation
Add master map entry pseudo mount option of "slave" or "private" to
allow mount propagation of bind mounts to be set to either "slave" or
"private".
This option may be needed when using multi-mounts that have bind mounts
that bind to a file system that is propagation shared. This is becuase
the bind mount will have the same properties as its target which causes
problems for offset mounts. When this happens an unwanted offset mount
is propagated back to the target file system resulting in a deadlock
when attempting to access the offset.
By default bind mounts will inherit the mount propagation of the target
file system.
Signed-off-by: Ian Kent <raven@themaw.net>
Diffstat (limited to 'modules')
-rw-r--r-- | modules/mount_bind.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/modules/mount_bind.c b/modules/mount_bind.c index fe1ad9b6..b64cdccc 100644 --- a/modules/mount_bind.c +++ b/modules/mount_bind.c @@ -186,17 +186,25 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int what, fstype, fullpath); } - /* The bind mount has succeeded but if the target - * mount is propagation shared propagation of child - * mounts (autofs offset mounts for example) back to - * the target of the bind mount must be avoided or - * autofs trigger mounts will deadlock. - */ - err = mount(NULL, fullpath, NULL, MS_SLAVE, NULL); - if (err) - warn(ap->logopt, - "failed to set propagation type for %s", - fullpath); + if (ap->flags & (MOUNT_FLAG_SLAVE | MOUNT_FLAG_PRIVATE)) { + int flags = MS_SLAVE; + + if (ap->flags & MOUNT_FLAG_PRIVATE) + flags = MS_PRIVATE; + + /* The bind mount has succeeded but if the target + * mount is propagation shared propagation of child + * mounts (autofs offset mounts for example) back to + * the target of the bind mount must be avoided or + * autofs trigger mounts will deadlock. + */ + err = mount(NULL, fullpath, NULL, flags, NULL); + if (err) { + warn(ap->logopt, + "failed to set propagation for %s", + fullpath, root); + } + } return 0; } else { |