Hi Al, On 12 Oct 2014, at 23:18, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > AFAICS, if d_add_ci() ever finds a negative hashed dentry for > exact name, it's already buggered. Because right *before* that > d_add_ci() lookup for exact name would've turned valid negative. Christoph copied d_add_ci() from code I wrote for NTFS so you can blame me for it. (-; Do you mean that given the exact name exists on disk, there cannot be a negative dentry for it in memory, i.e. there would either be no dentry in memory or it would be a positive dentry in memory? If so then that makes sense, yes. I am just wondering whether there might be error conditions in which we might end up with a (perhaps invalid) negative dentry in memory which could be found here? Probably not a problem especially now that d_invalidate() cannot fail any more. Is it worth adding a BUG_ON(!found->d_inode); to ensure sanity/catch bugs? > IOW, the whole thing ought to be > found = d_hash_and_lookup(dentry->d_parent, name); > if (found) { > iput(inode); > return found; > } > new = d_alloc(dentry->d_parent, name); > if (!new) { > iput(inode); > return ERR_PTR(-ENOMEM); > } > found = d_splice_alias(inode, new); > if (found) { > dput(new); > return found; > } > return new; > Moreover, it might very well be better to pass dentry->d_parent instead > of dentry... Objections? Yes, that bit makes perfect sense given we only ever use dentry->d_parent. Best regards, Anton -- Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @) University of Cambridge Information Services, Roger Needham Building 7 JJ Thomson Avenue, Cambridge, CB3 0RB, UK -- 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