]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
jbd2: Add ENOMEM checking in and for jbd2_journal_write_metadata_buffer()
authorTheodore Ts'o <tytso@mit.edu>
Tue, 1 Dec 2009 14:04:42 +0000 (09:04 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 14 Dec 2009 16:07:49 +0000 (08:07 -0800)
(cherry picked from commit e6ec116b67f46e0e7808276476554727b2e6240b)

OOM happens.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/jbd2/commit.c
fs/jbd2/journal.c

index 7b4088b2364d5caf8145d610cea8dc885022cda4..8cf902ae7147e852b1739ff274e1320614b96ecf 100644 (file)
@@ -636,6 +636,10 @@ void jbd2_journal_commit_transaction(journal_t *journal)
                JBUFFER_TRACE(jh, "ph3: write metadata");
                flags = jbd2_journal_write_metadata_buffer(commit_transaction,
                                                      jh, &new_jh, blocknr);
+               if (flags < 0) {
+                       jbd2_journal_abort(journal, flags);
+                       continue;
+               }
                set_bit(BH_JWrite, &jh2bh(new_jh)->b_state);
                wbuf[bufs++] = jh2bh(new_jh);
 
index a8a358bc0f21792f5f675889f63d0c4123ecc04d..dac1cede70cd4106a514f83e64184859a69a9f80 100644 (file)
@@ -361,6 +361,10 @@ repeat:
 
                jbd_unlock_bh_state(bh_in);
                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);
                if (jh_in->b_frozen_data) {
                        jbd2_free(tmp, bh_in->b_size);