From: Jens Axboe <jens.axboe@oracle.com>
To: Erwan Velu <erwan@seanodes.com>
Cc: fio@vger.kernel.org
Subject: Re: Passing argument to both write_bw_log & write_lat_log leads to segfault
Date: Wed, 19 Nov 2008 12:28:29 +0100 [thread overview]
Message-ID: <20081119112829.GA26308@kernel.dk> (raw)
In-Reply-To: <4923F729.1030200@seanodes.com>
On Wed, Nov 19 2008, Erwan Velu wrote:
> Using fio 1.23:
> [root@max13 tmp]# fio myconfigfile
> Segmentation fault (core dumped)
>
>
> Where myconfigfile is the following:
> [global]
> bsrange=64k-128k,64k-128k
> direct=1
> ioengine=libaio
> iodepth=2
> zonesize=256m
> zoneskip=2g
>
> [/dev/exa/g1/v1]
> rw=read
> write_bw_log read-bw
> write_lat_log read-lat
>
> [/dev/exa/g1/v1]
> stonewall
> rw=write
> write_bw_log write-bw
> write_lat_log write-lat
>
> Note: removing one or the other parameter to write_*_log reports an error
> like "Bad option write_lat_log read-lat" but letting both of them segfault.
>
> I did this syntaxe as the man page says :
> write_bw_log
> If given, write bandwidth logs of the jobs in this file.
>
> I thought that "this file" meant a parameter.
Wow, you are handy at finding old bugs that nobody has hit :-). The
below should fix it.
Generally, fio always wants a '=' to assign a value to a parameter. But
of course the parser should not crash...
diff --git a/parse.c b/parse.c
index 456e3ba..5f7d033 100644
--- a/parse.c
+++ b/parse.c
@@ -487,7 +487,7 @@ static int opt_cmp(const void *p1, const void *p2)
{
struct fio_option *o1, *o2;
char *s1, *s2, *foo;
- int ret;
+ int prio1, prio2;
s1 = strdup(*((char **) p1));
s2 = strdup(*((char **) p2));
@@ -495,14 +495,15 @@ static int opt_cmp(const void *p1, const void *p2)
o1 = get_option(s1, fio_options, &foo);
o2 = get_option(s2, fio_options, &foo);
- if ((!o1 && o2) || (o1 && !o2))
- ret = 0;
- else
- ret = o2->prio - o1->prio;
+ prio1 = prio2 = 0;
+ if (o1)
+ prio1 = o1->prio;
+ if (o2)
+ prio2 = o2->prio;
free(s1);
free(s2);
- return ret;
+ return prio2 - prio1;
}
void sort_options(char **opts, struct fio_option *options, int num_opts)
--
Jens Axboe
next prev parent reply other threads:[~2008-11-19 11:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-19 11:23 Passing argument to both write_bw_log & write_lat_log leads to segfault Erwan Velu
2008-11-19 11:28 ` Jens Axboe [this message]
2008-11-19 15:10 ` Erwan Velu
2008-11-19 15:15 ` Jens Axboe
2008-11-19 15:20 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081119112829.GA26308@kernel.dk \
--to=jens.axboe@oracle.com \
--cc=erwan@seanodes.com \
--cc=fio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.