提交 3d4492f8 编写于 作者: C Chris Mason 提交者: Linus Torvalds

[PATCH] reiserfs: reiserfs write_ordered_buffers should not oops on dirty non-uptodate bh

write_ordered_buffers should handle dirty non-uptodate buffers without a
BUG()
Signed-off-by: NChris Mason <mason@suse.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 e0e851cf
...@@ -846,6 +846,14 @@ static int write_ordered_buffers(spinlock_t * lock, ...@@ -846,6 +846,14 @@ static int write_ordered_buffers(spinlock_t * lock,
spin_lock(lock); spin_lock(lock);
goto loop_next; goto loop_next;
} }
/* in theory, dirty non-uptodate buffers should never get here,
* but the upper layer io error paths still have a few quirks.
* Handle them here as gracefully as we can
*/
if (!buffer_uptodate(bh) && buffer_dirty(bh)) {
clear_buffer_dirty(bh);
ret = -EIO;
}
if (buffer_dirty(bh)) { if (buffer_dirty(bh)) {
list_del_init(&jh->list); list_del_init(&jh->list);
list_add(&jh->list, &tmp); list_add(&jh->list, &tmp);
...@@ -1030,9 +1038,12 @@ static int flush_commit_list(struct super_block *s, ...@@ -1030,9 +1038,12 @@ static int flush_commit_list(struct super_block *s,
} }
if (!list_empty(&jl->j_bh_list)) { if (!list_empty(&jl->j_bh_list)) {
int ret;
unlock_kernel(); unlock_kernel();
write_ordered_buffers(&journal->j_dirty_buffers_lock, ret = write_ordered_buffers(&journal->j_dirty_buffers_lock,
journal, jl, &jl->j_bh_list); journal, jl, &jl->j_bh_list);
if (ret < 0 && retval == 0)
retval = ret;
lock_kernel(); lock_kernel();
} }
BUG_ON(!list_empty(&jl->j_bh_list)); BUG_ON(!list_empty(&jl->j_bh_list));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册