From patchwork Tue Feb 17 15:58:22 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 23271 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.176.167]) by ozlabs.org (Postfix) with ESMTP id ADA70DDDEE for ; Wed, 18 Feb 2009 02:59:10 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751600AbZBQP7J (ORCPT ); Tue, 17 Feb 2009 10:59:09 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752003AbZBQP7J (ORCPT ); Tue, 17 Feb 2009 10:59:09 -0500 Received: from thunk.org ([69.25.196.29]:35277 "EHLO thunker.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751600AbZBQP7I (ORCPT ); Tue, 17 Feb 2009 10:59:08 -0500 Received: from c-98-216-98-217.hsd1.ma.comcast.net ([98.216.98.217] helo=localhost.localdomain) by thunker.thunk.org with esmtp (Exim 4.50 #1 (Debian)) id 1LZSLd-0006Ir-06; Tue, 17 Feb 2009 10:59:07 -0500 From: Theodore Ts'o To: stable@kernel.org Cc: linux-ext4@vger.kernel.org, Theodore Ts'o Date: Tue, 17 Feb 2009 10:58:22 -0500 Message-Id: <1234886324-15105-3-git-send-email-tytso@mit.edu> X-Mailer: git-send-email 1.5.6.3 In-Reply-To: <1234886324-15105-2-git-send-email-tytso@mit.edu> References: <1234886324-15105-1-git-send-email-tytso@mit.edu> <1234886324-15105-2-git-send-email-tytso@mit.edu> X-SA-Exim-Connect-IP: 98.216.98.217 X-SA-Exim-Mail-From: tytso@mit.edu X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-26) on thunker.thunk.org X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO,RCVD_IN_SORBS_DUL autolearn=no version=3.1.4 Subject: [PATCH FOR-STABLE-2.6.27 02/24] ext4: tone down ext4_da_writepages warnings X-SA-Exim-Version: 4.2 (built Thu, 03 Mar 2005 10:44:12 +0100) X-SA-Exim-Scanned: Yes (on thunker.thunk.org) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org If the filesystem has errors, ext4_da_writepages() will return a *lot* of errors, including lots and lots of stack dumps. While it's true that we are dropping user data on the floor, which is unfortunate, the stack dumps aren't helpful, and they tend to obscure the true original root cause of the problem. So in the case where the filesystem has aborted, return an EROFS right away. Signed-off-by: "Theodore Ts'o" (cherry picked from commit 2a21e37e48b94388f2cc8c0392f104f5443d4bb8) --- fs/ext4/inode.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index d77f674..c1b52a8 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -2298,6 +2298,20 @@ static int ext4_da_writepages(struct address_space *mapping, */ if (!mapping->nrpages || !mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) return 0; + + /* + * If the filesystem has aborted, it is read-only, so return + * right away instead of dumping stack traces later on that + * will obscure the real source of the problem. We test + * EXT4_MOUNT_ABORT instead of sb->s_flag's MS_RDONLY because + * the latter could be true if the filesystem is mounted + * read-only, and in that case, ext4_da_writepages should + * *never* be called, so if that ever happens, we would want + * the stack trace. + */ + if (unlikely(sbi->s_mount_opt & EXT4_MOUNT_ABORT)) + return -EROFS; + /* * Make sure nr_to_write is >= sbi->s_mb_stream_request * This make sure small files blocks are allocated in @@ -2336,7 +2350,7 @@ restart_loop: handle = ext4_journal_start(inode, needed_blocks); if (IS_ERR(handle)) { ret = PTR_ERR(handle); - printk(KERN_EMERG "%s: jbd2_start: " + printk(KERN_CRIT "%s: jbd2_start: " "%ld pages, ino %lu; err %d\n", __func__, wbc->nr_to_write, inode->i_ino, ret); dump_stack();