Re: [PATCH 31/32] [RFC] fs: Add a move_mount() system call [ver #8]

From: Al Viro
Date: Thu May 31 2018 - 17:21:01 EST


On Fri, May 25, 2018 at 01:08:44AM +0100, David Howells wrote:
> [!] NOTE: This patch doesn't quite work to move an O_CLONE_MOUNT-produced
> vfsmount as move_mount() checks that the source vfsmount mnt_ns matches
> the calling process's mnt_ns - but the vfsmount's mnt_ns isn't set
> until one attempts to actually mount it into the namespace.

*shrug*

Turn those checks into
error = -EINVAL;
/* mountpoint should be ours */
if (!check_mnt(p))
goto out1;
/* and the thing moved should be either ours or completely unattached */
if (old->mnt_ns && !check_mnt(old))
goto out1;