Thread (17 messages) flat view 17 messages, 5 authors, 2018-06-04

Re: [PATCH][RFC] open_tree(2) (was Re: [PATCH 30/32] vfs: Allow cloning of a mount tree with open(O_PATH|O_CLONE_MOUNT) [ver #8])

From: Miklos Szeredi <miklos@szeredi.hu>
Date: 2018-06-04 10:34:48
Also in: linux-fsdevel, lkml

On Sun, Jun 3, 2018 at 2:55 AM, Al Viro [off-list ref] wrote:
On Sat, Jun 02, 2018 at 06:49:58PM +0100, Al Viro wrote:
quoted
quoted
quoted
Hell, might even add AT_UMOUNT for "open root and detach, to be dissolved on
close", incompatible with AT_CLONE.
Cute.  Guess you could do:

    fd = open_mount(..., OPEN_TREE_DETACH);
    mount_setattr(fd, "",
                  MOUNT_SETATTR_EMPTY_PATH,
                  MOUNT_SETATTR_NOSUID, NULL);
    move_mount(fd, "", ...);
Hadn't added that yet, but as for the rest of open_tree() - see
vfs.git#mount-open_tree.  open() and its flags are not touched at all.
Other changes compared to the previous:
        * may_mount() is required for OPEN_TREE_CLONE
        * sys_ni.c cruft is dropped - those make no sense until and unless
those syscalls become conditional.

Appears to work, combined with move_mount() it yields eqiuvalents of
mount --{move,bind,rbind}.  Combined with mount_setattr(2) (when that
gets added) we'll get mount -o remount,bind,nodev et.al.
fsopen = create fsfd
fsmount = fsfd -> mountfd & set attr on mountfd & attach mountfd
fspick = path -> fsfd
move_mount = attach mountfd or move existing
fsinfo = info from path
open_tree = new mountfd from path or clone
mount_setattr = set attr on mountfd

Notice that fsmount() encompasses mount_setattr() + move_mount()
functionality.   Split those out and leave fsmount() to actually do
the "fsfd ->mountfd" translation?

fsinfo() name suggests it's in the same class as
fsopen/fsmount/fspick, operating on fsfd object, but's it's not and I
think that's slightly confusing.

Rename move_mount() -> mount_move()?

Also does it make sense to make the cloning behavior of open_tree()
optional?  Without cloning it's just a plain open(O_PATH).  That  way
it could be renamed mount_clone().

Thanks,
Miklos
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help