[CRIU] [PATCH 1/2] mount: don't merge mnt and sb flags if only one contains MS_RDONLY

Andrey Vagin avagin at openvz.org
Tue Sep 22 01:59:52 PDT 2015


From: Andrew Vagin <avagin at openvz.org>

Reported-by: Tycho Andersen <tycho.andersen at canonical.com>
Signed-off-by: Andrew Vagin <avagin at openvz.org>
---
 mount.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mount.c b/mount.c
index 0bff365..b85515c 100644
--- a/mount.c
+++ b/mount.c
@@ -1958,15 +1958,15 @@ static int do_new_mount(struct mount_info *mi)
 	if (!src)
 		return -1;
 
-	if (remount_ro)
-		sflags &= ~MS_RDONLY;
-
 	/* Merge superblock and mount flags if it's posiable */
-	if (!(mflags & ~MS_MNT_KNOWN_FLAGS) && ((sflags ^ mflags) & MS_RDONLY)) {
+	if (!(mflags & ~MS_MNT_KNOWN_FLAGS) && !((sflags ^ mflags) & MS_RDONLY)) {
 		sflags |= mflags;
 		mflags = 0;
 	}
 
+	if (remount_ro)
+		sflags &= ~MS_RDONLY;
+
 	if (mount(src, mi->mountpoint, tp->name, sflags, mi->options) < 0) {
 		pr_perror("Can't mount at %s", mi->mountpoint);
 		return -1;
-- 
2.4.3



More information about the CRIU mailing list