The previous commit does not properly fix the problem with "none"
fstype and MS_{PROPAGATION,BIND,MOVE} flags. The real fstype has to
be replaced with "none" before we try to use /sbin/mount.<type>
helper.
Old version:
# grep test /proc/self/mountinfo
16 18 0:19 / /mnt/test rw,relatime - tmpfs tmpfs rw
# ./mount -v -v -v --make-private /mnt/test
mount: fstab path: "/etc/fstab"
mount: mtab path: "/etc/mtab"
mount: lock path: "/etc/mtab~"
mount: temp path: "/etc/mtab.tmp"
mount: UID: 0
mount: eUID: 0
mount: spec: "tmpfs"
mount: node: "/mnt/test"
mount: types: "tmpfs"
mount: opts: "rw"
mount: external mount: argv[0] = "/sbin/mount.tmpfs"
mount: external mount: argv[1] = "tmpfs"
mount: external mount: argv[2] = "/mnt/test"
mount: external mount: argv[3] = "-v"
mount: external mount: argv[4] = "-o"
mount: external mount: argv[5] = "rw"
tmpfs on /mnt/test type tmpfs (rw)
# grep test /proc/self/mountinfo
16 18 0:19 / /mnt/test rw,relatime - tmpfs tmpfs rw
17 16 0:20 / /mnt/test rw,relatime - tmpfs tmpfs rw
Fixed version:
# grep test /proc/self/mountinfo
16 18 0:19 / /mnt/test rw,relatime - tmpfs tmpfs rw
# ./mount -v -v -v --make-private /mnt/test
mount: fstab path: "/etc/fstab"
mount: mtab path: "/etc/mtab"
mount: lock path: "/etc/mtab~"
mount: temp path: "/etc/mtab.tmp"
mount: UID: 0
mount: eUID: 0
mount: spec: "tmpfs"
mount: node: "/mnt/test"
mount: types: "tmpfs"
mount: opts: "rw"
mount: mount(2) syscall: source: "tmpfs", target: "/mnt/test",
filesystemtype: "none", mountflags: 262144, data: (null)
# grep test /proc/self/mountinfo
16 18 0:19 / /mnt/test rw,relatime - tmpfs tmpfs rw
Signed-off-by: Karel Zak <kzak@redhat.com>
if (*types && strcasecmp (*types, "auto") == 0)
*types = NULL;
- if (flags & (MS_BIND | MS_MOVE | MS_PROPAGATION))
- *types = "none";
-
if (!*types && !(flags & MS_REMOUNT)) {
*types = guess_fstype_by_devname(spec);
if (*types) {
if (loop)
opt_loopdev = loopdev;
+ if (flags & (MS_BIND | MS_MOVE | MS_PROPAGATION))
+ types = "none";
+
/*
* Call mount.TYPE for types that require a separate mount program.
* For the moment these types are ncpfs and smbfs. Maybe also vxfs.