Bug 2329 - "mount -o remount,ro /mnt/img" not working properly
Summary: "mount -o remount,ro /mnt/img" not working properly
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.17.x
Hardware: PC Linux
: P5 minor
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-04 22:21 UTC by huberty89
Modified: 2011-01-03 07:57 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description huberty89 2010-08-04 22:21:54 UTC
I tried to bind mounts read-only ( http://lwn.net/Articles/281157/ ) but isn't work properly. /mnt/img still is read-write
Comment 1 Denys Vlasenko 2011-01-03 07:57:07 UTC
On "mount -o remount,ro /path", "standard" mount does:

mount("/lib", "/mnt/tmp", 0x7f5e8d55e0c0, MS_MGC_VAL|MS_RDONLY|MS_REMOUNT|MS_BIND, NULL) = 0

Whereas busybox mount does:

mount("/dev/mapper/vg_dhcp25227-lv_root", "/mnt/tmp", 0x6e8e9a, MS_RDONLY|MS_REMOUNT|MS_SILENT|0x200000, "seclabel,barrier=1,data=ordered") = -1 EBUSY

No wonder it fails - MS_BIND bit is missing.

The difference comes from the fact that "standard" mount consults /etc/mtab, sees "/lib /mnt/tmp none rw,bind 0 0" line there, understands that it's a bind mount, and uses correct flags; whereas busybox mount looks into /proc/mounts, sees "/dev/mapper/vg_dhcp25227-lv_root /mnt/tmp ext4 rw,seclabel,relatime,barrier=1,data=ordered 0 0" line and there is no way for it to understand that it's a bind mount (also, it can't figure out correct 1st arg, but that may be not needed for -o remount).