From c417ede6131ab5209beff8e44bf5ec92f5acc26b Mon Sep 17 00:00:00 2001 From: Zhiqiang Liu Date: Sat, 24 Jul 2021 10:21:08 +0800 Subject: [PATCH] filebench: fix coredump problem with dirwidth=1 If we set dirwidth=1 when defining fileset, run 'filebench -f .f' will cause coredump. Because we set fileset->fs_meandepth in fileset_populate() as follows, $ fileset->fs_meandepth=log(entries+leafdirs)/log(meandirwidth). where meandirwidth is equal to 1 as same with dirwidth in .f. So fileset->fs_meandepth is set to inf, which will cause endless recursion of fileset_populate_subdir(). Finally, coredump occurs. Here, we will use a little bias (0.1) instead of log(1) when meandirwidth is equal to 1. Signed-off-by: Zhiqiang Liu --- ...fix-coredump-problem-with-dirwidth-1.patch | 37 +++++++++++++++++++ filebench.spec | 7 +++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 0001-filebench-fix-coredump-problem-with-dirwidth-1.patch diff --git a/0001-filebench-fix-coredump-problem-with-dirwidth-1.patch b/0001-filebench-fix-coredump-problem-with-dirwidth-1.patch new file mode 100644 index 0000000..adf7523 --- /dev/null +++ b/0001-filebench-fix-coredump-problem-with-dirwidth-1.patch @@ -0,0 +1,37 @@ +From 14aee810d4c310f6ad101fe3e116e6c5adfbd79a Mon Sep 17 00:00:00 2001 +From: Zhiqiang Liu +Date: Mon, 8 Feb 2021 15:25:46 +0800 +Subject: [PATCH] filebench: fix coredump problem with dirwidth=1 + +If we set dirwidth=1 when defining fileset, run +'filebench -f .f' will cause coredump. +Because we set fileset->fs_meandepth in fileset_populate() as follows, +$ fileset->fs_meandepth=log(entries+leafdirs)/log(meandirwidth). +where meandirwidth is equal to 1 as same with dirwidth in .f. +So fileset->fs_meandepth is set to inf, which will cause endless +recursion of fileset_populate_subdir(). Finally, coredump occurs. + +Here, we will use a little bias (0.1) instead of log(1) when +meandirwidth is equal to 1. + +Signed-off-by: Zhiqiang Liu +--- + fileset.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fileset.c b/fileset.c +index 1453f8d..6f82cd9 100644 +--- a/fileset.c ++++ b/fileset.c +@@ -1660,7 +1660,7 @@ fileset_populate(fileset_t *fileset) + * # ave size of file + * max size of file + */ +- fileset->fs_meandepth = log(entries+leafdirs) / log(meandirwidth); ++ fileset->fs_meandepth = log(entries+leafdirs) / ((meandirwidth == 1) ? 0.1 : log(meandirwidth)); + + /* Has a random variable been supplied for dirdepth? */ + if (fileset->fs_dirdepthrv) { +-- +1.8.3.1 + diff --git a/filebench.spec b/filebench.spec index cd5aced..6ff06d9 100644 --- a/filebench.spec +++ b/filebench.spec @@ -1,12 +1,14 @@ Name: filebench Version: 1.4.9.1 -Release: 2 +Release: 3 Summary: A model based file system workload generator License: CDDL-1.0 URL: http://github.com/filebench Source0: https://github.com/filebench/filebench/archive/refs/tags/%{version}.tar.gz +Patch1: 0001-filebench-fix-coredump-problem-with-dirwidth-1.patch + BuildRequires: automake BuildRequires: autoconf BuildRequires: libtool @@ -46,6 +48,9 @@ make install DESTDIR=$RPM_BUILD_ROOT %changelog +* Sat Jul 24 2021 Zhiqiang Liu 1.4.9.1-3 +- fix one coredump problem with dirwidth=1 + * Wed Jul 07 2021 wangxiaomeng 1.4.9.1-2 - chang to autosetup -- Gitee