On Wed, 2011-11-02 at 15:57 +0100, Michael Biebl wrote: > Isn't that rather a bug in mount, if it changes ro to rw? It's not like > pm-utils uses mount -o remount,rw.
No, it's actually a bug in how mount is used, mount(8) says:
The remount functionality follows the standard way how the mount
command works with options from fstab. It means the mount
command doesn't read fstab (or mtab) only when a device and dir
are fully specified.
Since pm-utils calls mount *only with the mountpoint* the options
from /etc/fstab are used in addition to those specified on the command
line. The first match mount finds is:
/home /mnt none bind 0 0
Which doesn't contain the read-only-option (only the second line doing
the actual remount contains that option). Which interestingly means that
this works:
# cat /etc/fstab
[...]
/home /mnt none bind,ro 0 0
/home /mnt none bind,ro,remount 0 0
# mount -v -a
[...]
mount: warning: /mnt seems to be mounted read-write.
/home on /mnt type none (rw,bind)
/home on /mnt type none (ro,bind)
# mount | grep /mnt
/home on /mnt type none (ro,bind)
# mount -o remount,commit=600 /mnt
# mount | grep /mnt
/home on /mnt type none (ro,bind,commit=600)
The bottom line is that pm-utils should specify *both* device and dir
when calling mount to avoid re-evaluating /etc/fstab which may be
undesirable under certain circumstances (e.g. after doing a manual
remount with different mount options).
Best regards
Alexander Kurtz
signature.asc
Description: This is a digitally signed message part

