From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Brauner Subject: [PATCH 1/7] namespace: fix clone_private_mount() kernel doc Date: Wed, 14 Apr 2021 14:37:45 +0200 Message-ID: <20210414123750.2110159-2-brauner@kernel.org> References: <20210414123750.2110159-1-brauner@kernel.org> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Return-path: Received: from mail.kernel.org ([198.145.29.99]:33808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231415AbhDNMi7 (ORCPT ); Wed, 14 Apr 2021 08:38:59 -0400 In-Reply-To: <20210414123750.2110159-1-brauner@kernel.org> List-ID: Content-Type: text/plain; charset="us-ascii" To: linux-fsdevel@vger.kernel.org Cc: Amir Goldstein , Christoph Hellwig , Tyler Hicks , David Howells , Miklos Szeredi , Al Viro , ecryptfs@vger.kernel.org, linux-cachefs@redhat.com, Christian Brauner From: Christian Brauner Extend the kernel documentation for clone_private_mount(). Add some more detailed info about its usage and convert it into proper kernel doc. Cc: Amir Goldstein Cc: Christoph Hellwig Cc: Miklos Szeredi Cc: Al Viro Cc: linux-fsdevel@vger.kernel.org Signed-off-by: Christian Brauner --- fs/namespace.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index 56bb5a5fdc0d..02f415061efe 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1939,12 +1939,21 @@ void drop_collected_mounts(struct vfsmount *mnt) /** * clone_private_mount - create a private clone of a path + * @path: path from which the mnt to clone will be taken * - * This creates a new vfsmount, which will be the clone of @path. The new will - * not be attached anywhere in the namespace and will be private (i.e. changes - * to the originating mount won't be propagated into this). + * This creates a new vfsmount, which will be a clone of @path's vfsmount. * - * Release with mntput(). + * In contrast to mnt_clone_internal() the new mount will not be marked + * MNT_INTERNAL but will have MNT_NS_INTERNAL attached as its mount namespace + * making it suitable for long-term mounts since mntput()ing it will always hit + * the fastpath as long as kern_unmount() hasn't been called. + * + * Since the mount is not reachable anwyhere mount properties and propagation + * properties remain stable, i.e. cannot change. + * + * Useable with mntget()/mntput() but needs to be released with kern_unmount(). + * + * Return: A clone of @path's vfsmount on success, an error pointer on failure. */ struct vfsmount *clone_private_mount(const struct path *path) { -- 2.27.0