Re: Bug: mount: "user" mounts broken when /etc/mtab is a symlink

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 23, 2009 at 11:32:44AM +0100, Roger Leigh wrote:
> On Mon, Jun 22, 2009 at 09:17:18PM +0200, Karel Zak wrote:
> > 
> >  Hi Roger,
> > 
> > On Sun, Jun 21, 2009 at 02:26:51PM +0100, Roger Leigh wrote:
> > > This information should be recorded in /proc/mounts now that this
> > > information can be passed to mount(2).
> > 
> >  really?
> 
> Ah, it's missing some context from where the discussion originally
> started.  This is referring to MS_BIND mountflags no longer being
> ignored.

 I still think you are not right. The 2.6.26 kernel has introduced 
 /proc/self/mountinfo, but it seems that fs/namespace.c does not
 export MS_BIND as a string option in /proc/mounts.

 See (simple_mount.c code is below):

 # ./simple_mount /mnt/test /mnt/test2 none 4096 rw,bind

 # grep test /proc/mounts
 /dev/root /mnt/test2 ext3 rw,noatime,relatime,errors=continue,user_xattr,acl,data=ordered 0 0

 # grep test /proc/self/mountinfo
 28 18 8:4 /mnt/test /mnt/test2  rw,noatime,relatime - ext3 /dev/root  rw,errors=continue,user_xattr,acl,data=ordered

 .. kernel 2.6.29.4-167.fc11.x86_64.


 The most important problem with bind mounts in /proc/mounts is that
 there is not information about the source directory (/mnt/test in my
 example). There is source device only (e.g. /dev/root).

 It means you can't call:

   # mount --bind /source /target

   # umount /source
 
 on systems without mtab.
 
> This is WRT Debian bug reports

 I'll check it later, thanks.

> >  My plan is to support systems without /etc/mtab and use
> >  /proc/self/mountinfo in util-linux-ng 2.{17,18} (September/October
> >  2009 or so...).
> 
> Cool.  Just to clarify: at this point, barring any unforseen bugs,
> we can delete /etc/mtab and running with just /proc will be a
> valid supported configuration?
 
 Yes, mtab is Bad Thing.

> What will the minimum supported kernel version for such a configuration
> be (with mountinfo)?

 kernel 2.6.26

> Will support for a writable mtab be removed at some future point?

 at far far future...

    Karel


#include <stdio.h>
#include <sys/mount.h>

int main(int argc, char *argv[]) {
	unsigned long flags = 0;
	char *data = NULL;

	if (argc < 4) {
		fprintf(stderr,
			"usage %s <source> <target> <type> [<flags> [<data>]]\n",
			argv[0]);
		return 1;
	}
	if (argc >= 5)
		flags = atoll(argv[4]);
	if (argc == 6)
		data = argv[5];

	return mount (argv[1], argv[2], argv[3], flags, data);
}
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux