From owner-freebsd-fs@FreeBSD.ORG Mon Aug 11 22:08:46 2008 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 235521065672 for ; Mon, 11 Aug 2008 22:08:46 +0000 (UTC) (envelope-from nejc@skoberne.net) Received: from delusion.skoberne.net (lk.84.20.249.154.dc.cable.static.lj-kabel.net [84.20.249.154]) by mx1.freebsd.org (Postfix) with ESMTP id CC89B8FC08 for ; Mon, 11 Aug 2008 22:08:45 +0000 (UTC) (envelope-from nejc@skoberne.net) Received: from localhost (localhost [127.0.0.1]) by delusion.skoberne.net (Postfix) with ESMTP id DC4A022884; Tue, 12 Aug 2008 00:02:16 +0200 (CEST) Received: from delusion.skoberne.net ([127.0.0.1]) by localhost (delusion.skoberne.net [127.0.0.1]) (amavisd-maia, port 10024) with ESMTP id 39035-07; Tue, 12 Aug 2008 00:02:13 +0200 (CEST) Received: from [192.168.15.2] (simian.skoberne.local [192.168.15.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: nejkopejko@skoberne.net) by delusion.skoberne.net (Postfix) with ESMTP id B268722883; Tue, 12 Aug 2008 00:02:13 +0200 (CEST) Message-ID: <48A0B6E5.3000000@skoberne.net> Date: Tue, 12 Aug 2008 00:02:13 +0200 From: =?ISO-8859-2?Q?Nejc_=A9koberne?= User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: freebsd-fs@freebsd.org X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard Cc: Mitar , Weiss Subject: fchroot on unionfs X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2008 22:08:46 -0000 Hi, I have a strange problem with Apache not seeing the lower layer of unionfs. Using ktrace on Apache I have written this C code: #include #include #include #include int main() { int fd; char buf[512]; /* This is what apache does */ fd=open(".",O_RDONLY,0); fchdir(fd); close(fd); /* This is how Apache calls open */ fd=open("/etc/hosts",O_RDONLY,0x1b6); if(fd < 0) { printf("error %d,%d\n",fd,errno); perror(NULL); exit(-1); } read(fd, buf, 511); buf[511]=0; printf("%s",buf); close(fd); return(0); } So without fchdir() call this program just displays (first 511 bytes) of /etc/hosts. If I uncomment fchdir() call with precedent open(".",...) call, I get this: root@web:~# ./a No such file or directory error -1,2 and also if I list the /etc directory with a php script, I see only those files in /etc which are on the upper layer of unionfs. I stumbled upon this problem while trying to figure out why apache can't resolve hostnames I have defined in /etc/hosts. I have this: FreeBSD web.jail 7.0-STABLE FreeBSD 7.0-STABLE #5: Sun Aug 10 09:54:42 CEST 2008 root@server.domain.com:/usr/src/sys/amd64/compile/SERVER amd64 So I am running a jail on a unionfs. Everything works now (after MFCing the unix sockets patch from HEAD to the 7-STABLE (MySQL didn't work)), so I currently have only this problem. I also tried to grep the Apache source code for fchdir, but the call seems to be made implicitely somehow (grep returned no matches). Thanks, Nejc