Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
[firefly-linux-kernel-4.4.55.git] / fs / jbd2 / revoke.c
index 14214da80eb8ea5d781389ed5ff3b1e373f4e7b4..0abf2e7f725beb70135a4b65f90f6ada6f14134d 100644 (file)
@@ -141,11 +141,13 @@ static int insert_revoke_hash(journal_t *journal, unsigned long long blocknr,
 {
        struct list_head *hash_list;
        struct jbd2_revoke_record_s *record;
+       gfp_t gfp_mask = GFP_NOFS;
 
-repeat:
-       record = kmem_cache_alloc(jbd2_revoke_record_cache, GFP_NOFS);
+       if (journal_oom_retry)
+               gfp_mask |= __GFP_NOFAIL;
+       record = kmem_cache_alloc(jbd2_revoke_record_cache, gfp_mask);
        if (!record)
-               goto oom;
+               return -ENOMEM;
 
        record->sequence = seq;
        record->blocknr = blocknr;
@@ -154,13 +156,6 @@ repeat:
        list_add(&record->hash, hash_list);
        spin_unlock(&journal->j_revoke_lock);
        return 0;
-
-oom:
-       if (!journal_oom_retry)
-               return -ENOMEM;
-       jbd_debug(1, "ENOMEM in %s, retrying\n", __func__);
-       yield();
-       goto repeat;
 }
 
 /* Find a revoke record in the journal's hash table. */