From ce51f8fc79c77b8448552cc9651ef647b2d7006b Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Tue, 16 Sep 2014 14:50:04 -0400 Subject: [PATCH] add patch jbd2_log_wait_for_space-improve-error-detection --- jbd2_log_wait_for_space-improve-error-detection | 78 +++++++++++++++++++++++++ series | 1 + timestamps | 7 ++- 3 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 jbd2_log_wait_for_space-improve-error-detection diff --git a/jbd2_log_wait_for_space-improve-error-detection b/jbd2_log_wait_for_space-improve-error-detection new file mode 100644 index 00000000..a54e42b0 --- /dev/null +++ b/jbd2_log_wait_for_space-improve-error-detection @@ -0,0 +1,78 @@ +jbd2: jbd2_log_wait_for_space improve error detetcion + +From: Dmitry Monakhov + +If EIO happens after we have dropped j_state_lock, we won't notice +that the journal has been aborted. So it is reasonable to move this +check after we have grabbed the j_checkpoint_mutex and re-grabbed the +j_state_lock. This patch helps to prevent false positive complain +after EIO. + +#DMESG: +__jbd2_log_wait_for_space: needed 8448 blocks and only had 8386 space available +__jbd2_log_wait_for_space: no way to get more journal space in ram1-8 +------------[ cut here ]------------ +WARNING: CPU: 15 PID: 6739 at fs/jbd2/checkpoint.c:168 __jbd2_log_wait_for_space+0x188/0x200() +Modules linked in: brd iTCO_wdt lpc_ich mfd_core igb ptp dm_mirror dm_region_hash dm_log dm_mod +CPU: 15 PID: 6739 Comm: fsstress Tainted: G W 3.17.0-rc2-00429-g684de57 #139 +Hardware name: Intel Corporation W2600CR/W2600CR, BIOS SE5C600.86B.99.99.x028.061320111235 06/13/2011 + 00000000000000a8 ffff88077aaab878 ffffffff815c1a8c 00000000000000a8 + 0000000000000000 ffff88077aaab8b8 ffffffff8106ce8c ffff88077aaab898 + ffff8807c57e6000 ffff8807c57e6028 0000000000002100 ffff8807c57e62f0 +Call Trace: + [] dump_stack+0x51/0x6d + [] warn_slowpath_common+0x8c/0xc0 + [] warn_slowpath_null+0x1a/0x20 + [] __jbd2_log_wait_for_space+0x188/0x200 + [] start_this_handle+0x4da/0x7b0 + [] ? local_clock+0x25/0x30 + [] ? lockdep_init_map+0xe7/0x180 + [] jbd2__journal_start+0xdc/0x1d0 + [] ? __ext4_new_inode+0x7f4/0x1330 + [] __ext4_journal_start_sb+0xf8/0x110 + [] __ext4_new_inode+0x7f4/0x1330 + [] ? lock_release_holdtime+0x29/0x190 + [] ext4_create+0x8b/0x150 + [] vfs_create+0x7b/0xb0 + [] do_last+0x7db/0xcf0 + [] ? inode_permission+0x4d/0x50 + [] path_openat+0x242/0x590 + [] ? __alloc_fd+0x36/0x140 + [] do_filp_open+0x4a/0xb0 + [] ? __alloc_fd+0x121/0x140 + [] do_sys_open+0x170/0x220 + [] SyS_open+0x1e/0x20 + [] SyS_creat+0x16/0x20 + [] system_call_fastpath+0x16/0x1b +---[ end trace cd71c831f82059db ]--- + +Signed-off-by: Dmitry Monakhov +Signed-off-by: Theodore Ts'o +--- + fs/jbd2/checkpoint.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c +index 9ffb19c..1fbf599 100644 +--- a/fs/jbd2/checkpoint.c ++++ b/fs/jbd2/checkpoint.c +@@ -115,8 +115,6 @@ void __jbd2_log_wait_for_space(journal_t *journal) + + nblocks = jbd2_space_needed(journal); + while (jbd2_log_space_left(journal) < nblocks) { +- if (journal->j_flags & JBD2_ABORT) +- return; + write_unlock(&journal->j_state_lock); + mutex_lock(&journal->j_checkpoint_mutex); + +@@ -132,6 +130,10 @@ void __jbd2_log_wait_for_space(journal_t *journal) + * trace for forensic evidence. + */ + write_lock(&journal->j_state_lock); ++ if (journal->j_flags & JBD2_ABORT) { ++ mutex_unlock(&journal->j_checkpoint_mutex); ++ return; ++ } + spin_lock(&journal->j_list_lock); + nblocks = jbd2_space_needed(journal); + space_left = jbd2_log_space_left(journal); diff --git a/series b/series index 7dee45d1..d7c03223 100644 --- a/series +++ b/series @@ -52,6 +52,7 @@ dont-keep-using-page-if-inline-conversion-fails check-EA-value-offset-when-loading free-bh-when-descriptor-block-checksum-fails +jbd2_log_wait_for_space-improve-error-detection ########################################## # unstable patches diff --git a/timestamps b/timestamps index a32c6b39..c32bce06 100755 --- a/timestamps +++ b/timestamps @@ -82,7 +82,8 @@ touch -d @1410450767 cache-extent-hole-in-extent-status-tree-for-ext4_da_map_blo touch -d @1410450990 enable-delayed-allocation touch -d @1410892499 check-EA-value-offset-when-loading touch -d @1410892559 stable-boundary -touch -d @1410892957 series -touch -d @1410892965 status touch -d @1410892989 free-bh-when-descriptor-block-checksum-fails -touch -d @1410893016 timestamps +touch -d @1410893205 series +touch -d @1410893450 jbd2_log_wait_for_space-improve-error-detection +touch -d @1410893450 status +touch -d @1410893454 timestamps -- 2.11.4.GIT