From owner-freebsd-fs@FreeBSD.ORG Mon Jul 4 03:44:02 2005 Return-Path: X-Original-To: freebsd-fs@freebsd.org Delivered-To: freebsd-fs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8C64A16A41C for ; Mon, 4 Jul 2005 03:44:02 +0000 (GMT) (envelope-from ups@tree.com) Received: from smtp.speedfactory.net (talon.speedfactory.net [66.23.216.215]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1EC5343D45 for ; Mon, 4 Jul 2005 03:44:01 +0000 (GMT) (envelope-from ups@tree.com) Received: (qmail 16352 invoked by uid 210); 4 Jul 2005 03:44:14 +0000 Received: from 66.23.216.49 by talon (envelope-from , uid 201) with qmail-scanner-1.25st (clamdscan: 0.85.1/965. spamassassin: 3.0.2. perlscan: 1.25st. Clear:RC:1(66.23.216.49):. Processed in 0.026023 secs); 04 Jul 2005 03:44:14 -0000 X-Qmail-Scanner-Mail-From: ups@tree.com via talon X-Qmail-Scanner: 1.25st (Clear:RC:1(66.23.216.49):. Processed in 0.026023 secs Process 16346) Received: from 66-23-216-49.clients.speedfactory.net (HELO palm.tree.com) (66.23.216.49) by smtp.speedfactory.net with AES256-SHA encrypted SMTP; 4 Jul 2005 03:44:14 +0000 Received: from [127.0.0.1] (ups@localhost.tree.com [127.0.0.1]) by palm.tree.com (8.12.10/8.12.10) with ESMTP id j643hqLl045294; Sun, 3 Jul 2005 23:43:56 -0400 (EDT) (envelope-from ups@tree.com) From: Stephan Uphoff To: Bruce Evans In-Reply-To: <20050704110149.R59115@delplex.bde.org> References: <20050703181616.GC89744@cvs.freesbie.org> <42C83643.4010506@samsco.org> <20050703201621.GD89744@cvs.freesbie.org> <1120425831.77984.37993.camel@palm> <42C87CAE.7080802@samsco.org> <1120436351.77984.38195.camel@palm> <42C88121.8010602@samsco.org> <1120437780.77984.38252.camel@palm> <20050704110149.R59115@delplex.bde.org> Content-Type: text/plain Message-Id: <1120448632.77984.38686.camel@palm> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Sun, 03 Jul 2005 23:43:52 -0400 Content-Transfer-Encoding: 7bit Cc: freebsd-fs@freebsd.org Subject: Re: [saturnero@freesbie.org: Weird behaviour of mount_unionfs with executables] 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, 04 Jul 2005 03:44:02 -0000 Hi Bruce, On Sun, 2005-07-03 at 21:28, Bruce Evans wrote: > On Sun, 3 Jul 2005, Stephan Uphoff wrote: > > >>> The kernel calls VOP_SETATTR to set the access time of the file. > >>> union_fs detects that it does not have an upper layer copy of the file > >>> to modify the attributes on and decides to copy it. > > It copies the file before calling VOP_SETATTR(), so it copies the file > even when VOP_SETATTR() is null or fails. Sorry for the confusion. I was referring to the call from do_execve. I agree that the union_fs setattr implementation reacts in the way you described. > Null setattr's are quite > common for VA_EXECVE_ATIME since many file systems don't support this, > but ffs supports it. unionfs is one of the file systems that doesn't > support it. It is probably correct for it to let the underlying > file system decide, but this gives a bug in its read-onlyness check: > the check doesn't include VA_EXECVE_ATIME, so on exec it makes a useless > copy even for ffs in the case that the underlying file system is mounted > read-only. The check is missing much more than that. For ffs, I think > the only other EROFS error is for the birthtime but there is no way to > request setting only the birthtime, but there are lots of similar errors > involving immutable files and snapshots (these return EPERM). > > >> Ok, so this is just a limitation of unionfs, not the vnode pager. You > >> had me scared that we'd be doing a whole lot of needless disk i/o. > > > > YES - and it looks like just specifying noatime for the union mount > > should fix the copy problem for FreeSBIE. > > Most file systems bogusly silently ignore mount options that they don't > understand, and unionfs's handling of noatime is no exception. It looks like the option is added to the mnt_flag field of the mount point in vfs_domount. While union_fs ignores the option do_execve does not even call setattr if either the MNT_NOATIME or MNT_RDONLY bit is set in the mnt_flag of the filesystem of the vnode. This should be easy to try out - but my test system is currently busy with RELENG_5. I am not saying that this is the right thing to do and I agree that the bugs you mentioned above are real - but unless someone(TM) steps in and fixes these problems in union_fs this could be a quick workaround for freesbie (again - if it works). > I think noatime and most other mount options shouldn't apply to unionfs anyway -- > the underlying file system should decide. Otherwise the behaviour > depends too much on the pathname used to access a file. I think it is important that the behaviour is the same before and after the copy to the upper fs. However I don't see why accessing a file though both union_fs and directly to the upper/lower file system should not result in different behaviours. This being said I will be neither using nor fixing union_fs in the near future (at least I hope so) so this is just my current opinion and nothing more :-) Stephan