Whamcloud - gitweb
libext2fs: avoid forking a single thread in ext2fs_rw_bitmaps()
authorTheodore Ts'o <tytso@mit.edu>
Sat, 17 Jul 2021 03:10:52 +0000 (23:10 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 17 Jul 2021 03:10:52 +0000 (23:10 -0400)
https://github.com/tytso/e2fsprogs/issues/67

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/rw_bitmaps.c

index d760064..ba5de8b 100644 (file)
@@ -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");