Re: Feature bug with the new mount API: no way of doing read only bind mounts

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

 



James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx> wrote:

> I was looking to use the read only bind mount as a template for
> reimplementing shiftfs when I discovered that you can't actually create a
> read only bind mount with the new API.  The problem is that fspick() will
> only reconfigure the underlying superblock, which you don't want because you
> only want the bound subtree to become read only and open_tree()/move_mount()
> doesn't give you any facility to add or change options on the bind.

You'd use open_tree() with OPEN_TREE_CLONE and possibly AT_RECURSIVE rather
than fspick().  fspick() is, as you observed, more for reconfiguring the
superblock.

What is missing is a mount_setattr() syscall - something like:

	mount_setattr(int dfd, const char *path, unsigned int at_flags,
		      unsigned int attr_change_mask, unsigned int attrs);

which would allow what you want to be done like:

	fd = open_tree(AT_FDCWD, "/my/source/", OPEN_TREE_CLONE);
	mount_setattr(fd, "", AT_EMPTY_PATH | AT_RECURSIVE,
		      MOUNT_ATTR_RDONLY, MOUNT_ATTR_RDONLY);
	move_mount(fd, "", AT_FDCWD, "/mnt", MOVE_MOUNT_F_EMPTY_PATH);

Christian: you said you wanted to have a look at doing this - is that still
your intention?

Al: Is it too late to change OPEN_TREE_CLONE to be a definite value rather
than tying it to O_CLOEXEC?  OPEN_TREE_CLONE shares its space with the
AT_flags, but O_CLOEXEC has one of three different values, depending on arch.
Perhaps we can nail it to 02000000 (0x80000), which is what's used on
everything but alpha, mips, parisc and sparc.

David





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux