From patchwork Tue Dec 25 19:09:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 208116 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D80292C00AE for ; Wed, 26 Dec 2012 06:09:57 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754112Ab2LYTJy (ORCPT ); Tue, 25 Dec 2012 14:09:54 -0500 Received: from li9-11.members.linode.com ([67.18.176.11]:40306 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754082Ab2LYTJy (ORCPT ); Tue, 25 Dec 2012 14:09:54 -0500 Received: from root (helo=closure.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.80) (envelope-from ) id 1TnZss-00037T-QD; Tue, 25 Dec 2012 19:09:51 +0000 Received: by closure.thunk.org (Postfix, from userid 15806) id 9D0622436FB; Tue, 25 Dec 2012 14:09:47 -0500 (EST) Date: Tue, 25 Dec 2012 14:09:47 -0500 From: Theodore Ts'o To: Michael Tokarev Cc: Eric Sandeen , linux-ext4@vger.kernel.org Subject: Re: [PATCH] ext4: do not try to write superblock on journal-less readonly remount Message-ID: <20121225190947.GA16669@thunk.org> References: <1351154397-14743-1-git-send-email-mjt@msgid.tls.msk.ru> <50D025FE.5040201@msgid.tls.msk.ru> <50D089A2.8030809@redhat.com> <50D2D959.9060300@msgid.tls.msk.ru> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <50D2D959.9060300@msgid.tls.msk.ru> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org OK, I'll take this; I'm going to take your suggestion and only call ext4_commit_super() when we are going from a read-write to read-only mount, since that's the only time when we need to force that the superblock be written out. - Ted commit 86fffe43a74af16e306896eba8210bebd33bfd1f Author: Michael Tokarev Date: Tue Dec 25 14:08:16 2012 -0500 ext4: do not try to write superblock on ro remount w/o journal 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. Cc: stable@vger.kernel.org Signed-off-By: Michael Tokarev Signed-off-by: "Theodore Ts'o" --- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 4969167..183ae34 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4729,7 +4729,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) } ext4_setup_system_zone(sb); - if (sbi->s_journal == NULL) + if (sbi->s_journal == NULL && !(old_sb_flags & MS_RDONLY)) ext4_commit_super(sb, 1); #ifdef CONFIG_QUOTA