summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Uzel <petr.uzel@suse.cz>2010-05-21 15:19:31 +0200
committerKarel Zak <kzak@redhat.com>2010-05-28 14:48:49 +0200
commit81694f8c60dffb7851f941e69a1b79bc573ace53 (patch)
tree43719fcf568a494691a2076dc0d807bafc87ce9d
parent1bb08542618958f554a740bf72d423d5029f1ab0 (diff)
downloadutil-linux-old-81694f8c60dffb7851f941e69a1b79bc573ace53.tar.gz
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>
-rw-r--r--mount/mount.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/mount/mount.c b/mount/mount.c
index 576fed6b..4f2dcd24 100644
--- a/mount/mount.c
+++ b/mount/mount.c
@@ -1435,6 +1435,18 @@ try_mount_one (const char *spec0, const char *node0, const char *types0,
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. */