]> git.itanic.dy.fi Git - linux-stable/blobdiff - fs/ext4/mballoc.c
ext4: limit the number of retries after discarding preallocations blocks
[linux-stable] / fs / ext4 / mballoc.c
index 38e7dc2531b174ed01bc6a5e21c4a4cc5869eaa3..697af6603652426b6115a6505b9863c09c900d2f 100644 (file)
@@ -5559,6 +5559,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
        ext4_fsblk_t block = 0;
        unsigned int inquota = 0;
        unsigned int reserv_clstrs = 0;
+       int retries = 0;
        u64 seq;
 
        might_sleep();
@@ -5661,7 +5662,8 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t *handle,
                        ar->len = ac->ac_b_ex.fe_len;
                }
        } else {
-               if (ext4_mb_discard_preallocations_should_retry(sb, ac, &seq))
+               if (++retries < 3 &&
+                   ext4_mb_discard_preallocations_should_retry(sb, ac, &seq))
                        goto repeat;
                /*
                 * If block allocation fails then the pa allocated above