Skip to content

Commit abe1ac7

Browse files
Zhihao Chengtytso
authored andcommitted
jbd2: make b_frozen_data allocation always succeed
The b_frozen_data allocation should not be failed during journal committing process, otherwise jbd2 will abort. Since commit 490c1b4("jbd2: do not fail journal because of frozen_buffer allocation failure") already added '__GFP_NOFAIL' flag in do_get_write_access(), just add '__GFP_NOFAIL' flag for all allocations in jbd2_journal_write_metadata_buffer(), like 'new_bh' allocation does. Besides, remove all error handling branches for do_get_write_access(). Signed-off-by: Zhihao Cheng <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Zhang Yi <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 27349b4 commit abe1ac7

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

fs/jbd2/commit.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -662,10 +662,6 @@ void jbd2_journal_commit_transaction(journal_t *journal)
662662
JBUFFER_TRACE(jh, "ph3: write metadata");
663663
escape = jbd2_journal_write_metadata_buffer(commit_transaction,
664664
jh, &wbuf[bufs], blocknr);
665-
if (escape < 0) {
666-
jbd2_journal_abort(journal, escape);
667-
continue;
668-
}
669665
jbd2_file_log_bh(&io_bufs, wbuf[bufs]);
670666

671667
/* Record the new block's tag in the current descriptor

fs/jbd2/journal.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ static inline void jbd2_data_do_escape(char *data)
318318
*
319319
*
320320
* Return value:
321-
* <0: Error
322321
* =0: Finished OK without escape
323322
* =1: Finished OK with escape
324323
*/
@@ -386,12 +385,7 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
386385
goto escape_done;
387386

388387
spin_unlock(&jh_in->b_state_lock);
389-
tmp = jbd2_alloc(bh_in->b_size, GFP_NOFS);
390-
if (!tmp) {
391-
brelse(new_bh);
392-
free_buffer_head(new_bh);
393-
return -ENOMEM;
394-
}
388+
tmp = jbd2_alloc(bh_in->b_size, GFP_NOFS | __GFP_NOFAIL);
395389
spin_lock(&jh_in->b_state_lock);
396390
if (jh_in->b_frozen_data) {
397391
jbd2_free(tmp, bh_in->b_size);

0 commit comments

Comments
 (0)