[PATCH] lock_buffer_wq do lock

From: Hugh Dickins (hugh@veritas.com)
Date: Mon Jun 16 2003 - 08:47:32 EST


I've twice got fs/buffer.c:2668 submit_bh BUG_ON(!buffer_locked(bh)):
when called from sync_dirty_buffer which clearly does the lock_buffer.
My suspicion falls on lock_buffer_wq (whereas __lock_page_wq looks OK).

I'm leaving a test running,
can't judge until tomorrow whether this is indeed the fix to that.

Hugh

--- 2.5.71-mm1/include/linux/buffer_head.h Sun Jun 15 12:36:11 2003
+++ linux/include/linux/buffer_head.h Mon Jun 16 14:13:25 2003
@@ -291,9 +291,11 @@
 
 static inline int lock_buffer_wq(struct buffer_head *bh, wait_queue_t *wait)
 {
- if (test_set_buffer_locked(bh))
- return __wait_on_buffer_wq(bh, wait);
-
+ while (test_set_buffer_locked(bh)) {
+ int ret = __wait_on_buffer_wq(bh, wait);
+ if (ret)
+ return ret;
+ }
         return 0;
 }
 

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



This archive was generated by hypermail 2b29 : Mon Jun 23 2003 - 22:00:18 EST