On Fri, May 21, 2010 at 07:31:28AM -0400, Christoph Hellwig wrote: > On Fri, May 21, 2010 at 10:57:51AM +0200, Petr Uzel wrote: > > Hi, > > > > following patch fixes Novell bug #481123: > > https://bugzilla.novell.com/show_bug.cgi?id=481123 > > > > > > Linux kernel silently adds MS_RDONLY flag when mounting iso9660 > > file system, which leads to having 'rw' in mtab and 'ro' in > > /proc/mounts. > > Various kernel filesystems drivers do this - basically all that do not > have write support. I think blacklisting the fs names is not going to > scale. I wanted to make the change as specific as possible. The more universal way would use is_readonly() function to check if the device was mounted read only. ----- 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. Reported-by: James Foris <jim.foris@xxxxxxxxxx> Signed-off-by: Petr Uzel <petr.uzel@xxxxxxx> --- mount/mount.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/mount/mount.c b/mount/mount.c index 969e81f..a6205f8 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -1435,6 +1435,17 @@ 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) && 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. */ -- 1.6.4.2 Petr -- Petr Uzel IRC: ptr_uzl @ freenode
Attachment:
pgpGdZvQEr8Aw.pgp
Description: PGP signature