Re: [BUG] mmap and file init with 0 length

From: Jens Axboe <jens.axboe_at_oracle.com>
Date: Wed, 26 Mar 2008 09:20:02 +0100

On Wed, Mar 26 2008, Zhang, Yanmin wrote:
> fio is killed with a SIGBUS. Pls. see below job file.
>
> Actually, if the ioengine=mmap and rw=write/randwrite, fio just
> unlinks the file and creates a new file whose length is 0. sys_mmap
> could succeed, but later on when fio accesses the mmapped area, kernel
> will send fio a SIGBUS and kill it.
>
>
> Could fio create a real file when ioengine=mmap and
> rw=write/randwrite? For exmaple, below job_file could ask fi oto
> create file data0/f1 whose length is 4G.
>

I've committed a fix for this, the below one-liner should fix it for
you.

diff --git a/filesetup.c b/filesetup.c
index e847276..bb43ee5 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -30,7 +30,8 @@ static int extend_file(struct thread_data *td, struct fio_file *f)
          * does that for operations involving reads, or for writes
          * where overwrite is set
          */
- if (td_read(td) || (td_write(td) && td->o.overwrite))
+ if (td_read(td) || (td_write(td) && td->o.overwrite) ||
+ (td_write(td) && td->io_ops->flags & FIO_NOEXTEND))
                 new_layout = 1;
         if (td_write(td) && !td->o.overwrite)
                 unlink_file = 1;

-- 
Jens Axboe
Received on Wed Mar 26 2008 - 09:20:02 CET

This archive was generated by hypermail 2.2.0 : Wed Mar 26 2008 - 09:30:17 CET