From d0b6b64f62eff5c7545be8b71adf6fd537613a90 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 16 Jul 2021 23:10:52 -0400 Subject: [PATCH] libext2fs: avoid forking a single thread in ext2fs_rw_bitmaps() https://github.com/tytso/e2fsprogs/issues/67 Signed-off-by: Theodore Ts'o --- lib/ext2fs/rw_bitmaps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ext2fs/rw_bitmaps.c b/lib/ext2fs/rw_bitmaps.c index d760064c..ba5de8b2 100644 --- a/lib/ext2fs/rw_bitmaps.c +++ b/lib/ext2fs/rw_bitmaps.c @@ -563,7 +563,7 @@ errcode_t ext2fs_rw_bitmaps(ext2_filsys fs, int flags, int num_threads) if (ext2fs_has_feature_flex_bg(fs->super)) { average_group = (average_group / flexbg_size) * flexbg_size; } - if (average_group == 0) + if ((num_threads <= 1) || (average_group == 0)) goto fallback; io_channel_set_options(fs->io, "cache=off");