{"id":936,"url":"http://patchwork.ozlabs.org/api/1.0/patches/936/?format=json","project":{"id":8,"url":"http://patchwork.ozlabs.org/api/1.0/projects/8/?format=json","name":"Linux ext4 filesystem development","link_name":"linux-ext4","list_id":"linux-ext4.vger.kernel.org","list_email":"linux-ext4@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20080922140851.bc3f9319.akpm@linux-foundation.org>","date":"2008-09-22T21:08:51","name":"jbd2-abort-instead-of-waiting-for-nonexistent-transactions.patch","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"b0a3362f73780f3a2701ed8f677479f5d23f118e","submitter":{"id":107,"url":"http://patchwork.ozlabs.org/api/1.0/people/107/?format=json","name":"Andrew Morton","email":"akpm@linux-foundation.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20080922140851.bc3f9319.akpm@linux-foundation.org/mbox/","series":[],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/936/checks/","tags":{},"headers":{"Return-Path":"<linux-ext4-owner@vger.kernel.org>","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])\n\tby ozlabs.org (Postfix) with ESMTP id DEE90DDF0A\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 23 Sep 2008 07:10:08 +1000 (EST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753136AbYIVVJ5 (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tMon, 22 Sep 2008 17:09:57 -0400","(majordomo@vger.kernel.org) by vger.kernel.org id S1753133AbYIVVJ5\n\t(ORCPT <rfc822;linux-ext4-outgoing>);\n\tMon, 22 Sep 2008 17:09:57 -0400","from smtp1.linux-foundation.org ([140.211.169.13]:48775 \"EHLO\n\tsmtp1.linux-foundation.org\" rhost-flags-OK-OK-OK-OK)\n\tby vger.kernel.org with ESMTP id S1753352AbYIVVJ4 (ORCPT\n\t<rfc822;linux-ext4@vger.kernel.org>);\n\tMon, 22 Sep 2008 17:09:56 -0400","from imap1.linux-foundation.org (imap1.linux-foundation.org\n\t[140.211.169.55])\n\tby smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with\n\tESMTP id m8ML8qcF014415\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);\n\tMon, 22 Sep 2008 14:08:53 -0700","from akpm.corp.google.com (localhost [127.0.0.1])\n\tby imap1.linux-foundation.org\n\t(8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with SMTP id\n\tm8ML8pQE029746; Mon, 22 Sep 2008 14:08:51 -0700"],"Date":"Mon, 22 Sep 2008 14:08:51 -0700","From":"Andrew Morton <akpm@linux-foundation.org>","To":"\"Theodore Ts'o\" <tytso@mit.edu>,\n\t\"Stephen C. Tweedie\" <sct@redhat.com>","Cc":"linux-ext4@vger.kernel.org","Subject":"jbd2-abort-instead-of-waiting-for-nonexistent-transactions.patch","Message-Id":"<20080922140851.bc3f9319.akpm@linux-foundation.org>","X-Mailer":"Sylpheed version 2.2.4 (GTK+ 2.8.20; i486-pc-linux-gnu)","Mime-Version":"1.0","Content-Type":"text/plain; charset=US-ASCII","Content-Transfer-Encoding":"7bit","X-Spam-Status":"No, hits=-2.858 required=5 tests=AWL,BAYES_00","X-Spam-Checker-Version":"SpamAssassin 3.2.4-osdl_revision__1.47__","X-MIMEDefang-Filter":"lf$Revision: 1.188 $","X-Scanned-By":"MIMEDefang 2.63 on 140.211.169.13","Sender":"linux-ext4-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-ext4.vger.kernel.org>","X-Mailing-List":"linux-ext4@vger.kernel.org"},"content":"Guys, I have a note here that this might be needed in 2.6.27.\n\nI also have a note that Stephen had issues with it, but I\ndon't recall what they were.\n\nCan we get this sorted out please?\n\n\n\nFrom: \"Duane Griffin\" <duaneg@dghda.com>\n\nThe __jbd2_log_wait_for_space function sits in a loop checkpointing\ntransactions until there is sufficient space free in the journal. \nHowever, if there are no transactions to be processed (e.g.  because the\nfree space calculation is wrong due to a corrupted filesystem) it will\nnever progress.\n\nCheck for space being required when no transactions are outstanding and\nabort the journal instead of endlessly looping.\n\nThis patch fixes the bug reported by Sami Liedes at:\nhttp://bugzilla.kernel.org/show_bug.cgi?id=10976\n\nSigned-off-by: Duane Griffin <duaneg@dghda.com>\nCc: Sami Liedes <sliedes@cc.hut.fi>\nCc: <linux-ext4@vger.kernel.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\n---\n\n fs/jbd2/checkpoint.c |   19 +++++++++++++++++--\n 1 file changed, 17 insertions(+), 2 deletions(-)","diff":"diff -puN fs/jbd2/checkpoint.c~jbd2-abort-instead-of-waiting-for-nonexistent-transactions fs/jbd2/checkpoint.c\n--- a/fs/jbd2/checkpoint.c~jbd2-abort-instead-of-waiting-for-nonexistent-transactions\n+++ a/fs/jbd2/checkpoint.c\n@@ -126,14 +126,29 @@ void __jbd2_log_wait_for_space(journal_t\n \n \t\t/*\n \t\t * Test again, another process may have checkpointed while we\n-\t\t * were waiting for the checkpoint lock\n+\t\t * were waiting for the checkpoint lock. If there are no\n+\t\t * outstanding transactions there is nothing to checkpoint and\n+\t\t * we can't make progress. Abort the journal in this case.\n \t\t */\n \t\tspin_lock(&journal->j_state_lock);\n+\t\tspin_lock(&journal->j_list_lock);\n \t\tnblocks = jbd_space_needed(journal);\n \t\tif (__jbd2_log_space_left(journal) < nblocks) {\n+\t\t\tint chkpt = journal->j_checkpoint_transactions != NULL;\n+\n+\t\t\tspin_unlock(&journal->j_list_lock);\n \t\t\tspin_unlock(&journal->j_state_lock);\n-\t\t\tjbd2_log_do_checkpoint(journal);\n+\t\t\tif (chkpt) {\n+\t\t\t\tjbd2_log_do_checkpoint(journal);\n+\t\t\t} else {\n+\t\t\t\tprintk(KERN_ERR \"%s: no transactions\\n\",\n+\t\t\t\t       __func__);\n+\t\t\t\tjbd2_journal_abort(journal, 0);\n+\t\t\t}\n+\n \t\t\tspin_lock(&journal->j_state_lock);\n+\t\t} else {\n+\t\t\tspin_unlock(&journal->j_list_lock);\n \t\t}\n \t\tmutex_unlock(&journal->j_checkpoint_mutex);\n \t}\n","prefixes":[]}