On Thu, Mar 13, Miklos Szeredi wrote: > But I'm an idiot. This is a much simpler and faster implementation > that uses is_subdir(), which essentially does what you suggested: > > /* > * Return true if 'path' is reachable from 'root' > */ > static bool is_path_reachable(const struct path *path, const struct path *root) > { > struct dentry *dentry = path->dentry; > struct vfsmount *mnt = path->mnt; > bool res = false; > > spin_lock(&vfsmount_lock); > while (mnt != root->mnt && mnt->mnt_parent != mnt) { > dentry = mnt->mnt_mountpoint; > mnt = mnt->mnt_parent; > } > if (mnt == root->mnt && is_subdir(dentry, root->dentry)) > res = true; > spin_unlock(&vfsmount_lock); > > return res; > } Very well. BTW, I have a patch rotting in my quilt stack to remove lives_below_in_same_fs() since is_subdir() provides the same functionality. Cheers, Jan -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html