Skip to contentSkip to conversation

check for dirtying of non-uptodate buffers

PATCH In review Andrew Morton 1 participant 1 message May 19, 2002 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 2/15 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 ;)

=====================================

fs/buffer.c renamed from fs/buffer.c~buffer-dirty-check +2 -0
@@ -1056,6 +1056,8 @@ __getblk(struct block_device *bdev, sect
  */
 void mark_buffer_dirty(struct buffer_head *bh)
 {
+	if (!buffer_uptodate(bh))
+		buffer_error();
 	if (!test_set_buffer_dirty(bh))
 		__set_page_dirty_nobuffers(bh->b_page);
 }
fs/jbd/recovery.c renamed from fs/jbd/recovery.c~buffer-dirty-check +1 -1
@@ -482,9 +482,9 @@ static int do_one_pass(journal_t *journa
 					}
 
 					BUFFER_TRACE(nbh, "marking dirty");
+					set_buffer_uptodate(nbh);
 					mark_buffer_dirty(nbh);
 					BUFFER_TRACE(nbh, "marking uptodate");
-					set_buffer_uptodate(nbh);
 					++info->nr_replays;
 					/* ll_rw_block(WRITE, 1, &nbh); */
 					unlock_buffer(nbh);

-