Control: reassign -1 mount
On Mon, 2013-01-28 at 04:37 -0600, Zev Weiss wrote:
> Package: src:linux
> Version: 3.2.35-2
> Severity: normal
>
> Dear Maintainer,
>
> I'm experiencing what seems to be a kernel bug with read-only remounting
> of a bind mount (creating a read-only bind mount). After running the
> following commands, both /foo/dir_ro *and* /foo/dir become read-only:
>
> mount --bind /foo/dir /foo/dir_ro
> mount -o remount,ro /foo/dir_ro
>
> Running 'mount -o remount,rw /foo/dir' rectifies the situation, leaving
> it as I intended (/foo/dir writable, /foo/dir_ro read-only).
[...]
A bind mount is an alias for the same mount, and shares its options.
This is similar too:
touch foo
ln foo bar
chmod a-r bar # affects foo as well, because it is the same file
But somewhat confusingly, there is an entirely separate un-shared
read-only flag, which can you set when creating a bind-mount or when
remounting. The mount command maps the 'ro' option to one of these
depending on context. This is documented in mount(8) thus:
Note that behavior of the remount operation depends on the
/etc/mtab file. The first command stores the 'bind' flag to the
/etc/mtab file and the second command reads the flag from the
file. If you have a system without the /etc/mtab file or if you
explicitly define source and target for the remount command
(then mount(8) does not read /etc/mtab), then you have to use
bind flag (or option) for the remount command too. For example:
mount --bind olddir newdir
mount -o remount,ro,bind olddir newdir
I'm reassigning this to the mount package: the documentation is not as
clear as it could be, and I think it should provide explicit names for
the two different flags.
Ben.
--
Ben Hutchings
If more than one person is responsible for a bug, no one is at fault.
Attachment:
signature.asc
Description: This is a digitally signed message part