public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Mason <mason@suse.com>
To: linux-kernel@vger.kernel.org, akpm@osdl.org
Subject: [PATCH] ext3 jbd needs to wait for locked buffers
Date: Thu, 17 Jun 2004 21:32:09 -0400	[thread overview]
Message-ID: <1087522329.8002.82.camel@watt.suse.com> (raw)

jbd needs to wait for any io to complete on the buffer before
changing the end_io function.  Using set_buffer_locked means that
it can change the end_io function while the page is in the middle of
writeback, and the writeback bit on the page will never get cleared.

Since we set the buffer dirty earlier on, if the page was
previously dirty, pdflush or memory pressure might trigger a
writepage call, which will race with jbd's set_buffer_locked.

Index: linux.t/fs/jbd/commit.c
===================================================================
--- linux.t.orig/fs/jbd/commit.c	2004-06-17 21:01:28.000000000 -0400
+++ linux.t/fs/jbd/commit.c	2004-06-17 21:02:16.000000000 -0400
@@ -504,7 +504,7 @@ write_out_data:
 start_journal_io:
 			for (i = 0; i < bufs; i++) {
 				struct buffer_head *bh = wbuf[i];
-				set_buffer_locked(bh);
+				lock_buffer(bh);
 				clear_buffer_dirty(bh);
 				set_buffer_uptodate(bh);
 				bh->b_end_io = journal_end_buffer_io_sync;



             reply	other threads:[~2004-06-18  1:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-18  1:32 Chris Mason [this message]
2004-06-18  1:47 ` [PATCH] ext3 jbd needs to wait for locked buffers Andrew Morton

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=1087522329.8002.82.camel@watt.suse.com \
    --to=mason@suse.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox