Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

jbd2: don't abort the journal when freeing buffers

Now that we can be sure the journal is aborted once a buffer has failed
to be written back to disk, we can remove the journal abort logic in
jbd2_journal_try_to_free_buffers() which was introduced in
commit c044f3d8360d ("jbd2: abort journal if free a async write error
metadata buffer"), because it may cost and propably is not safe.

Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20210610112440.3438139-4-yi.zhang@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>

authored by

Zhang Yi and committed by
Theodore Ts'o
235d6806 fcf37549

-17
-17
fs/jbd2/transaction.c
··· 2123 2123 { 2124 2124 struct buffer_head *head; 2125 2125 struct buffer_head *bh; 2126 - bool has_write_io_error = false; 2127 2126 int ret = 0; 2128 2127 2129 2128 J_ASSERT(PageLocked(page)); ··· 2147 2148 jbd2_journal_put_journal_head(jh); 2148 2149 if (buffer_jbd(bh)) 2149 2150 goto busy; 2150 - 2151 - /* 2152 - * If we free a metadata buffer which has been failed to 2153 - * write out, the jbd2 checkpoint procedure will not detect 2154 - * this failure and may lead to filesystem inconsistency 2155 - * after cleanup journal tail. 2156 - */ 2157 - if (buffer_write_io_error(bh)) { 2158 - pr_err("JBD2: Error while async write back metadata bh %llu.", 2159 - (unsigned long long)bh->b_blocknr); 2160 - has_write_io_error = true; 2161 - } 2162 2151 } while ((bh = bh->b_this_page) != head); 2163 2152 2164 2153 ret = try_to_free_buffers(page); 2165 - 2166 2154 busy: 2167 - if (has_write_io_error) 2168 - jbd2_journal_abort(journal, -EIO); 2169 - 2170 2155 return ret; 2171 2156 } 2172 2157