--- a/fs/ocfs2/alloc.c~ocfs2-fix-potential-soft-lockup-during-fstrim +++ a/fs/ocfs2/alloc.c @@ -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;