linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: shea@shealevy.com
To: <linux-fsdevel@vger.kernel.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>, <linux-kernel@vger.kernel.org>
Subject: Re-mounting a non-bind mountpoint with MS_BIND
Date: Thu, 07 Mar 2013 23:34:58 -0500	[thread overview]
Message-ID: <25c50eb5327aea8fc70b29fd0853befb@shealevy.com> (raw)

Hello,

To my surprise, mount("/dev/sda1", "/mnt", "vfat", MS_RDONLY, "") 
followed by mount("/mnt", "/mnt", 0, MS_REMOUNT | MS_BIND, 0) succeeds, 
with some IMO odd behavior:

* statfs(2) on /mnt shows /mnt as not being readonly in the s_flags 
field
* The sixth column of relevant mountinfo files (but not the tenth!) 
shows /mnt as being rw
* All other syscalls (AFAICT, I checked with git grep MNT_READONLY) 
behave as if /mnt were readonly

Why does mount behave like this? To me it would make much more sense if 
either MS_REMOUNT | MS_BIND failed on a non-bind mountpoint (my personal 
preference) or if it succeeded but the mountpoint was still treated as 
readonly from the perspective of all userspace interfaces.

Cheers,
Shea Levy

P.S. I am not subscribed to fsdevel or lkml, so please CC me in 
responses.

                 reply	other threads:[~2013-03-08  4:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=25c50eb5327aea8fc70b29fd0853befb@shealevy.com \
    --to=shea@shealevy.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;
as well as URLs for NNTP newsgroup(s).