teach move_mount(2) to work with OPEN_TREE_CLONE
authorDavid Howells <dhowells@redhat.com>
Mon, 5 Nov 2018 17:40:31 +0000 (17:40 +0000)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 20 Mar 2019 22:49:06 +0000 (18:49 -0400)
commit44dfd84a6d54a675e35ab618d9fab47b36cb78cd
tree6b5542f217686066119c9bdfed2182e2c2a6d4a9
parent2db154b3ea8e14b04fee23e3fdfd5e9d17fbc6ae
teach move_mount(2) to work with OPEN_TREE_CLONE

Allow a detached tree created by open_tree(..., OPEN_TREE_CLONE) to be
attached by move_mount(2).

If by the time of final fput() of OPEN_TREE_CLONE-opened file its tree is
not detached anymore, it won't be dissolved.  move_mount(2) is adjusted
to handle detached source.

That gives us equivalents of mount --bind and mount --rbind.

Thanks also to Alan Jenkins <alan.christopher.jenkins@gmail.com> for
providing a whole bunch of ways to break things using this interface.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namespace.c