From owner-freebsd-fs Sun Jun 23 3:23: 5 2002 Delivered-To: freebsd-fs@freebsd.org Received: from postfix1-2.free.fr (postfix1-2.free.fr [213.228.0.130]) by hub.freebsd.org (Postfix) with ESMTP id 835AA37B404 for ; Sun, 23 Jun 2002 03:22:53 -0700 (PDT) Received: from anphor (montpellier-1-a7-62-147-83-252.dial.proxad.net [62.147.83.252]) by postfix1-2.free.fr (Postfix) with SMTP id F1F60AB664 for ; Sun, 23 Jun 2002 12:22:50 +0200 (CEST) From: "Patrick Bihan-Faou" To: Subject: Strange behavior of 'union' mounted filesystems Date: Sun, 23 Jun 2002 12:22:43 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <1577698468.20020623150139@e-complex.ru> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Sender: owner-freebsd-fs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hi, While playing with FS options, I came accross something that looks suspicious to me while using the 'union' mount option (not the UNIONFS): Here is what I have in my /etc/fstab: /dev/ad0s1a / ufs rw,suiddir,groupquota 0 1 /dev/ad0s1b none swap sw 0 0 /dev/ad0s1e /var ufs rw 0 2 /dev/ad0s1f /data ufs rq,suiddir,groupquota 0 3 /dev/ad0s1b /tmp_mfs mfs rw,-s65536,union,noauto 0 3 proc /proc procfs rw 0 0 Now initially, after booting, I have: bash-2.04# mount /dev/ad0s1a on / (ufs, local, with quotas, suiddir) /dev/ad0s1e on /var (ufs, local) /dev/ad0s1f on /data (ufs, local, with quotas, suiddir, soft-updates) procfs on /proc (procfs, local) If I put a file in /tmp_mfs at this stage everything is OK, and when I mount the /tmp_mfs filesystem, everything works as expected: I can see the existing file(s), etc. My problem is when I put a flag on the files in /tmp_mfs *BEFORE* mounting the /tmp_mfs FS: bash-2.04# ls /tmp_mfs/ bash-2.04# echo "test" > /tmp_mfs/test bash-2.04# chflags schg /tmp_mfs/test bash-2.04# ls -lio /tmp_mfs/ total 1 10678 -rw-r--r-- 1 root wheel schg 5 Jun 23 11:53 test bash-2.04# And then I mount the filesystem: bash-2.04# cat /tmp_mfs/test test bash-2.04# mount /tmp_mfs Warning: Block size restricts cylinders per group to 23. bash-2.04# mount /dev/ad0s1a on / (ufs, local, with quotas, suiddir) /dev/ad0s1e on /var (ufs, local) /dev/ad0s1f on /data (ufs, local, with quotas, suiddir, soft-updates) procfs on /proc (procfs, local) mfs:38280 on /tmp_mfs (mfs, asynchronous, local, union) bash-2.04# ls -lio /tmp_mfs total 1 10678 -rw-r--r-- 1 root wheel schg 5 Jun 23 11:53 test bash-2.04# cat /tmp_mfs/test test bash-2.04# echo "bad" > /tmp_mfs/test bash-2.04# cat /tmp_mfs/test bad bash-2.04# ls -lio /tmp_mfs total 1 3 -rw-r--r-- 1 root wheel - 4 Jun 23 11:56 test As you can see the 'schg' flag on the underlying flag is not checked if the file is open for writing. It is however checked in case I try to delete the file: bash-2.04# rm /tmp_mfs/test # get rid of the overriding file bash-2.04# rm /tmp_mfs/test # get rid of the underlying file override rw-r--r-- root/wheel schg for /tmp_mfs/test? y rm: /tmp_mfs/test: Operation not permitted Now, this to me seems like a bug, but it could very well be due to my lack of understanding of how union mounted filesystems work. If the file exists in the underlying FS, shouldn't the permissions and flags be honored before a 'create' is attempted in the 'upper' FS ? This clearly does not look like it is the case currently. These tests were done on a FreeBSD-stable system: FreeBSD kawa.local.mindstep.com 4.4-STABLE FreeBSD 4.4-STABLE #0: Fri Jan 25 02:59:41 CET 2002 root@kawa.local.mindstep.com:/data/users/patrick/build/25.4/tmpobj/data/user s/patrick/build/25.4/freebsd-src/sys/ZUNOBOX_DEV i386 If somebody can enlighten me, it would really be appreciated. Patrick. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-fs" in the body of the message