From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 27 22:21:48 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C965958C for ; Wed, 27 Feb 2013 22:21:48 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 6CC69703 for ; Wed, 27 Feb 2013 22:21:48 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.6/8.14.6) with ESMTP id r1RMLiOj096638; Thu, 28 Feb 2013 00:21:44 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.0 kib.kiev.ua r1RMLiOj096638 Received: (from kostik@localhost) by tom.home (8.14.6/8.14.6/Submit) id r1RMLi3e096637; Thu, 28 Feb 2013 00:21:44 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 28 Feb 2013 00:21:44 +0200 From: Konstantin Belousov To: Jilles Tjoelker Subject: Re: [patch] statfs does not detect -t nullfs -o union as a union mount Message-ID: <20130227222144.GG2454@kib.kiev.ua> References: <20130227213141.GA18210@stack.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="6DRyk0WLoccTprpY" Content-Disposition: inline In-Reply-To: <20130227213141.GA18210@stack.nl> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Feb 2013 22:21:48 -0000 --6DRyk0WLoccTprpY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 27, 2013 at 10:31:42PM +0100, Jilles Tjoelker wrote: > While testing recent changes to opendir(), I noticed that fstatfs() does > not return the MNT_UNION flag for a -t nullfs -o union mount. As a > result, opendir()/readdir() return files that exist in both top and > bottom directories twice (at least . and ..). Other -o union mounts and > -t unionfs mounts work correctly in this regard. >=20 > The below patch passes through just the MNT_UNION flag of the nullfs > mount itself. Perhaps more flags should be passed through. >=20 > commit fce32a779af4eb977c9b96feb6e4f811d89f2881 > Author: Jilles Tjoelker > Date: Sat Feb 23 22:22:39 2013 +0100 >=20 > nullfs: Preserve the MNT_UNION flag of the nullfs mount itself. > =20 > This is needed so that opendir() can properly detect a union mount li= ke > mount -t nullfs -o union dir1 dir2. >=20 > diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c > index 3724e0a..ff06f57 100644 > --- a/sys/fs/nullfs/null_vfsops.c > +++ b/sys/fs/nullfs/null_vfsops.c > @@ -313,7 +313,7 @@ nullfs_statfs(mp, sbp) > =20 > /* now copy across the "interesting" information and fake the rest */ > sbp->f_type =3D mstat.f_type; > - sbp->f_flags =3D mstat.f_flags; > + sbp->f_flags =3D (sbp->f_flags & MNT_UNION) | mstat.f_flags; > sbp->f_bsize =3D mstat.f_bsize; > sbp->f_iosize =3D mstat.f_iosize; > sbp->f_blocks =3D mstat.f_blocks; Would it make sense to preserve more flags from the upper mount ? I see a use for MNT_NOEXEC as well, at least. --6DRyk0WLoccTprpY Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJRLob3AAoJEJDCuSvBvK1BgIAQAKDwSxbw59Wuz5dnwHYm9Shs Aj8eFjdkItqRh3iU4apkyjSBt+eQh1teowtPphftGcfoUZZ8ZhLAS/a9023niRtB t/9pfe1zckgG89ZZKOO9mQP1dj9TYwILAhuDh7/W0Ly7GXVNzi0uhDc8ZET5Ickg aGd1/ALv+uEcVpdqv1IeiReUTGOTXh4p4UvMLxLQj8NUuUJL62Zhg/tTGaQ8FgjD kAmC8SRbs78ZEayKi+wqh0k1Z5sNPWAsl11wLqgJfJSM7fVDQVIaaK0P4LOmkvvo i5v35SNE7EU56WulLXn/yFoBWYeS+/uxVUNhga8aW633ZP/Q+MpUErkufLkGfbfz NzZSyskWDK6MvzlFqzFJoDPnBtplrvYbbl+pYVlXTrooGwcQoWi3lEdVeaAtWAMN gcnuKxUDUonKb/alFvR6cm/YU2Q8ruF12taZvtrrsPtHZI9hPL6aSCbbkJrVN2P4 /VMWT3/Kn77Rx8GkyZOga3LoL+neDFdQwLPh1qQV+NKfR/4UXCDjRhE5vawJLxSh p2VVgj///OWrADYS03BP7h17ZtCw5RHWoBvLZ9HQ8wMTtZS74zKCuhdLP1k/IOjm jvO3QiNtlWLR0GlA1GpYy9v5VBQ2L1/Cymf/d02q8HsqXOh+nNrX5W7YhU3XqXX4 yvgapzlIY2W5sLCRpzR6 =zAH7 -----END PGP SIGNATURE----- --6DRyk0WLoccTprpY--