jbd2: Add ENOMEM checking in and for jbd2_journal_write_metadata_buffer()
OOM happens. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
Родитель
3f0ca30985
Коммит
e6ec116b67
|
@ -636,6 +636,10 @@ void jbd2_journal_commit_transaction(journal_t *journal)
|
||||||
JBUFFER_TRACE(jh, "ph3: write metadata");
|
JBUFFER_TRACE(jh, "ph3: write metadata");
|
||||||
flags = jbd2_journal_write_metadata_buffer(commit_transaction,
|
flags = jbd2_journal_write_metadata_buffer(commit_transaction,
|
||||||
jh, &new_jh, blocknr);
|
jh, &new_jh, blocknr);
|
||||||
|
if (flags < 0) {
|
||||||
|
jbd2_journal_abort(journal, flags);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
set_bit(BH_JWrite, &jh2bh(new_jh)->b_state);
|
set_bit(BH_JWrite, &jh2bh(new_jh)->b_state);
|
||||||
wbuf[bufs++] = jh2bh(new_jh);
|
wbuf[bufs++] = jh2bh(new_jh);
|
||||||
|
|
||||||
|
|
|
@ -358,6 +358,10 @@ repeat:
|
||||||
|
|
||||||
jbd_unlock_bh_state(bh_in);
|
jbd_unlock_bh_state(bh_in);
|
||||||
tmp = jbd2_alloc(bh_in->b_size, GFP_NOFS);
|
tmp = jbd2_alloc(bh_in->b_size, GFP_NOFS);
|
||||||
|
if (!tmp) {
|
||||||
|
jbd2_journal_put_journal_head(new_jh);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
jbd_lock_bh_state(bh_in);
|
jbd_lock_bh_state(bh_in);
|
||||||
if (jh_in->b_frozen_data) {
|
if (jh_in->b_frozen_data) {
|
||||||
jbd2_free(tmp, bh_in->b_size);
|
jbd2_free(tmp, bh_in->b_size);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче