> > Hmm, this may hold dcache_lock for some time. Isn't it enough to use > > rcu_readlock() and read_seqbegin(&rename_lock) ? > > Maybe. I just blindly copied the d_path() code without thinking much. > Is this worth optimizing? I mean, getting RCU wrong is easy, and it > makes my head hurt to think about it. And dcache_lock shouldn't be > used in any performance critical code paths anyway. 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; } Miklos -- 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