aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/jbd2/journal.c6
-rw-r--r--fs/jbd2/revoke.c15
2 files changed, 7 insertions, 14 deletions
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 5804466b5785..179d7d8733f2 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -2377,10 +2377,8 @@ static struct journal_head *journal_alloc_journal_head(void)
2377 if (!ret) { 2377 if (!ret) {
2378 jbd_debug(1, "out of memory for journal_head\n"); 2378 jbd_debug(1, "out of memory for journal_head\n");
2379 pr_notice_ratelimited("ENOMEM in %s, retrying.\n", __func__); 2379 pr_notice_ratelimited("ENOMEM in %s, retrying.\n", __func__);
2380 while (!ret) { 2380 ret = kmem_cache_zalloc(jbd2_journal_head_cache,
2381 yield(); 2381 GFP_NOFS | __GFP_NOFAIL);
2382 ret = kmem_cache_zalloc(jbd2_journal_head_cache, GFP_NOFS);
2383 }
2384 } 2382 }
2385 return ret; 2383 return ret;
2386} 2384}
diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c
index 14214da80eb8..0abf2e7f725b 100644
--- a/fs/jbd2/revoke.c
+++ b/fs/jbd2/revoke.c
@@ -141,11 +141,13 @@ static int insert_revoke_hash(journal_t *journal, unsigned long long blocknr,
141{ 141{
142 struct list_head *hash_list; 142 struct list_head *hash_list;
143 struct jbd2_revoke_record_s *record; 143 struct jbd2_revoke_record_s *record;
144 gfp_t gfp_mask = GFP_NOFS;
144 145
145repeat: 146 if (journal_oom_retry)
146 record = kmem_cache_alloc(jbd2_revoke_record_cache, GFP_NOFS); 147 gfp_mask |= __GFP_NOFAIL;
148 record = kmem_cache_alloc(jbd2_revoke_record_cache, gfp_mask);
147 if (!record) 149 if (!record)
148 goto oom; 150 return -ENOMEM;
149 151
150 record->sequence = seq; 152 record->sequence = seq;
151 record->blocknr = blocknr; 153 record->blocknr = blocknr;
@@ -154,13 +156,6 @@ repeat:
154 list_add(&record->hash, hash_list); 156 list_add(&record->hash, hash_list);
155 spin_unlock(&journal->j_revoke_lock); 157 spin_unlock(&journal->j_revoke_lock);
156 return 0; 158 return 0;
157
158oom:
159 if (!journal_oom_retry)
160 return -ENOMEM;
161 jbd_debug(1, "ENOMEM in %s, retrying\n", __func__);
162 yield();
163 goto repeat;
164} 159}
165 160
166/* Find a revoke record in the journal's hash table. */ 161/* Find a revoke record in the journal's hash table. */