LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Theodore Tso <tytso@mit.edu>
To: Eric Sandeen <sandeen@redhat.com>, Eric Paris <eparis@redhat.com>,
	linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: [PATCH, RFC] jbd2: Call the commit callback before the transaction could get dropped
Date: Mon, 27 Oct 2008 22:28:38 -0400	[thread overview]
Message-ID: <20081028022838.GA8869@mit.edu> (raw)
In-Reply-To: <20081028015228.GA8320@mit.edu>

This is what I plan to send to Linus to fix the problem.

commit 6fecbc3c7d27800e90a5f5fbca2fb2847e2c2854
Author: Theodore Ts'o <tytso@mit.edu>
Date:   Mon Oct 27 22:11:39 2008 -0400

    jbd2: Call the commit callback before the transaction could get dropped
    
    The transaction can potentially get dropped if there are no buffers
    that need to be written.  Make sure we call the commit callback before
    potentially deciding to drop the transaction.  Also avoid
    dereferencing the commit_transaction pointer in the marker for the
    same reason.
    
    This patch fixes the bug reported by Eric Paris at:
    http://bugzilla.kernel.org/show_bug.cgi?id=11838
    
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>

diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 8b119e1..ebc667b 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -974,6 +974,9 @@ restart_loop:
 	journal->j_committing_transaction = NULL;
 	spin_unlock(&journal->j_state_lock);
 
+	if (journal->j_commit_callback)
+		journal->j_commit_callback(journal, commit_transaction);
+
 	if (commit_transaction->t_checkpoint_list == NULL &&
 	    commit_transaction->t_checkpoint_io_list == NULL) {
 		__jbd2_journal_drop_transaction(journal, commit_transaction);
@@ -995,11 +998,8 @@ restart_loop:
 	}
 	spin_unlock(&journal->j_list_lock);
 
-	if (journal->j_commit_callback)
-		journal->j_commit_callback(journal, commit_transaction);
-
 	trace_mark(jbd2_end_commit, "dev %s transaction %d head %d",
-		   journal->j_devname, commit_transaction->t_tid,
+		   journal->j_devname, journal->j_commit_sequence,
 		   journal->j_tail_sequence);
 	jbd_debug(1, "JBD: commit %d complete, head %d\n",
 		  journal->j_commit_sequence, journal->j_tail_sequence);

  parent reply	other threads:[~2008-10-28  2:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-21 18:03 general protection fault: from release_blocks_on_commit Eric Paris
2008-10-27 18:19 ` Theodore Tso
2008-10-27 22:26   ` Eric Sandeen
2008-10-27 23:28     ` Theodore Tso
2008-10-28  0:08       ` Eric Sandeen
2008-10-28  1:52         ` Theodore Tso
2008-10-28  2:15           ` Eric Sandeen
2008-10-28  2:28           ` Theodore Tso [this message]
2008-10-28  2:41             ` [PATCH, RFC] jbd2: Call the commit callback before the transaction could get dropped Eric Sandeen
2008-10-28 13:46               ` Eric Paris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081028022838.GA8869@mit.edu \
    --to=tytso@mit.edu \
    --cc=eparis@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sandeen@redhat.com \
    --subject='Re: [PATCH, RFC] jbd2: Call the commit callback before the transaction could get dropped' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).