From patchwork Thu Dec 22 15:56:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kara X-Patchwork-Id: 132863 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 64A66B6FBB for ; Fri, 23 Dec 2011 02:57:32 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754586Ab1LVP5V (ORCPT ); Thu, 22 Dec 2011 10:57:21 -0500 Received: from cantor2.suse.de ([195.135.220.15]:59880 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753100Ab1LVP5S (ORCPT ); Thu, 22 Dec 2011 10:57:18 -0500 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id DF18589994 for ; Thu, 22 Dec 2011 16:57:17 +0100 (CET) Received: by quack.suse.cz (Postfix, from userid 1000) id 1B33F205D6; Thu, 22 Dec 2011 16:56:57 +0100 (CET) From: Jan Kara To: Cc: Jan Kara Subject: [PATCH] ext3: Don't warn from writepage when readonly inode is spotted after error Date: Thu, 22 Dec 2011 16:56:55 +0100 Message-Id: <1324569415-9824-1-git-send-email-jack@suse.cz> X-Mailer: git-send-email 1.7.1 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org WARN_ON_ONCE(IS_RDONLY(inode)) tends to trip when filesystem hits error and is remounted read-only. This unnecessarily scares users (well, they should be scared because of filesystem error, but the stack trace distracts them from the right source of their fear ;-). We could as well just remove the WARN_ON but it's not hard to fix it to not trip on filesystem with errors and not use more cycles in the common case so that's what we do. Signed-off-by: Jan Kara --- fs/ext3/inode.c | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) I carry this patch in my tree and will merge it with Linus in the next merge window if noone objects. diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index a8d3217..91ac85b 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c @@ -1623,7 +1623,11 @@ static int ext3_ordered_writepage(struct page *page, int err; J_ASSERT(PageLocked(page)); - WARN_ON_ONCE(IS_RDONLY(inode)); + /* + * We don't want to warn for emergency remount. The condition is ordered to avoid + * dereferencing inode->i_sb in non-error case to avoid slow-downs. + */ + WARN_ON_ONCE(IS_RDONLY(inode) && !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS)); /* * We give up here if we're reentered, because it might be for a @@ -1698,7 +1702,11 @@ static int ext3_writeback_writepage(struct page *page, int err; J_ASSERT(PageLocked(page)); - WARN_ON_ONCE(IS_RDONLY(inode)); + /* + * We don't want to warn for emergency remount. The condition is ordered to avoid + * dereferencing inode->i_sb in non-error case to avoid slow-downs. + */ + WARN_ON_ONCE(IS_RDONLY(inode) && !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS)); if (ext3_journal_current_handle()) goto out_fail; @@ -1741,7 +1749,11 @@ static int ext3_journalled_writepage(struct page *page, int err; J_ASSERT(PageLocked(page)); - WARN_ON_ONCE(IS_RDONLY(inode)); + /* + * We don't want to warn for emergency remount. The condition is ordered to avoid + * dereferencing inode->i_sb in non-error case to avoid slow-downs. + */ + WARN_ON_ONCE(IS_RDONLY(inode) && !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS)); if (ext3_journal_current_handle()) goto no_write;