Most of the callers of lookup_one_len_unlocked() treat negatives are ERR_PTR(-ENOENT). Provide a helper that would do just that. Note that a pinned positive dentry remains positive - it's ->d_inode is stable, etc.; a pinned _negative_ dentry can become positive at any point as long as you are not holding its parent at least shared. So using lookup_one_len_unlocked() needs to be careful; lookup_positive_unlocked() is safer and that's what the callers end up open-coding anyway.
Showing the changes to include/linux (1 of 9 files). Show all
Unified · Split
| @@ -60,6 +60,7 @@ extern int kern_path_mountpoint(int, const char *, struct path *, unsigned int); · 59 unmodified lines | |||
| 60 | extern struct dentry *try_lookup_one_len(const char *, struct dentry *, int); | 60 | extern struct dentry *try_lookup_one_len(const char *, struct dentry *, int); |
| 61 | extern struct dentry *lookup_one_len(const char *, struct dentry *, int); | 61 | extern struct dentry *lookup_one_len(const char *, struct dentry *, int); |
| 62 | extern struct dentry *lookup_one_len_unlocked(const char *, struct dentry *, int); | 62 | extern struct dentry *lookup_one_len_unlocked(const char *, struct dentry *, int); |
| 63 | extern struct dentry *lookup_positive_unlocked(const char *, struct dentry *, int); | ||
| 63 | 64 | ||
| 64 | extern int follow_down_one(struct path *); | 65 | extern int follow_down_one(struct path *); |
| 65 | extern int follow_down(struct path *); | 66 | extern int follow_down(struct path *); |