1 jbd2: flush_descriptor(): Do not decrease buffer head's ref count
3 From: Chandan Rajendra <chandan@linux.ibm.com>
5 When executing generic/388 on a ppc64le machine, we notice the following
8 VFS: brelse: Trying to free free buffer
9 WARNING: CPU: 0 PID: 6637 at /root/repos/linux/fs/buffer.c:1195 __brelse+0x84/0xc0
12 __brelse+0x80/0xc0 (unreliable)
13 invalidate_bh_lru+0x78/0xc0
14 on_each_cpu_mask+0xa8/0x130
15 on_each_cpu_cond_mask+0x130/0x170
16 invalidate_bh_lrus+0x44/0x60
17 invalidate_bdev+0x38/0x70
18 ext4_put_super+0x294/0x560
19 generic_shutdown_super+0xb0/0x170
20 kill_block_super+0x38/0xb0
21 deactivate_locked_super+0xa4/0xf0
22 cleanup_mnt+0x164/0x1d0
23 task_work_run+0x110/0x160
24 do_notify_resume+0x414/0x460
25 ret_from_except_lite+0x70/0x74
27 The warning happens because flush_descriptor() drops bh reference it
28 does not own. The bh reference acquired by
29 jbd2_journal_get_descriptor_buffer() is owned by the log_bufs list and
30 gets released when this list is processed. The reference for doing IO is
31 only acquired in write_dirty_buffer() later in flush_descriptor().
33 Reported-by: Harish Sriram <harish@linux.ibm.com>
34 Reviewed-by: Jan Kara <jack@suse.cz>
35 Signed-off-by: Chandan Rajendra <chandan@linux.ibm.com>
36 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
40 1. Fix commit message.
42 fs/jbd2/revoke.c | 4 +---
43 1 file changed, 1 insertion(+), 3 deletions(-)
45 diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c
46 index 69b9bc329964..f08073d7bbf5 100644
47 --- a/fs/jbd2/revoke.c
48 +++ b/fs/jbd2/revoke.c
49 @@ -638,10 +638,8 @@ static void flush_descriptor(journal_t *journal,
51 jbd2_journal_revoke_header_t *header;
53 - if (is_journal_aborted(journal)) {
55 + if (is_journal_aborted(journal))
59 header = (jbd2_journal_revoke_header_t *)descriptor->b_data;
60 header->r_count = cpu_to_be32(offset);