From owner-freebsd-hackers Wed Mar 6 3:50:57 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from vbook.express.ru (asplinux.ru [195.133.213.194]) by hub.freebsd.org (Postfix) with ESMTP id E267E37B400 for ; Wed, 6 Mar 2002 03:50:52 -0800 (PST) Received: from localhost ([127.0.0.1]) by vbook.express.ru with esmtp (Exim 3.33 #1) id 16iZwR-0000qn-00; Wed, 06 Mar 2002 14:50:43 +0300 Subject: Re: unionfs and getcwd problem. From: "Vladimir B. " Grebenschikov To: Takanori Watanabe Cc: hackers@freebsd.org In-Reply-To: <200202251435.XAA91094@shidahara1.planet.sci.kobe-u.ac.jp> References: <200202251435.XAA91094@shidahara1.planet.sci.kobe-u.ac.jp> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Evolution/1.0.2 Date: 06 Mar 2002 14:50:43 +0300 Message-Id: <1015415443.3157.2.camel@vbook.express.ru> Mime-Version: 1.0 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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, vova@express.ru To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message