[patch] fs: add a remount,ro coherency point

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



fs: invalidate sb->s_bdev on remount,ro

Fixes a problem reported by "Jorge Boncompte [DTI2]" <jorge@xxxxxxxx>
who is trying to snapshot a minix filesystem image.

Signed-off-by: Nick Piggin <npiggin@xxxxxxx>

---
 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);
 	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);
 
 	/* If we are remounting RDONLY and current sb is read/write,
 	   make sure there are no rw files opened */
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux