Exportfs / kernel NFS server dentry question (2.6.9 kernel)




I'm trying to understand some code in exportfs. The particular code is
in find_exported_dentry. Here is some pseudocode from
find_exported_dentry. I've stripped out the error-checking code and
included invariants that describe what I believe is going on.

INPUT: struct dentry *pd

/* struct dentry *pd is a disconnected dentry that we want to connect.
it was
* probably created with d_alloc_anon. Note that IS_ROOT(pd) is TRUE.
*/

/* call export ops to get parent of pd */
ppd = CALL(nops, get_parent)(pd);

/* call export ops to get name of pd */
CALL(nops, get_parent)(ppd, nbuf, pd)

/* perform a lookup using the name we received. We know that pd is a
child
* of ppd, and we know that pd's name is 'nbuf', so the lookup should
succeed
* and return us a non-anonymous dentry.
*/
npd = lookup_one_len(nbuf, ppd, strlen(nbuf));

/* In my test run, pd != ndp. This is because pd is an anonymous dentry
and npd is
* a non-anonymous one, containing a name. Code comments say this is
alright.
*/

if (IS_ROOT(pd)) {
/* something went wrong, we have to give up */
break;
}

The function is failing for me on that last IS_ROOT check in the if
statement. What I'm confused about is when was pd supposed to have gone
from unconnected to connected? In my test runs, npd is connected but pd
is not. They both have the same inode number.

Thanks,
Scott

.



Relevant Pages

  • Re: autofs4 looks up wrong path element when ghosting is enabled
    ... It's the return from the following lookup. ... > raven> (always return a negative dentry) that was there before I started ... > raven> So to resolve this we need to ignore negative and unhashed dentries ... > raven> Please test this patch and let me know how you go. ...
    (Linux-Kernel)
  • [PATCH 08/24] ceph: directory operations
    ... Directory operations, including lookup, are defined here. ... update after an MDS failure recovery), ... We normally prepopulate the dcache and icache with readdir results. ... * or dentry operations. ...
    (Linux-Kernel)
  • Re: autofs4 looks up wrong path element when ghosting is enabled
    ... It's the return from the following lookup. ... > raven> (always return a negative dentry) that was there before I started ... > raven> Please test this patch and let me know how you go. ... My only concern is the potential for regressions. ...
    (Linux-Kernel)
  • [PATCH 07/21] ceph: directory operations
    ... Directory operations, including lookup, are defined here. ... update after an MDS failure recovery), ... We normally prepopulate the dcache and icache with readdir results. ... * or dentry operations. ...
    (Linux-Kernel)
  • [PATCH 06/19] ceph: directory operations
    ... Directory operations, including lookup, are defined here. ... update after an MDS failure recovery), ... We normally prepopulate the dcache and icache with readdir results. ... * or dentry operations. ...
    (Linux-Kernel)