Re: dcache: d_compare prototype

Peter J. Braam (
Wed, 17 Dec 1997 10:45:19 -0500 (EST)

The point is the following. Coda uses ACL's. The first time a lookup
happens, the kernel contacts the cache manager, which checks the ACL using
credentials similar to Kerberos tokens. Assume permission is granted for
the lookup, then the result is given to the kernel.

To expedite future lookups, we cache the result of the lookup (previously
in our own simple namecache, now trying with the dcache). Next time
around we need to verify that the calling process possesses -- the uid,
pgrid etc we know -- has already obtained permission for the lookup.

>From your message I start to suspect that the permission operation in the
inodes will remain responsible for the check and it need not be done at
lookup time.

And indeed, in namei.c lookup_dentry first calls "permission". Thanks!
That will make things a little easier.

- Peter -

On Wed, 17 Dec 1997, Bill Hawes wrote:

> Peter J. Braam wrote:
> > Coda is starting to use the dcache. During a lookup I need to know if I
> > have credentials for an inode already, I need to use the d_compare
> > operation.
> >
> > The current prototype is:
> >
> > int coda_d_compare(struct dentry *parent,
> > struct qstr *de_name, struct qstr *name)
> >
> > Can we make it:
> >
> > int coda_d_compare(struct dentry *dentry, struct qstr *name)
> >
> > We can still get at the parent (dentry->d_parent) and at the name
> > (dentry->d_name) and I won't have to do ugly things like
> > dentry = list_entry( de_name, struct dentry *, d_name )
> Hi Peter,
> Perhaps your d_compare is trying to do too much? The original intent was
> just to do a fs-specific name compare, and the parent dentry was passed
> to allow for things like case-sensitivity on a per-directory basis.
> In the present usage you shouldn't assume that one of the qstrs is
> actually embedded in a dentry, as someone might just want to call the
> operation to compare two non-dentry qstrs.
> Could you explain a little more about what you need to do, and I may be
> able to suggest an alternative. If the code is question is in your
> lookup function, then the d_compare will already have been called to
> determine that no dentry existed with the given name. (I.e. the fs
> lookup isn't called unless we really do need a lookup.)
> Regards,
> Bill