linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miklos Szeredi <miklos@szeredi.hu>
To: Karel Zak <kzak@redhat.com>
Cc: Phillip Susi <psusi@ubuntu.com>,
	util-linux@vger.kernel.org,
	Linux-Fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: read only bind mount ignores ready only
Date: Thu, 12 Dec 2013 20:42:54 +0100	[thread overview]
Message-ID: <CAJfpegvWeEb7Dtk8CMxLO4DB-xSLQMxLxccUPReU0GeQ=9d5MA@mail.gmail.com> (raw)
In-Reply-To: <20131212120544.GJ16572@x2.net.home>

On Thu, Dec 12, 2013 at 1:05 PM, Karel Zak <kzak@redhat.com> wrote:
>
>  [CC: kernel guys]
>
> On Wed, Dec 11, 2013 at 09:37:57AM -0500, Phillip Susi wrote:
>> It seems that the kernel has a bug where it silently ignores the
>> MS_RDONLY flag when creating a bind mount.  mount issues a warning
>> that the mount point appears to be read-write even though you
>> requested read only.  The reporter suggests a patch to automatically
>> attempt to remount with MS_RDONLY before issuing this warning to work
>> around the kernel bug.  What do you think?
>
> I have it implemented, so
>
>  mount --bind --read-only /mnt /mnt
>
> is interpreted as two requests (two mount(2) calls)
>
>  mount --bind /mnt /mnt
>  mount -o remount,bind,ro /tmp
>
> it works as expected, but it does not work with MS_REC (recursive)
> because kernel currently does not support
>
>   MS_REMOUNT|MS_BIND|MS_REC|...
>
> it means that
>
>   mount --rbind --read-only /mnt /mnt
>
> creates only top-level read-only mountpoint, the rest is unchanged.
>
>
> Miklos would be possible to fix kernel to accept MS_REC for
> MS_REMOUNT|MS_BIND|MS_RDONLY operation? Please.

I really hate the current mount(2) API. It's a gigantic hack, and it's
nearing the end of its life anyway due to flags running out.

So instead of adding more hacks, I think it would be better to think
about adding a couple of syscalls that have clearly defined semantics.

Thanks,
Miklos

       reply	other threads:[~2013-12-12 19:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <52A878C5.6050505@ubuntu.com>
     [not found] ` <20131212120544.GJ16572@x2.net.home>
2013-12-12 19:42   ` Miklos Szeredi [this message]
     [not found]     ` <CAJfpegvWeEb7Dtk8CMxLO4DB-xSLQMxLxccUPReU0GeQ=9d5MA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-12-12 21:53       ` read only bind mount ignores ready only Al Viro
2013-12-13 10:45         ` Karel Zak
2013-12-13  8:18       ` 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='CAJfpegvWeEb7Dtk8CMxLO4DB-xSLQMxLxccUPReU0GeQ=9d5MA@mail.gmail.com' \
    --to=miklos@szeredi.hu \
    --cc=kzak@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=psusi@ubuntu.com \
    --cc=util-linux@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).