Commit 4d4f4cc4 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] jbd needs to wait for locked buffers

From: Chris Mason <mason@suse.com>

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.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 36f9f209
...@@ -503,7 +503,7 @@ void journal_commit_transaction(journal_t *journal) ...@@ -503,7 +503,7 @@ void journal_commit_transaction(journal_t *journal)
start_journal_io: start_journal_io:
for (i = 0; i < bufs; i++) { for (i = 0; i < bufs; i++) {
struct buffer_head *bh = wbuf[i]; struct buffer_head *bh = wbuf[i];
set_buffer_locked(bh); lock_buffer(bh);
clear_buffer_dirty(bh); clear_buffer_dirty(bh);
set_buffer_uptodate(bh); set_buffer_uptodate(bh);
bh->b_end_io = journal_end_buffer_io_sync; bh->b_end_io = journal_end_buffer_io_sync;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment