summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Ruder <andrew.ruder@elecsyscorp.com>2014-01-30 19:26:54 +0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-01-31 23:29:36 +0400
commit807612db2f9940b9fa6deaef054eb16d51bd3e00 (patch)
treef22bc5b0debad1f1833c8d349e0dbd1b3fecd607
parent9115eac2c788c17b57c9256cb322fa7371972ddf (diff)
downloadlinux-807612db2f9940b9fa6deaef054eb16d51bd3e00.tar.xz
fs/super.c: sync ro remount after blocking writers
Move sync_filesystem() after sb_prepare_remount_readonly(). If writers sneak in anywhere from sync_filesystem() to sb_prepare_remount_readonly() it can cause inodes to be dirtied and writeback to occur well after sys_mount() has completely successfully. This was spotted by corrupted ubifs filesystems on reboot, but appears that it can cause issues with any filesystem using writeback. Cc: Artem Bityutskiy <dedekind1@gmail.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> CC: Richard Weinberger <richard@nod.at> Co-authored-by: Richard Weinberger <richard@nod.at> Signed-off-by: Andrew Ruder <andrew.ruder@elecsyscorp.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/super.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/super.c b/fs/super.c
index cecd780e0f44..80d5cf2ca765 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -703,7 +703,6 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
if (flags & MS_RDONLY)
acct_auto_close(sb);
shrink_dcache_sb(sb);
- sync_filesystem(sb);
remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY);
@@ -720,6 +719,8 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
}
}
+ sync_filesystem(sb);
+
if (sb->s_op->remount_fs) {
retval = sb->s_op->remount_fs(sb, &flags, data);
if (retval) {