lkml.org 
[lkml]   [1999]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectunlock_buffer() patch for 2.3.28
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



--- 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);
}
\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.026 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site