* [bug] Crash with multiple file names
@ 2009-04-20 1:07 Carl Henrik Lunde
2009-04-20 6:41 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Carl Henrik Lunde @ 2009-04-20 1:07 UTC (permalink / raw)
To: fio
Hi! fio crashed with this configuration. I notice there are a
multiple variables counting the number of files, so I don't know which
one to use. nr_files *seems* safe?
diff --git a/filesetup.c b/filesetup.c
index af23191..eb8774a 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -685,8 +685,8 @@ int add_file(struct thread_data *td, const char *fname)
f->fd = -1;
- if (td->files_size <= td->files_index) {
- int new_size = td->o.nr_files;
+ if (td->files_size <= td->o.nr_files) {
+ int new_size = td->o.nr_files + 1;
dprint(FD_FILE, "resize file array to %d files\n", new_size);
Test config:
[global]
directory=/media/ext4
[a]
filename=large-001:large-002:large-003:large-004:large-005:large-006
bs=1M
rw=read
x86_64, fio 1.25.1
--
mvh
Carl Henrik
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [bug] Crash with multiple file names
2009-04-20 1:07 [bug] Crash with multiple file names Carl Henrik Lunde
@ 2009-04-20 6:41 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2009-04-20 6:41 UTC (permalink / raw)
To: Carl Henrik Lunde; +Cc: fio
On Mon, Apr 20 2009, Carl Henrik Lunde wrote:
> Hi! fio crashed with this configuration. I notice there are a
> multiple variables counting the number of files, so I don't know which
> one to use. nr_files *seems* safe?
>
> diff --git a/filesetup.c b/filesetup.c
> index af23191..eb8774a 100644
> --- a/filesetup.c
> +++ b/filesetup.c
> @@ -685,8 +685,8 @@ int add_file(struct thread_data *td, const char *fname)
>
> f->fd = -1;
>
> - if (td->files_size <= td->files_index) {
> - int new_size = td->o.nr_files;
> + if (td->files_size <= td->o.nr_files) {
> + int new_size = td->o.nr_files + 1;
>
> dprint(FD_FILE, "resize file array to %d files\n", new_size);
Woops, that is indeed an off-by-one! I have added your patch, thanks.
Your reading of the code is correct. ->o.nr_files is the total number of
files.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-04-20 6:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-20 1:07 [bug] Crash with multiple file names Carl Henrik Lunde
2009-04-20 6:41 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox