backend: respect return value of init_io_u_buffers
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Thu, 1 Dec 2022 02:44:25 +0000 (11:44 +0900)
committerJens Axboe <axboe@kernel.dk>
Thu, 1 Dec 2022 02:58:34 +0000 (19:58 -0700)
When workloads require large buffer for I/O, fio fails to allocate I/O
buffer but does not report meaningful error message. It just accesses
to null pointer and fail with signal 11. This symptom is observed with
the command line below:

$ fio --name=job --filename=/tmp/fio --rw=write --bs=1g --size=1g \
      --iodepth=128 --ioengine=libaio

The I/O buffer allocation is done in function init_io_u_buffers. The
allocation failure is not reported because return value of the function
is ignored. Check the return value and report to the higher layer.

Fixes: 71e6e5a2fd5c ("iolog replay: Realloc io_u buffers to adapt to operation size.")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20221201024425.2340442-1-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
backend.c
blktrace.c
iolog.c

index ba954a6b64d4db8acb704d18a6cb1d58c7585447..928e524a370c21abb0a6cf1a232e29525a55185b 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -1301,7 +1301,8 @@ static int init_io_u(struct thread_data *td)
                }
        }
 
-       init_io_u_buffers(td);
+       if (init_io_u_buffers(td))
+               return 1;
 
        if (init_file_completion_logging(td, max_units))
                return 1;
index 00e5f9a9b7d2b621b80bc50008b1b8f391f6ee76..d5c8aee70b9f5fbe357094c8894f8ca59ee7d201 100644 (file)
@@ -545,7 +545,8 @@ bool read_blktrace(struct thread_data* td)
                        td->o.max_bs[DDIR_TRIM] = max(td->o.max_bs[DDIR_TRIM], rw_bs[DDIR_TRIM]);
                        io_u_quiesce(td);
                        free_io_mem(td);
-                       init_io_u_buffers(td);
+                       if (init_io_u_buffers(td))
+                               return false;
                }
                return true;
        }
diff --git a/iolog.c b/iolog.c
index aa9c3bb1e4eca43fa0cf1c9794df39656ba80972..62f2f524c7fd1872dab98e608894ebeaa9ae98aa 100644 (file)
--- a/iolog.c
+++ b/iolog.c
@@ -620,7 +620,8 @@ static bool read_iolog(struct thread_data *td)
                {
                        io_u_quiesce(td);
                        free_io_mem(td);
-                       init_io_u_buffers(td);
+                       if (init_io_u_buffers(td))
+                               return false;
                }
                return true;
        }