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]

 



On Thu, 2019-11-21 at 08:10 +0000, David Howells wrote:
> 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);

That would work for read only, which is a simple mount attribute flag,
but wouldn't work for anything more complex like shiftfs which wants
more complex parameters.  What I'm looking for in that case is the
ability to reconfigure the bind mount in the same way you would
reconfigure the superblock.

James




[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