Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fs/namespace.c: sanitize descriptions for {__,}lookup_mnt()

Comments regarding "shadow mounts" were stale - no such thing anymore.
Document the locking requirements for __lookup_mnt().

Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 19ac8173 fc812c40

+12 -29
+12 -29
fs/namespace.c
··· 825 825 } 826 826 827 827 /** 828 - * __lookup_mnt - find first child mount 828 + * __lookup_mnt - mount hash lookup 829 829 * @mnt: parent mount 830 - * @dentry: mountpoint 830 + * @dentry: dentry of mountpoint 831 831 * 832 - * If @mnt has a child mount @c mounted @dentry find and return it. 832 + * If @mnt has a child mount @c mounted on @dentry find and return it. 833 + * Caller must either hold the spinlock component of @mount_lock or 834 + * hold rcu_read_lock(), sample the seqcount component before the call 835 + * and recheck it afterwards. 833 836 * 834 - * Note that the child mount @c need not be unique. There are cases 835 - * where shadow mounts are created. For example, during mount 836 - * propagation when a source mount @mnt whose root got overmounted by a 837 - * mount @o after path lookup but before @namespace_sem could be 838 - * acquired gets copied and propagated. So @mnt gets copied including 839 - * @o. When @mnt is propagated to a destination mount @d that already 840 - * has another mount @n mounted at the same mountpoint then the source 841 - * mount @mnt will be tucked beneath @n, i.e., @n will be mounted on 842 - * @mnt and @mnt mounted on @d. Now both @n and @o are mounted at @mnt 843 - * on @dentry. 844 - * 845 - * Return: The first child of @mnt mounted @dentry or NULL. 837 + * Return: The child of @mnt mounted on @dentry or %NULL. 846 838 */ 847 839 struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry) 848 840 { ··· 847 855 return NULL; 848 856 } 849 857 850 - /* 851 - * lookup_mnt - Return the first child mount mounted at path 858 + /** 859 + * lookup_mnt - Return the child mount mounted at given location 860 + * @path: location in the namespace 852 861 * 853 - * "First" means first mounted chronologically. If you create the 854 - * following mounts: 855 - * 856 - * mount /dev/sda1 /mnt 857 - * mount /dev/sda2 /mnt 858 - * mount /dev/sda3 /mnt 859 - * 860 - * Then lookup_mnt() on the base /mnt dentry in the root mount will 861 - * return successively the root dentry and vfsmount of /dev/sda1, then 862 - * /dev/sda2, then /dev/sda3, then NULL. 863 - * 864 - * lookup_mnt takes a reference to the found vfsmount. 862 + * Acquires and returns a new reference to mount at given location 863 + * or %NULL if nothing is mounted there. 865 864 */ 866 865 struct vfsmount *lookup_mnt(const struct path *path) 867 866 {