autofs-5.1.2 - honor last rw in mount options when doing a bind mount From: David Jeffery mount(8) will use the last ro/rw option in its options list. e.g. "mount -o ro,rw" will make a read-write mount while "mount -o rw,ro" will make a read-only mount. The patch changes the option parsing for mount_mount() in modules/mount_nfs.c to clear the ro variable when a "rw" option is seen. This will handle occurrences of both "ro" and "rw" options, resulting in a read-only option being passed to a bind mount only if the option order would also have resulted in an nfs mount being read-only. Signed-off-by: David Jeffery Signed-off-by: Ian Kent --- CHANGELOG | 1 + modules/mount_nfs.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 8eedad3..f841eaa 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -35,6 +35,7 @@ xx/xx/2016 autofs-5.1.3 - check NFS server availability on local mount fallback. - make set_direct_mount_catatonic() more general. - set autofs mounts catatonic at exit. +- honor last rw in mount options when doing a bind mount. 15/06/2016 autofs-5.1.2 ======================= diff --git a/modules/mount_nfs.c b/modules/mount_nfs.c index 2712140..c558a73 100644 --- a/modules/mount_nfs.c +++ b/modules/mount_nfs.c @@ -180,6 +180,8 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int with bind mounts */ else if (_strncmp("ro", cp, o_len) == 0) ro = 1; + else if (_strncmp("rw", cp, o_len) == 0) + ro = 0; /* and jump over trailing white space */ memcpy(nfsp, cp, comma - cp + 1); nfsp += comma - cp + 1;