From: Philippe De Muyter <phdm@macqel.be>
To: linux-kernel@vger.kernel.org
Cc: Philippe De Muyter <phdm@macqel.be>,
Al Viro <viro@zeniv.linux.org.uk>,
Dave Chinner <david@fromorbit.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-fsdevel@vger.kernel.org
Subject: [PATCH] VFS: mount must return EACCES, not EROFS
Date: Fri, 20 Jun 2014 10:39:22 +0200 [thread overview]
Message-ID: <1403253562-29248-1-git-send-email-phdm@macqel.be> (raw)
In-Reply-To: <20140619230924.GO4453@dastard>
mount must return EACCES, not EROFS, when one attempts to mount a
read-only filesystem in read-write mode, but the file-system layer
only transmits the error given by the block layer, and many block
drivers return EROFS in that case, so let's fix it in do_mount.
Actually it is only a small problem for a user using the mount(1)
command, because EROFS is actually a more explicit answer than
EACCES, but init/do_mounts.c checks only for EACCES, not EROFS,
to decide to retry to mount the root file-system in read-only mode,
and so we are left with an unbootable kernel, and with a cryptic
error message (*) if the root partition happens to be read-only
(*): VFS: Cannot open root device "mmcblk0p2" or unknown-block(179,2):
error -30
Signed-off-by: Philippe De Muyter <phdm@macqel.be>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org
---
fs/namespace.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fs/namespace.c b/fs/namespace.c
index 182bc41..6291a3f 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2411,6 +2411,8 @@ long do_mount(const char *dev_name, const char *dir_name,
retval = security_sb_mount(dev_name, &path,
type_page, flags, data_page);
+ if (retval == -EROFS)
+ retval = -EACCES;
if (!retval && !may_mount())
retval = -EPERM;
if (retval)
--
1.7.5.3
next prev parent reply other threads:[~2014-06-20 8:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 16:12 [PATCH] init/do_mounts.c: treat EROFS like EACCES Philippe De Muyter
2014-06-19 21:19 ` Andrew Morton
2014-06-19 23:09 ` Dave Chinner
2014-06-20 8:39 ` Philippe De Muyter [this message]
2014-06-27 8:20 ` [PATCH PING] VFS: mount must return EACCES, not EROFS Philippe De Muyter
2014-07-02 19:46 ` Andrew Morton
2014-07-03 16:29 ` Philippe De Muyter
2014-07-08 21:02 ` Andrew Morton
2014-07-15 10:05 ` Philippe De Muyter
2014-06-20 13:13 ` [PATCH] init/do_mounts.c: treat EROFS like EACCES Philippe De Muyter
2014-06-23 9:22 ` Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1403253562-29248-1-git-send-email-phdm@macqel.be \
--to=phdm@macqel.be \
--cc=akpm@linux-foundation.org \
--cc=david@fromorbit.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®