Flexible I/O Tester development
 help / color / mirror / Atom feed
* Fix a bug of rbd engine when specify invalidate=1 or fadvise_hint=1
@ 2014-05-19 17:38 xan.peng
  2014-05-19 19:35 ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: xan.peng @ 2014-05-19 17:38 UTC (permalink / raw)
  To: Jens Axboe, daniel.gollub, fio@vger.kernel.org

When specify invalidate=1 or fadvise_hint=1, fio will call
posix_fadvise(2), which will return -EBADF and prevent fio librbd
engine acting normally.
Here is the call path: ... > td_io_open_file() >
file_invalidate_cache() > __file_invalidate_cache() > posix_fadvise(fd
= -1) > ...

The patch work-around this problem by setting file type to
FIO_TYPE_CHAR in fio_rbd_open().

Here the GitHub pull request: https://github.com/axboe/fio/pull/11.

Signed-off-by: Xan Peng xanpeng@gmail.com
---
diff --git a/engines/rbd.c b/engines/rbd.c
index dc6e7db..f5f7a06 100644
--- a/engines/rbd.c
+++ b/engines/rbd.c
@@ -401,6 +401,16 @@ cleanup:

 static int fio_rbd_open(struct thread_data *td, struct fio_file *f)
 {
+       /*
+        * This is to work-around mandatory setting of "invalidate=0".
+        *
+        * As files used in rbd engine is artificial (fd equals -1), with
+        * "invalidte=1" or "fadvise_hint=1" set, fio will call posix_fadvise(2)
+        * and EBADF will be returned.
+        *
+        * Set file type to FIO_TYPE_CHAR will work-around call of
posix_fadvise(2).
+        */
+       f->filetype = FIO_TYPE_CHAR;
        return 0;
 }

diff --git a/examples/rbd.fio b/examples/rbd.fio
index fcb494a..aa34a99 100644
--- a/examples/rbd.fio
+++ b/examples/rbd.fio
@@ -15,7 +15,8 @@ ioengine=rbd
 clientname=admin
 pool=rbd
 rbdname=fio_test
-invalidate=0   # mandatory
+invalidate=0   # not mandatory, but set to 1 with no effect
+fadvise_hint=0 # not mandatory, but set to 1 with no effect
 rw=randwrite
 bs=4k


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-05-20  1:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-19 17:38 Fix a bug of rbd engine when specify invalidate=1 or fadvise_hint=1 xan.peng
2014-05-19 19:35 ` Jens Axboe
2014-05-20  1:32   ` xan.peng
2014-05-20  1:59     ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox