[3.5.y.z,extended,stable] Patch "ext4: do not try to write superblock on ro remount w/o" has been added to staging queue

Submitted by Herton Ronaldo Krzesinski on Jan. 14, 2013, 8:57 p.m.


Message ID 1358197034-16983-1-git-send-email-herton.krzesinski@canonical.com
State New
Headers show

Commit Message

Herton Ronaldo Krzesinski Jan. 14, 2013, 8:57 p.m.
This is a note to let you know that I have just added a patch titled

    ext4: do not try to write superblock on ro remount w/o

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:


If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see



From d3749db7fb1267de2851c88eca4f2be1cfcd2dae Mon Sep 17 00:00:00 2001
From: Michael Tokarev <mjt@tls.msk.ru>
Date: Tue, 25 Dec 2012 14:08:16 -0500
Subject: [PATCH] ext4: do not try to write superblock on ro remount w/o

commit d096ad0f79a782935d2e06ae8fb235e8c5397775 upstream.

When a journal-less ext4 filesystem is mounted on a read-only block
device (blockdev --setro will do), each remount (for other, unrelated,
flags, like suid=>nosuid etc) results in a series of scary messages
from kernel telling about I/O errors on the device.

This is becauese of the following code ext4_remount():

       if (sbi->s_journal == NULL)
                ext4_commit_super(sb, 1);

at the end of remount procedure, which forces writing (flushing) of
a superblock regardless whenever it is dirty or not, if the filesystem
is readonly or not, and whenever the device itself is readonly or not.

We only need call ext4_commit_super when the file system had been
previously mounted read/write.

Thanks to Eric Sandeen for help in diagnosing this issue.

Signed-off-By: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
 fs/ext4/super.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


Patch hide | download patch | download mbox

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index b045207..5be2105 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4686,7 +4686,7 @@  static int ext4_remount(struct super_block *sb, int *flags, char *data)

-	if (sbi->s_journal == NULL)
+	if (sbi->s_journal == NULL && !(old_sb_flags & MS_RDONLY))
 		ext4_commit_super(sb, 1);