From: Karel Zak <kzak@redhat.com>
To: Philippe De Muyter <phdm@macqel.be>
Cc: Dave Chinner <david@fromorbit.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH] init/do_mounts.c: treat EROFS like EACCES
Date: Mon, 23 Jun 2014 11:22:56 +0200 [thread overview]
Message-ID: <20140623092256.GE25885@x2.net.home> (raw)
In-Reply-To: <20140620131328.GA31693@frolo.macqel>
On Fri, Jun 20, 2014 at 03:13:28PM +0200, Philippe De Muyter wrote:
> On Fri, Jun 20, 2014 at 09:09:24AM +1000, Dave Chinner wrote:
> > On Thu, Jun 19, 2014 at 02:19:50PM -0700, Andrew Morton wrote:
> > > On Wed, 18 Jun 2014 18:12:44 +0200 Philippe De Muyter <phdm@macqel.be> wrote:
> > >
> > > > some combinations of filesystem and block device (at least vfat on mmc)
> > > > yield -EROFS instead of -EACCES when the device is read-only. Retry
> > > > mounting with MS_RDONLY set, just like for the EACCES case, instead of
> > > > failing directly.
> > > >
> > > > ...
> > > >
> > > > --- a/init/do_mounts.c
> > > > +++ b/init/do_mounts.c
> > > > @@ -394,6 +394,7 @@ retry:
> > > > case 0:
> > > > goto out;
> > > > case -EACCES:
> > > > + case -EROFS:
> > > > flags |= MS_RDONLY;
> > > > goto retry;
> > > > case -EINVAL:
> > >
> > > hm, what's going on here. I'd have thought it to be very logical that
> > > file_system_type.mount() would return EROFS if the device is read-only!
> > > But I'm suspecting that there is some convention that the fs is
> > > supposed to return EACCES in this case. So *perhaps* it is vfat-on-mmc
> > > which needs fixing. Dunno.
> > >
> > > Al, are you able to shed light?
> >
> > from the mount(2) man page:
> >
> > EACCES A component of a path was not searchable. (See also
> > path_resolution(7).) Or, mounting a read-only filesystem
> > was attempted without giving the MS_RDONLY flag. Or, the
> > block device source is located on a filesystem mounted with
> > the MS_NODEV option.
> >
> > So, when the device is read-only, the error should EACCES, not
> > EROFS. Would seem to me that vfat-on-mmc needs fixing...
Only code matters, we don't compile and execute man pages... ;-)
> Looking at the sources of mount(1)
>
> https://github.com/karelzak/util-linux/blob/master/sys-utils/mount.c
>
> at line 601, we clearly see that mount(1) allows mount(2) to fail
> with EROFS.
BTW, comment from the original mount(8) code:
case EACCES: /* pre-linux 1.1.38, 1.1.41 and later */
case EROFS: /* linux 1.1.38 and later */
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
prev parent reply other threads:[~2014-06-23 9:23 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 ` [PATCH] VFS: mount must return EACCES, not EROFS Philippe De Muyter
2014-06-27 8:20 ` [PATCH PING] " 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 [this message]
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=20140623092256.GE25885@x2.net.home \
--to=kzak@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=david@fromorbit.com \
--cc=linux-kernel@vger.kernel.org \
--cc=phdm@macqel.be \
--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