* [PATCH resend] init: fix read-write root mount
@ 2014-11-24 13:25 Miklos Szeredi
0 siblings, 0 replies; only message in thread
From: Miklos Szeredi @ 2014-11-24 13:25 UTC (permalink / raw)
To: Al Viro; +Cc: linux-kernel, linux-fsdevel
From: Miklos Szeredi <mszeredi@suse.cz>
If mount flags don't have MS_RDONLY, iso9660 returns EACCES without actually
checking if it's an iso image.
This tricks mount_block_root() into retrying with MS_RDONLY. This results
in a read-only root despite the "rw" boot parameter if the actual
filesystem was checked after iso9660.
I believe the behavior of iso9660 is okay, while that of mount_block_root()
is not. It should rather try all types without MS_RDONLY and only then
retry with MS_RDONLY.
This change also makes the code more robust against the case when EACCES is
returned despite MS_RDONLY, which would've resulted in a lockup.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
init/do_mounts.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -395,8 +395,6 @@ void __init mount_block_root(char *name,
case 0:
goto out;
case -EACCES:
- flags |= MS_RDONLY;
- goto retry;
case -EINVAL:
continue;
}
@@ -419,6 +417,10 @@ void __init mount_block_root(char *name,
#endif
panic("VFS: Unable to mount root fs on %s", b);
}
+ if (!(flags & MS_RDONLY)) {
+ flags |= MS_RDONLY;
+ goto retry;
+ }
printk("List of all partitions:\n");
printk_all_partitions();
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-11-24 13:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-24 13:25 [PATCH resend] init: fix read-write root mount Miklos Szeredi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).