From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [PATCH 1/2] push MS_RDONLY check from ->write_super into caller Date: Wed, 6 May 2009 23:33:34 +0100 Message-ID: <20090506223334.GY8633@ZenIV.linux.org.uk> References: <20090506201605.GA19043@lst.de> <20090506221912.GX8633@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org To: Christoph Hellwig Return-path: Received: from zeniv.linux.org.uk ([195.92.253.2]:39693 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752975AbZEFWde (ORCPT ); Wed, 6 May 2009 18:33:34 -0400 Content-Disposition: inline In-Reply-To: <20090506221912.GX8633@ZenIV.linux.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, May 06, 2009 at 11:19:12PM +0100, Al Viro wrote: > On Wed, May 06, 2009 at 10:16:05PM +0200, Christoph Hellwig wrote: > > Add a central MS_RDONLY to sync_super instead of having it in the ->write_super > > methods (and even that not consistently). The other two callers are already > > protected: sync_filesystems has the same s_umount protected MS_RDONLY check > > and file_fsync can only be called on a writeable file descriptor. > > > > Also make sure to clear s_dirt if it was set on a read-only superblock to > > avoid calling into these filesystems again and again. > > > Index: vfs-2.6/fs/affs/super.c > > Index: vfs-2.6/fs/bfs/inode.c > > Index: vfs-2.6/fs/ext2/super.c > > Index: vfs-2.6/fs/fat/inode.c > > Index: vfs-2.6/fs/hfs/super.c > > Index: vfs-2.6/fs/hfsplus/super.c > > Index: vfs-2.6/fs/jffs2/fs.c > > Index: vfs-2.6/fs/jffs2/super.c > > Index: vfs-2.6/fs/nilfs2/super.c > > Index: vfs-2.6/fs/super.c > > Index: vfs-2.6/fs/sysv/inode.c > > Index: vfs-2.6/fs/ufs/super.c > > You've missed xfs. Added and applied (reiserfs, ext4 and exofs are also > not touched, but they don't need a change here). Eh... Actually, this is wrong as described. ->fsync() *can* be called for file opened r/o. Moreover, fs might decide to go r/o on its own. file_fsync() is not widely used, but users include affs, bfs, fat, hfs, hfsplus and ufs. No go, at least as long as file_fsync() is used for those. Patch dropped until we decide what to do with those. It shouldn't be all that hard to push file_fsync() out of existence, so it might be doable, but...