From owner-freebsd-stable@FreeBSD.ORG Sun Aug 12 12:24:37 2007 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1281516A417; Sun, 12 Aug 2007 12:24:37 +0000 (UTC) (envelope-from lists@c0mplx.org) Received: from home.c0mplx.org (home.c0mplx.org [IPv6:2001:14b0:200::1]) by mx1.freebsd.org (Postfix) with ESMTP id B78BF13C478; Sun, 12 Aug 2007 12:24:36 +0000 (UTC) (envelope-from lists@c0mplx.org) Received: from pi by home.c0mplx.org with local (Exim 4.66 (FreeBSD)) (envelope-from ) id 1IKCUj-000HxY-P3; Sun, 12 Aug 2007 14:24:33 +0200 Date: Sun, 12 Aug 2007 14:24:33 +0200 From: Kurt Jaeger To: freebsd-stable@freebsd.org Message-ID: <20070812122433.GA68970@home.c0mplx.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Cc: freebsd-jail@freebsd.org, daichi@freebsd.org Subject: Patch for FreeBSD 6.2 fstat(1) to support unionfs (at least a little bit) X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Aug 2007 12:24:37 -0000 Hi! fstat(1) from FreeBSD 6.2 can not display information about files which reside in a unionfs[1], as can be seen in this example[2]: USER CMD PID FD MOUNT INUM MODE SZ|DV R/W pi less 31028 root - - ?(unionfs) - pi less 31028 wd - - ?(unionfs) - pi less 31028 jail - - ?(unionfs) - pi less 31028 text - - ?(unionfs) - pi less 31028 0 /vserv/vserv3.nepustil.net/dev 109 crw--w---- ttyp5 rw pi less 31028 1 /vserv/vserv3.nepustil.net/dev 109 crw--w---- ttyp5 rw pi less 31028 2 /vserv/vserv3.nepustil.net/dev 109 crw--w---- ttyp5 rw pi less 31028 3 /vserv/vserv3.nepustil.net/dev 109 crw--w---- ttyp5 r pi less 31028 4 - - ?(unionfs) - This patch[3] fixes it, as can be seen in this other example[4]: USER CMD PID FD MOUNT INUM MODE SZ|DV R/W pi less 31028 root /vserv/vserv3.nepustil.net 4804764 drwxrwxr-x 512 r unionupper /usr pi less 31028 wd /vserv/vserv3.nepustil.net 5042109 drwx------ 1536 r unionupper /usr pi less 31028 jail /vserv/vserv3.nepustil.net 4804764 drwxrwxr-x 512 r unionupper /usr pi less 31028 text /vserv/vserv3.nepustil.net 5159119 -r-xr-xr-x 109300 r unionlower /usr pi less 31028 0 /vserv/vserv3.nepustil.net/dev 109 crw--w---- ttyp5 rw pi less 31028 1 /vserv/vserv3.nepustil.net/dev 109 crw--w---- ttyp5 rw pi less 31028 2 /vserv/vserv3.nepustil.net/dev 109 crw--w---- ttyp5 rw pi less 31028 3 /vserv/vserv3.nepustil.net/dev 109 crw--w---- ttyp5 r pi less 31028 4 /vserv/vserv3.nepustil.net 5042526 -rw------- 702 r unionupper /usr The filesytems involved: f6# df [...] Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/ad0s1e 43938150 20634736 19788362 51% /usr [...] :/vserv/template/stage2 87876300 64572886 19788362 77% /vserv/vserv3.nepustil.net devfs 1 1 0 100% /vserv/vserv3.nepustil.net/dev [...] were mounted with the following command: /sbin/mount -t unionfs -o noatime,below,copymode=transparent /vserv/template/stage2 /vserv/vserv3.nepustil.net /sbin/mount_devfs devfs /vserv/vserv3.nepustil.net How to apply: cd /tmp/ fetch http://c0mplx.org/src/fstat-unionfs-patch/patch-20070812 cd /usr patch < /tmp/patch-20070812 cd /usr/src/usr.bin/fstat/ make install TODO: support other filesystems besides UFS as lower filesystems [1] http://people.freebsd.org/~daichi/unionfs/ [2] http://c0mplx.org/src/fstat-unionfs-patch/before [3] http://c0mplx.org/src/fstat-unionfs-patch/patch-20070812 [4] http://c0mplx.org/src/fstat-unionfs-patch/after See also: http://c0mplx.org/src/fstat-unionfs-patch/ -- pi@c0mplx.org +49 171 3101372 13 years to go !