From: viro@parcelfarce.linux.theplanet.co.uk Subject: Re: [long] per-mountpoint readonly Date: Thu, 29 May 2003 20:22:13 +0100 Sender: linux-fsdevel-owner@vger.kernel.org Message-ID: <20030529192213.GR14138@parcelfarce.linux.theplanet.co.uk> References: <20030529082127.GL14138@parcelfarce.linux.theplanet.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, Shaya Potter Return-path: Received: from parcelfarce.linux.theplanet.co.uk ([195.92.249.252]:63675 "EHLO www.linux.org.uk") by vger.kernel.org with ESMTP id S262524AbTE2TIz (ORCPT ); Thu, 29 May 2003 15:08:55 -0400 To: Bryan Henderson Content-Disposition: inline In-Reply-To: List-Id: linux-fsdevel.vger.kernel.org On Thu, May 29, 2003 at 09:24:00AM -0700, Bryan Henderson wrote: > > > > > >OW, that check (IS_RDONLY and (regular|directory|symlink) ==> EROFS) > >should be moved into fs/namei.c::permission(). > > permission() is the wrong place for that. I'm not saying it wouldn't work > there, but it's conceptually wrong and would make for mistakes in the > future. The EROFS failure has nothing to do with permission; it has to do > with basic capabilities of the filesystem image (or in this proposal, of > the mount). If it were a question of permission, then the identity and > authority of the user would be involved. Have you actually read past that point? It does _not_ stay in permission() - as described below. > I've already seen a case of strange programming results because some but > not all the programmers in a certain area believed that rejecting writes to > a r/o filesystem image was a question of permission. I did a create/open > of a file via a r/o mount and the open failed with EROFS, but the file got > created anyway! IOW, you have not... > I believe there is a fundamental difference between saying, "one who > accesses this file via this name can't write to it" and "one can't write to > this filesystem via this filesystem image (struct superblock). The latter > may have implications for locking in shared filesystems and for caching. > It may even be implemented in some component downstream of Linux. Both > kinds of r/o are good, though. I'd like to see both. Yes, and? In the final variant filesystem is free to reject the request for write access. And instead of having it done as a check at one point in the operation (which is vulnerable to remount races, for obvious reasons) we end with request write access / do the job / give up write access. Write access to fs - not to any given object on it; permissions checks do stay where they currently are. And yes, it doesn't belong to permission(9). Or to ->permission() (as it's currently done). It belongs in places where VFS decides that it will need to modify objects on the filesystem - before asking if it's allowed to do something to specific objects. Mixing it with permission checks for objects is, indeed, bogus.