From owner-freebsd-hackers  Sun Mar 10 13:54:24 2002
Delivered-To: freebsd-hackers@freebsd.org
Received: from dastardly.newsbastards.org.72.27.172.IN-addr.ARPA.NetScum.dyndns.dk (pop-ls-10-3-dialup-2.freesurf.ch [194.230.238.2])
	by hub.freebsd.org (Postfix) with ESMTP id 6B88137B400
	for <hackers@freebsd.org>; Sun, 10 Mar 2002 13:53:37 -0800 (PST)
Received: from beerswilling.netscum.dyndns.dk (dcf77-zeit.netscum.dyndns.dk [172.27.72.27] (may be forged))
	by dastardly.newsbastards.org.72.27.172.IN-addr.ARPA.NetScum.dyndns.dk (8.11.6/8.11.6) with ESMTP id g2ALlE500250
	(using TLSv1/SSLv3 with cipher EDH-RSA-DES-CBC3-SHA (168 bits) verified FAIL);
	Sun, 10 Mar 2002 22:47:15 +0100 (CET)
	(envelope-from bounce@netscum.dyndns.dk)
Received: (from root@localhost)
	by beerswilling.netscum.dyndns.dk (8.11.6/8.11.6) id g2ALlDw00249;
	Sun, 10 Mar 2002 22:47:13 +0100 (CET)
	(envelope-from bounce@netscum.dyndns.dk)
Date: Sun, 10 Mar 2002 22:47:13 +0100 (CET)
Message-Id: <200203102147.g2ALlDw00249@beerswilling.netscum.dyndns.dk>
From: BOUWSMA Beery <freebsd-user@dcf77-zeit.netscum.dyndns.dk>
Subject: Re: unionfs and getcwd problem.
To: Takanori Watanabe <takawata@shidahara1.planet.sci.kobe-u.ac.jp>
Cc: "Vladimir B. " Grebenschikov <vova@express.ru>,
	hackers@freebsd.org
References: <200202251435.XAA91094@shidahara1.planet.sci.kobe-u.ac.jp> <1015415443.3157.2.camel@vbook.express.ru>
Organization: Men not wearing any pants that dont shave
X-Hacked: via telnet to your port 25, what else?
X-Internet-Access-Provided-By: Slow Dial-in Modem
X-NetScum: Yes
X-One-And-Only-Real-True-Fluffy: No
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
List-ID: <freebsd-hackers.FreeBSD.ORG>
List-Archive: <http://docs.freebsd.org/mail/> (Web Archive)
List-Help: <mailto:majordomo@FreeBSD.ORG?subject=help> (List Instructions)
List-Subscribe: <mailto:majordomo@FreeBSD.ORG?subject=subscribe%20freebsd-hackers>
List-Unsubscribe: <mailto:majordomo@FreeBSD.ORG?subject=unsubscribe%20freebsd-hackers>
X-Loop: FreeBSD.ORG

[replies sent directly to me may timeout and bounce, since I'm not
 online as often as I should be, but I'll check the list archives]

Moin, moin!
%s wrote on %.3s, %lld Sep 1993

> 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/ .
[...]
> > so it failed to recognize mount point. So I tried the patch as
> > follows taken from nullfs. Are there any problem with this patch?

Thanks!  I'm pleased to report that I applied your patch to my
-stable source, and now I'm able to `make buildworld' with my
rw unionfs mount of my local hacks, atop a ro nullfs mount with
unaltered source, which I'm doing right now.

The only obvious `problem' is when a non-r00t user attempts to
access the union-mounted fs when the shadow directories have not
yet been created, and `permission denied' is returned for all
directories that exist below, but not in the unionfs fs.  E.g.:
| bash-2.05a$ ls -l /usr/src/sys/boot/
| ls: alpha: Permission denied
| ls: arc: Permission denied
| ls: forth: Permission denied
| ls: pc98: Permission denied
| total 20
| -rw-r--r--   1 root  wheel    516 Nov 15  1999 Makefile
| -rw-r--r--   1 root  wheel  11542 Jul  7  2000 README
| drwxr-xr-x   4 root  wheel    512 Mar  9 17:15 common
[...]


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

> +       if ((error == 0 || error == ENOENT) && saveflags & MAKEENTRY &&
> cnp->cn_nameiop != CREATE) {

This apparently doesn't want to work for -stable, with `saveflags'
causing a problem.  Once I finish my -stable build, I'll see how
this changes the behaviour in -current.  Thanks!

-*-
Hmmm, it has the same `saveflags' problem with my -current (from a few
days ago).  Also, the first patch above, which worked well for me in
-stable, also seems to work for the getcwd() problem (csh, make) in
-current, but two minor problems remain --
* non-r00t users get errors as in -stable for missing directories
  ls: share: Permission denied
  ls: tools: Permission denied
  ls: usr.bin: Permission denied
* existing directories show up twice in -current (not a problem
with -stable) with `ls -li' here:
   41032 drwxr-xr-x   53 root  wheel    512 Mar 10 22:22 sys
   41032 drwxr-xr-x   53 root  wheel    512 Mar 10 22:22 sys
   41029 drwxr-xr-x  164 root  wheel    512 Dec 27 03:10 usr.sbin
   41029 drwxr-xr-x  164 root  wheel    512 Dec 27 03:10 usr.sbin
(heh, I haven't checked to see how identical files in both layers
are handled)
Also, this is a unionfs mount atop a nullfs mount within the same
filesystem, /usr, /usr/local/system/src nullfs atop /usr/src, with
/usr/local/source-hacks unionfs atop the nullfs /usr/src, if it matters.


thanks,
barry bouwsma


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message