Re: [PATCH 01/11] VFS: introduce vfs_mkdir_return()

From: Al Viro
Date: Mon Dec 23 2024 - 00:04:34 EST


On Fri, Dec 20, 2024 at 01:54:19PM +1100, NeilBrown wrote:
> + error = dir->i_op->mkdir(idmap, dir, dentry, mode);
> + if (!error) {
> + fsnotify_mkdir(dir, dentry);
> + if (unlikely(d_unhashed(dentry))) {
> + struct dentry *d;
> + d = lookup_dcache((const struct qstr *)&dentry->d_name,
> + dentry->d_parent, 0);
> + if (IS_ERR(d)) {
> + error = PTR_ERR(d);
> + } else if (unlikely(d_is_negative(d))) {


... which will instantly oops if there's no cached dentry with
such name and parent. lookup_dcache() is pure dcache lookup;
it does *NOT* call ->lookup() on miss - just returns NULL.