Unverified Commit b492fc2a by Christian Brauner Committed by GitHub

Merge pull request #3323 from tych0/fix-readonly-bind-mounts

conf: fix read-only bind mounts
parents e4e80aa9 94bef7e4
...@@ -1847,15 +1847,14 @@ static int mount_entry(const char *fsname, const char *target, ...@@ -1847,15 +1847,14 @@ static int mount_entry(const char *fsname, const char *target,
} }
if ((mountflags & MS_REMOUNT) || (mountflags & MS_BIND)) { if ((mountflags & MS_REMOUNT) || (mountflags & MS_BIND)) {
unsigned long required_flags = 0;
DEBUG("Remounting \"%s\" on \"%s\" to respect bind or remount options", DEBUG("Remounting \"%s\" on \"%s\" to respect bind or remount options",
srcpath ? srcpath : "(none)", target ? target : "(none)"); srcpath ? srcpath : "(none)", target ? target : "(none)");
if (mountflags & MS_RDONLY)
required_flags |= MS_RDONLY;
#ifdef HAVE_STATVFS #ifdef HAVE_STATVFS
if (srcpath && statvfs(srcpath, &sb) == 0) { if (srcpath && statvfs(srcpath, &sb) == 0) {
unsigned long required_flags = 0;
if (sb.f_flag & MS_NOSUID) if (sb.f_flag & MS_NOSUID)
required_flags |= MS_NOSUID; required_flags |= MS_NOSUID;
...@@ -1875,7 +1874,8 @@ static int mount_entry(const char *fsname, const char *target, ...@@ -1875,7 +1874,8 @@ static int mount_entry(const char *fsname, const char *target,
* does not have any flags which are not already in * does not have any flags which are not already in
* mountflags, then skip the remount. * mountflags, then skip the remount.
*/ */
if (!(mountflags & MS_REMOUNT) && !(required_flags & ~mountflags)) { if (!(mountflags & MS_REMOUNT) &&
(!(required_flags & ~mountflags) && !(mountflags & MS_RDONLY))) {
DEBUG("Mountflags already were %lu, skipping remount", mountflags); DEBUG("Mountflags already were %lu, skipping remount", mountflags);
goto skipremount; goto skipremount;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment