From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wu Fengguang Subject: Re: [patch] fs: add a remount,ro coherency point Date: Mon, 30 Mar 2009 20:55:06 +0800 Message-ID: <20090330125506.GA12098@localhost> References: <20090330113354.GC31000@wotan.suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: viro@zeniv.linux.org.uk, "Jorge Boncompte [DTI2]" , linux-fsdevel@vger.kernel.org, Andrew Morton To: Nick Piggin Return-path: Received: from mga14.intel.com ([143.182.124.37]:64247 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751133AbZC3MzU (ORCPT ); Mon, 30 Mar 2009 08:55:20 -0400 Content-Disposition: inline In-Reply-To: <20090330113354.GC31000@wotan.suse.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hi Nick, On Mon, Mar 30, 2009 at 01:33:54PM +0200, Nick Piggin wrote: > > fs: invalidate sb->s_bdev on remount,ro > > Fixes a problem reported by "Jorge Boncompte [DTI2]" > who is trying to snapshot a minix filesystem image. > > Signed-off-by: Nick Piggin > > --- > fs/super.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > Index: linux-2.6/fs/super.c > =================================================================== > --- linux-2.6.orig/fs/super.c > +++ linux-2.6/fs/super.c > @@ -647,6 +647,14 @@ int do_remount_sb(struct super_block *sb > acct_auto_close(sb); > shrink_dcache_sb(sb); Not a question to this patch: can we avoid shrink_dcache_sb() on ro=>rw remounts? They will happen at system boot time, and eliminating the shrink_dcache_sb() could help reduce the boot time. > fsync_super(sb); > + /* Some filesystems modify their metadata via some other path > + than the bdev buffer cache (eg. use a private mapping, or > + directories in pagecache, etc). Also file data modifications > + go via their own mappings. So If we try to mount readonly > + then copy the filesystem from bdev, we could get stale data, > + so invalidate it to give a best effort at coherency. */ > + if (flags & MS_RDONLY && sb->s_bdev) > + invalidate_bdev(sb->s_bdev); Or move the above lines to... > /* If we are remounting RDONLY and current sb is read/write, > make sure there are no rw files opened */ if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY)) { if (force) mark_files_ro(sb); else if (!fs_may_remount_ro(sb)) return -EBUSY; retval = vfs_dq_off(sb, 1); if (retval < 0 && retval != -ENOSYS) return -EBUSY; } ...here? Thanks, Fengguang