Re: Eureka! (was Re: UTF-8 and case-insensitivity)

From: Linus Torvalds
Date: Thu Feb 19 2004 - 16:47:22 EST




On Thu, 19 Feb 2004, Linus Torvalds wrote:
>
> See? Nobody actually ever sees the "raw dentry". They all go through
> __d_lookup(), and the rule would be:
>
> - if "d_lookup()" sees a tentative dentry, it will just unhash it and
> drop it (it has the dcache lock, so it can do that)
> - all callers of "__d_lookup()" will have to check for D_TENTATIVE, and
> decide what to do with it. I think there are exactly _three_ callers,
> and one of them is d_lookup() itself.

Actually, I've got a better setup: instead of having a D_TENTATIVE flag in
the dentry flags, just do

#define TENTATIVE_INODE ((struct inode *) 1)

and just have "dentry->d_inode = TENTATIVE_INODE" for the dentries that
were filled directly from "readdir()" data.

This not only avoids using a bit in the dentry flags, but it pretty much
guarantees that everybody is forced to use them correctly. It would be
very hard to have a buggy user: the dentry will clearly not be a negative
dentry (since d_inode is not NULL), but if anybody ever uses it as a
positive dentry, you'll get a nice and immediate oops.

So we'd see very quickly if these tentative dentries were to escape
outside of __d_lookup().

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/