<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Chris Mason &lt;mason@suse.com&gt;

Repacking a tail might leave a journal handle attached to an unmapped buffer.
 If that buffer gets dirtied again (via mmap for example), the reiserfs
data=ordered code might try to write the dirty unmapped buffer to disk.

The fix is to make sure we remove the journal handle when we unmap buffers.


---

 25-akpm/fs/reiserfs/tail_conversion.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff -puN fs/reiserfs/tail_conversion.c~reiserfs-tail-jh fs/reiserfs/tail_conversion.c
--- 25/fs/reiserfs/tail_conversion.c~reiserfs-tail-jh	Wed Mar 24 15:14:46 2004
+++ 25-akpm/fs/reiserfs/tail_conversion.c	Wed Mar 24 15:14:46 2004
@@ -143,16 +143,17 @@ void reiserfs_unmap_buffer(struct buffer
     if (buffer_journaled(bh) || buffer_journal_dirty(bh)) {
       BUG() ;
     }
-    clear_buffer_dirty(bh) ;
     lock_buffer(bh) ;
+    clear_buffer_dirty(bh) ;
     /* Remove the buffer from whatever list it belongs to. We are mostly
        interested in removing it from per-sb j_dirty_buffers list, to avoid
         BUG() on attempt to write not mapped buffer */
-    if ( !list_empty(&amp;bh-&gt;b_assoc_buffers) &amp;&amp; bh-&gt;b_page) {
+    if ( (!list_empty(&amp;bh-&gt;b_assoc_buffers) || bh-&gt;b_private) &amp;&amp; bh-&gt;b_page) {
 	struct inode *inode = bh-&gt;b_page-&gt;mapping-&gt;host;
 	struct reiserfs_journal *j = SB_JOURNAL(inode-&gt;i_sb);
 	spin_lock(&amp;j-&gt;j_dirty_buffers_lock);
 	list_del_init(&amp;bh-&gt;b_assoc_buffers);
+	reiserfs_free_jh(bh);
 	spin_unlock(&amp;j-&gt;j_dirty_buffers_lock);
     }
     clear_buffer_mapped(bh) ;

_
</pre></body></html>