Commit fb1b3b04 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] reiserfs: tail repacking fix

From: Chris Mason <mason@suse.com>

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.
parent d12e3392
......@@ -143,16 +143,17 @@ void reiserfs_unmap_buffer(struct buffer_head *bh) {
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(&bh->b_assoc_buffers) && bh->b_page) {
if ( (!list_empty(&bh->b_assoc_buffers) || bh->b_private) && bh->b_page) {
struct inode *inode = bh->b_page->mapping->host;
struct reiserfs_journal *j = SB_JOURNAL(inode->i_sb);
spin_lock(&j->j_dirty_buffers_lock);
list_del_init(&bh->b_assoc_buffers);
reiserfs_free_jh(bh);
spin_unlock(&j->j_dirty_buffers_lock);
}
clear_buffer_mapped(bh) ;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment