ocfs2: fix potential soft lockup during fstrim
[linux-2.6-microblaze.git] / fs / ocfs2 / alloc.c
index 4c1b904..7871078 100644 (file)
@@ -6013,7 +6013,7 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb)
                goto out;
        }
 
-       /* Appending truncate log(TA) and and flushing truncate log(TF) are
+       /* Appending truncate log(TA) and flushing truncate log(TF) are
         * two separated transactions. They can be both committed but not
         * checkpointed. If crash occurs then, both two transaction will be
         * replayed with several already released to global bitmap clusters.
@@ -7654,8 +7654,10 @@ out_mutex:
         * main_bm related locks for avoiding the current IO starve, then go to
         * trim the next group
         */
-       if (ret >= 0 && group <= last_group)
+       if (ret >= 0 && group <= last_group) {
+               cond_resched();
                goto next_group;
+       }
 out:
        range->len = trimmed * sb->s_blocksize;
        return ret;