Re: question for VFS/dcache experts.

Alexander Viro (viro@math.psu.edu)
Mon, 25 Oct 1999 05:08:19 -0400 (EDT)


On Mon, 25 Oct 1999, Tigran Aivazian wrote:

> typo corrected!
>
> On Mon, 25 Oct 1999, Tigran Aivazian wrote:
> > Does the lookup() method for a filesystem need to add negative dentry for
> > the case when filename is too long or should it d_add() a negative dentry
> > (inode=NULL).
>
> I meant "... or should it just return ERR_PTR(ENAMETOOLONG)".

ERR_PTR(-ENAMETOOLONG), that is. Difference between d_add(dentry, NULL)
and returning an error is that the latter will make namei immediately drop
dentry. So static tests (e.g. name length) should be served that way. Then
other methods will never see the dentry. d_add(dentry, NULL) is for
dentries that _may_ become positive in future. You can use it for static
checks too, but then you'll need to check length in ->create(),
->unlink(), yodda, yodda. Easier to check it once in ->lookup() and spare
the rest of methods from rechecking.

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