unlock_buffer() patch for 2.3.28

Larry Woodman (woodman@missioncriticallinux.com)
Tue, 23 Nov 1999 10:40:27 -0500


This is a multi-part message in MIME format.
--------------2AC8BC73216306274B5001D7
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Here is a patch for unlock_buffer in
/usr/src/linux/include/linux/locks.h

extern inline void unlock_buffer(struct buffer_head *bh)
{
clear_bit(BH_Lock, &bh->b_state);
+ refile_buffer(bh);
wake_up(&bh->b_wait);
}

Without this patch, bdflush() calls flush_dirty_buffers() which calls
ll_rw_block() for each dirty
buffer. ll_rw_block() calls make_request() which moves the buffer from
the BUF_DIRTY to
the BUF_LOCKED list for the duration of the IO operation. When the
IO operation completes,
end_buffer_io_sync() calls unlock_buffer() to clear the BH_Lock state
but never moves the
buffer back to the BUF_CLEAN list. Next time the buffer is used it's
assumed to be on the
BUF_CLEAN list but it is still in the BUF_LOCKED list. For starters the
nr_buffers_type[BUF_LOCK]
count never get decremented and the buf lists can probably get
corrupted.

Larry Woodman
http://www.missioncriticallinux.com

--------------2AC8BC73216306274B5001D7
Content-Type: text/plain; charset=us-ascii;
name="patch-2.3.28.buffer"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="patch-2.3.28.buffer"

--- include/linux/locks.h.sav Tue Nov 23 11:22:02 1999
+++ include/linux/locks.h Tue Nov 23 10:04:47 1999
@@ -29,6 +29,7 @@
extern inline void unlock_buffer(struct buffer_head *bh)
{
clear_bit(BH_Lock, &bh->b_state);
+ refile_buffer(bh);
wake_up(&bh->b_wait);
}

--------------2AC8BC73216306274B5001D7--

-
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/