Commit 6b9f3b41 authored by Andrew Morton's avatar Andrew Morton Committed by Arnaldo Carvalho de Melo

[PATCH] check for dirtying of non-uptodate buffers

- Add a debug check to catch people who are marking non-uptodate
  buffers as dirty.

  This is either a source of data corruption, or sloppy programming.

- Fix sloppy programming in ext3 ;)
parent cd016d80
...@@ -1056,6 +1056,8 @@ __getblk(struct block_device *bdev, sector_t block, int size) ...@@ -1056,6 +1056,8 @@ __getblk(struct block_device *bdev, sector_t block, int size)
*/ */
void mark_buffer_dirty(struct buffer_head *bh) void mark_buffer_dirty(struct buffer_head *bh)
{ {
if (!buffer_uptodate(bh))
buffer_error();
if (!test_set_buffer_dirty(bh)) if (!test_set_buffer_dirty(bh))
__set_page_dirty_nobuffers(bh->b_page); __set_page_dirty_nobuffers(bh->b_page);
} }
......
...@@ -482,9 +482,9 @@ static int do_one_pass(journal_t *journal, ...@@ -482,9 +482,9 @@ static int do_one_pass(journal_t *journal,
} }
BUFFER_TRACE(nbh, "marking dirty"); BUFFER_TRACE(nbh, "marking dirty");
set_buffer_uptodate(nbh);
mark_buffer_dirty(nbh); mark_buffer_dirty(nbh);
BUFFER_TRACE(nbh, "marking uptodate"); BUFFER_TRACE(nbh, "marking uptodate");
set_buffer_uptodate(nbh);
++info->nr_replays; ++info->nr_replays;
/* ll_rw_block(WRITE, 1, &nbh); */ /* ll_rw_block(WRITE, 1, &nbh); */
unlock_buffer(nbh); unlock_buffer(nbh);
......
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