Date: Thu, 28 Feb 2013 00:21:44 +0200 From: Konstantin Belousov <kostikbel@gmail.com> To: Jilles Tjoelker <jilles@stack.nl> Cc: freebsd-hackers@freebsd.org Subject: Re: [patch] statfs does not detect -t nullfs -o union as a union mount Message-ID: <20130227222144.GG2454@kib.kiev.ua> In-Reply-To: <20130227213141.GA18210@stack.nl> References: <20130227213141.GA18210@stack.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <jilles@stack.nl> > 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130227222144.GG2454>