It's enough to check that dentries match; if path->dentry is equal to m->mnt_root, superblocks will match as well. Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx> --- fs/namespace.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index 9e04133d81dd..5c4b4f25b5f8 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -3803,8 +3803,7 @@ int finish_automount(struct vfsmount *m, const struct path *path) mnt = real_mount(m); - if (m->mnt_sb == path->mnt->mnt_sb && - m->mnt_root == dentry) { + if (m->mnt_root == path->dentry) { err = -ELOOP; goto discard; } -- 2.47.2