Re: Are there still ext2fs corruption problems?

From: Andrea Arcangeli (andrea@suse.de)
Date: Mon Jun 19 2000 - 12:28:41 EST


On Mon, 19 Jun 2000, Alan Cox wrote:

>Run 2.2 hard on it if you want to be sure its hardware. I imagine its software
>there are still page and buffer cache races

discard_buffer isn't waiting I/O completation. I fixed that in
classzone-32 against ac21. I happened to fix it there because I was
getting heavy rejects in that area during porting anyway. This is what I
am using (extracted with cut-and-past just from the cz-32 patch but it
seems classzone clean)

diff -urN 2.4.0-test1-ac21/fs/buffer.c 2.4.0-test1-ac21-VM-32/fs/buffer.c
--- 2.4.0-test1-ac21/fs/buffer.c Mon Jun 19 02:46:28 2000
+++ 2.4.0-test1-ac21-VM-32/fs/buffer.c Mon Jun 19 04:16:06 2000
@@ -1451,46 +1485,34 @@
  * any IO, we are not interested in the contents of the buffer. This
  * function can block if the buffer is locked.
  */
-static struct buffer_head *discard_buffer(struct buffer_head * bh)
+static inline struct buffer_head *discard_buffer(struct buffer_head * bh)
 {
- int index = BUFSIZE_INDEX(bh->b_size);
         struct buffer_head *next;
 
- /* grab the lru lock here to block bdflush. */
- atomic_inc(&bh->b_count);
- lock_buffer(bh);
+ if (bh->b_dev == B_FREE)
+ BUG();
+
         next = bh->b_this_page;
- clear_bit(BH_Uptodate, &bh->b_state);
- clear_bit(BH_Mapped, &bh->b_state);
- clear_bit(BH_Req, &bh->b_state);
- clear_bit(BH_New, &bh->b_state);
+
+ unmap_buffer(bh);
 
         spin_lock(&lru_list_lock);
         write_lock(&hash_table_lock);
- spin_lock(&free_list[index].lock);
         spin_lock(&unused_list_lock);
 
- if (!atomic_dec_and_test(&bh->b_count))
+ if (atomic_read(&bh->b_count))
                 BUG();
 
         __hash_unlink(bh);
- /* The bunffer can be either on the regular
- * queues or on the free list..
- */
- if (bh->b_dev != B_FREE) {
- remove_inode_queue(bh);
- __remove_from_queues(bh);
- }
- else
- __remove_from_free_list(bh, index);
- __put_unused_buffer_head(bh);
- spin_unlock(&unused_list_lock);
         write_unlock(&hash_table_lock);
- spin_unlock(&free_list[index].lock);
+
+ remove_inode_queue(bh);
+ __remove_from_lru_list(bh, bh->b_list);
         spin_unlock(&lru_list_lock);
- /* We can unlock the buffer, we have just returned it.
- * Ditto for the counter
- */
+
+ __put_unused_buffer_head(bh);
+ spin_unlock(&unused_list_lock);
+
         return next;
 }
 

Andrea

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Jun 23 2000 - 21:00:18 EST