]> git.baikalelectronics.ru Git - kernel.git/commit
fs: improve remount,ro vs buffercache coherency
authorNick Piggin <npiggin@suse.de>
Tue, 22 Dec 2009 00:28:53 +0000 (16:28 -0800)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 3 Mar 2010 18:00:20 +0000 (13:00 -0500)
commitb3096d7fd0ba48245521850f16e7ab91ce654214
tree8589a1f440a261008addb1ed97b75208eb37a6f1
parent02076fc079334e3bf5894a34b091a552c12fb3b1
fs: improve remount,ro vs buffercache coherency

Invalidate sb->s_bdev on remount,ro.

Fixes a problem reported by Jorge Boncompte who is seeing corruption
trying to snapshot a minix filesystem image.  Some filesystems modify
their metadata via a path other than the bdev buffer cache (eg.  they may
use a private linear mapping for their metadata, or implement directories
in pagecache, etc).  Also, file data modifications usually go to the bdev
via their own mappings.

These updates are not coherent with buffercache IO (eg.  via /dev/bdev)
and never have been.  However there could be a reasonable expectation that
after a mount -oremount,ro operation then the buffercache should
subsequently be coherent with previous filesystem modifications.

So invalidate the bdev mappings on a remount,ro operation to provide a
coherency point.

The problem was exposed when we switched the old rd to brd because old rd
didn't really function like a normal block device and updates to rd via
mappings other than the buffercache would still end up going into its
buffercache.  But the same problem has always affected other "normal"
block devices, including loop.

[akpm@linux-foundation.org: repair comment layout]
Reported-by: "Jorge Boncompte [DTI2]" <jorge@dti2.net>
Tested-by: "Jorge Boncompte [DTI2]" <jorge@dti2.net>
Signed-off-by: Nick Piggin <npiggin@suse.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/super.c