3
0
forked from pool/util-linux
util-linux/util-linux-mount-detect-ro-mount.patch

42 lines
1.5 KiB
Diff

From 81694f8c60dffb7851f941e69a1b79bc573ace53 Mon Sep 17 00:00:00 2001
From: Petr Uzel <petr.uzel@suse.cz>
Date: Fri, 21 May 2010 15:19:31 +0200
Subject: [PATCH] mount: detect when kernel silently adds MS_RDONLY flag
Linux kernel can silently add MS_RDONLY flag when mounting file system that
does not have write support. Check this to avoid 'ro' in /proc/mounts and 'rw'
in mtab.
[kzak@redhat.com: - don't check for 'ro' for MS_MOVE and MS_PROPAGATION]
Reported-by: James Foris <jim.foris@med.ge.com>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
---
mount/mount.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
Index: util-linux-ng-2.17.2/mount/mount.c
===================================================================
--- util-linux-ng-2.17.2.orig/mount/mount.c 2010-05-28 15:22:47.000000000 +0200
+++ util-linux-ng-2.17.2/mount/mount.c 2010-05-28 15:23:03.000000000 +0200
@@ -1388,6 +1388,18 @@ mount_retry:
flags &= ~MS_RDONLY;
}
+ /* Kernel can silently add MS_RDONLY flag when mounting file system that
+ * does not have write support. Check this to avoid 'ro' in /proc/mounts
+ * and 'rw' in mtab.
+ */
+ if (!fake && mnt5_res == 0 &&
+ !(flags & MS_RDONLY) && !(flags & MS_PROPAGATION) && !(flags & MS_MOVE) &&
+ is_readonly(node)) {
+
+ printf(_("mount: warning: %s seems to be mounted read-only.\n"), node);
+ flags |= MS_RDONLY;
+ }
+
if (fake || mnt5_res == 0) {
/* Mount succeeded, report this (if verbose) and write mtab entry. */