On Mon, 23 Dec 2024, Al Viro wrote: > 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. > I originally had lookup_one_len() but realised that I don't really want any of lookup_one_common() so optimised - badly. Maybe I should go back to lookup_one_len(). Or maybe I can just insert if (!d) d = __lookup_slow(....->d_name, dentry->d_parent, 0); I'll look more closely and see which seems best. Thanks, NeilBrown