From de389b713e0aceff2f24a46e2d6fdf107633b001 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 8 Aug 2019 11:50:34 -0400 Subject: [PATCH] add patch do-not-descrease-bufferheads-refcount --- do-not-descrease-bufferheads-refcount | 64 +++++++++++++++++++++++++++++++++++ series | 1 + timestamps | 7 ++-- 3 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 do-not-descrease-bufferheads-refcount diff --git a/do-not-descrease-bufferheads-refcount b/do-not-descrease-bufferheads-refcount new file mode 100644 index 00000000..2d48e00e --- /dev/null +++ b/do-not-descrease-bufferheads-refcount @@ -0,0 +1,64 @@ +jbd2: flush_descriptor(): Do not decrease buffer head's ref count + +From: Chandan Rajendra + +When executing generic/388 on a ppc64le machine, we notice the following +call trace, + +VFS: brelse: Trying to free free buffer +WARNING: CPU: 0 PID: 6637 at /root/repos/linux/fs/buffer.c:1195 __brelse+0x84/0xc0 + +Call Trace: + __brelse+0x80/0xc0 (unreliable) + invalidate_bh_lru+0x78/0xc0 + on_each_cpu_mask+0xa8/0x130 + on_each_cpu_cond_mask+0x130/0x170 + invalidate_bh_lrus+0x44/0x60 + invalidate_bdev+0x38/0x70 + ext4_put_super+0x294/0x560 + generic_shutdown_super+0xb0/0x170 + kill_block_super+0x38/0xb0 + deactivate_locked_super+0xa4/0xf0 + cleanup_mnt+0x164/0x1d0 + task_work_run+0x110/0x160 + do_notify_resume+0x414/0x460 + ret_from_except_lite+0x70/0x74 + +The warning happens because flush_descriptor() drops bh reference it +does not own. The bh reference acquired by +jbd2_journal_get_descriptor_buffer() is owned by the log_bufs list and +gets released when this list is processed. The reference for doing IO is +only acquired in write_dirty_buffer() later in flush_descriptor(). + +Reported-by: Harish Sriram +Reviewed-by: Jan Kara +Signed-off-by: Chandan Rajendra +Signed-off-by: Theodore Ts'o +--- +Changelog: +V1 -> V2: +1. Fix commit message. + + fs/jbd2/revoke.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c +index 69b9bc329964..f08073d7bbf5 100644 +--- a/fs/jbd2/revoke.c ++++ b/fs/jbd2/revoke.c +@@ -638,10 +638,8 @@ static void flush_descriptor(journal_t *journal, + { + jbd2_journal_revoke_header_t *header; + +- if (is_journal_aborted(journal)) { +- put_bh(descriptor); ++ if (is_journal_aborted(journal)) + return; +- } + + header = (jbd2_journal_revoke_header_t *)descriptor->b_data; + header->r_count = cpu_to_be32(offset); +-- +2.19.1 + + diff --git a/series b/series index 7b6afed8..e70e5605 100644 --- a/series +++ b/series @@ -2,6 +2,7 @@ fix-warning-when-turn-on-dioread_nolock-and-inline_data remove-unnecessary-error-check +do-not-descrease-bufferheads-refcount #################################################### # unstable patches diff --git a/timestamps b/timestamps index 2612338e..4213692e 100755 --- a/timestamps +++ b/timestamps @@ -14,6 +14,7 @@ touch -d @1558930766 save-patch touch -d @1561168680 stable-boundary touch -d @1565015214 fix-warning-when-turn-on-dioread_nolock-and-inline_data touch -d @1565016977 remove-unnecessary-error-check -touch -d @1565116058 series -touch -d @1565116531 status -touch -d @1565279277 timestamps +touch -d @1565279325 series +touch -d @1565279410 do-not-descrease-bufferheads-refcount +touch -d @1565279416 status +touch -d @1565279424 timestamps -- 2.11.4.GIT