libext2fs: avoid forking a single thread in ext2fs_rw_bitmaps()

https://github.com/tytso/e2fsprogs/issues/67

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
Theodore Ts'o 2021-07-16 23:10:52 -04:00
parent a3f844da91
commit d0b6b64f62

View 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");