vfs: add path_is_mountpoint() helper

d_mountpoint() can only be used reliably to establish if a dentry is
not mounted in any namespace. It isn't aware of the possibility there
may be multiple mounts using a given dentry that may be in a different
namespace.

Add helper functions, path_is_mountpoint(), that checks if a struct path
is a mountpoint for this case.

Link: http://lkml.kernel.org/r/20161011053358.27645.9729.stgit@pluto.themaw.net
Signed-off-by: Ian Kent <raven@themaw.net>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Omar Sandoval <osandov@osandov.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Ian Kent
2016-11-24 08:03:41 +11:00
committed by Al Viro
parent fb5f51c742
commit c6609c0a1c
3 changed files with 37 additions and 0 deletions

View File

@@ -98,4 +98,6 @@ extern dev_t name_to_dev_t(const char *name);
extern unsigned int sysctl_mount_max;
extern bool path_is_mountpoint(const struct path *path);
#endif /* _LINUX_MOUNT_H */