On Mon, 2002-02-25 at 17:35, Takanori Watanabe wrote:
> Hi, I had trouble with unionfs when it calles getcwd(3) when 
> I mount some directory on the directry in same file system,like
> mount -t union /usr/home/foo/bar /usr/src/sys/ .
> 
> I investigate the problem by inserting debug print in getcwd.c.
> Then I found issuing __getcwd(2) in getcwd(3) failed, and
> climb up filesystem tree as the next way. But it failed when
> it reaches to mount point. It seems that st_dev and st_ino
> member returns the same number as the underlying filesystem 
> so it failed to recognize mount point. So I tried the patch as
> follows taken from nullfs. Are there any problem with this patch?


patch below will turn on caching on unionfs, and solve getcwd problem,
patch against -CURRENT

--- /usr/src/sys/fs/unionfs/union_vnops.c       Sat Feb 23 13:54:45 2002
+++ union_vnops.c       Wed Mar  6 14:44:59 2002
@@ -561,6 +561,9 @@
         */
 
 out:
+       if ((error == 0 || error == ENOENT) && saveflags & MAKEENTRY &&
cnp->cn_nameiop != CREATE) {
+               cache_enter(dvp, *ap->a_vpp, cnp);
+       }
        if (upperdvp) {
                if (upperdvp == uppervp || upperdvp == *ap->a_vpp)
                        vrele(upperdvp);
@@ -1931,7 +1934,8 @@
        { &vop_lease_desc,              (vop_t *) union_lease },
        { &vop_link_desc,               (vop_t *) union_link },
        { &vop_lock_desc,               (vop_t *) union_lock },
-       { &vop_lookup_desc,             (vop_t *) union_lookup },
+       { &vop_cachedlookup_desc,       (vop_t *) union_lookup },
+       { &vop_lookup_desc,             (vop_t *) vfs_cache_lookup },
        { &vop_mkdir_desc,              (vop_t *) union_mkdir },
        { &vop_mknod_desc,              (vop_t *) union_mknod },
        { &vop_open_desc,               (vop_t *) union_open 

> Takanori Watanabe

-- 
TSB "Russian Express", Moscow
Vladimir B. Grebenschikov, [EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to