linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re-mounting a non-bind mountpoint with MS_BIND
@ 2013-03-08  4:34 shea
  0 siblings, 0 replies; only message in thread
From: shea @ 2013-03-08  4:34 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Alexander Viro, linux-kernel

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-03-08  4:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-08  4:34 Re-mounting a non-bind mountpoint with MS_BIND shea

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).