!5 [sync] PR-4: filebench: fix coredump problem with dirwidth=1

From: @openeuler-sync-bot
Reviewed-by: @liuzhiqiang26
Signed-off-by: @liuzhiqiang26
This commit is contained in:
openeuler-ci-bot 2021-09-16 06:36:33 +00:00 committed by Gitee
commit 7c527e84c6
2 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From 14aee810d4c310f6ad101fe3e116e6c5adfbd79a Mon Sep 17 00:00:00 2001
From: Zhiqiang Liu <liuzhiqiang26@huawei.com>
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 <wml-test>.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 <wml-test>.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 <liuzhiqiang26@huawei.com>
---
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

View File

@ -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 <liuzhiqiang26@huawei.com> 1.4.9.1-3
- fix one coredump problem with dirwidth=1
* Wed Jul 07 2021 wangxiaomeng <wangxiaomeng@kylinos.cn> 1.4.9.1-2
- chang to autosetup