Skip to content

Commit

Permalink
fix assert failed when timeout during call rate_ddir.
Browse files Browse the repository at this point in the history
Adding DDIR_TIMEOUT in enum fio_ddir, and rate_ddir returns it when fio timeouts.
set_io_u_file will directly break out of the loop, and fill_io_u won't be called,
which causes assert to fail in rate_ddir, because td->rwmix_ddir is DDIR_INVAL.

Signed-off-by: QingSong Zhu zhuqingsong.0909@bytedance.com
  • Loading branch information
zqs-Oppenauer committed Oct 19, 2023
1 parent c5d8ce3 commit e8a0b53
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions io_ddir.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ enum fio_ddir {
DDIR_WAIT,
DDIR_LAST,
DDIR_INVAL = -1,
DDIR_TIMEOUT = -2,

DDIR_RWDIR_CNT = 3,
DDIR_RWDIR_SYNC_CNT = 4,
Expand Down
10 changes: 7 additions & 3 deletions io_u.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ static enum fio_ddir rate_ddir(struct thread_data *td, enum fio_ddir ddir)
* check if the usec is capable of taking negative values
*/
if (now > td->o.timeout) {
ddir = DDIR_INVAL;
ddir = DDIR_TIMEOUT;
return ddir;
}
usec = td->o.timeout - now;
Expand All @@ -726,7 +726,7 @@ static enum fio_ddir rate_ddir(struct thread_data *td, enum fio_ddir ddir)

now = utime_since_now(&td->epoch);
if ((td->o.timeout && (now > td->o.timeout)) || td->terminate)
ddir = DDIR_INVAL;
ddir = DDIR_TIMEOUT;

return ddir;
}
Expand Down Expand Up @@ -951,7 +951,7 @@ static int fill_io_u(struct thread_data *td, struct io_u *io_u)

set_rw_ddir(td, io_u);

if (io_u->ddir == DDIR_INVAL) {
if (io_u->ddir == DDIR_INVAL || io_u->ddir == DDIR_TIMEOUT) {
dprint(FD_IO, "invalid direction received ddir = %d", io_u->ddir);
return 1;
}
Expand Down Expand Up @@ -1419,6 +1419,10 @@ static long set_io_u_file(struct thread_data *td, struct io_u *io_u)
put_file_log(td, f);
td_io_close_file(td, f);
io_u->file = NULL;

if (io_u->ddir == DDIR_TIMEOUT)
return 1;

if (td->o.file_service_type & __FIO_FSERVICE_NONUNIFORM)
fio_file_reset(td, f);
else {
Expand Down
1 change: 1 addition & 0 deletions zbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2171,6 +2171,7 @@ enum io_u_action zbd_adjust_block(struct thread_data *td, struct io_u *io_u)
case DDIR_WAIT:
case DDIR_LAST:
case DDIR_INVAL:
case DDIR_TIMEOUT:
goto accept;
}

Expand Down

0 comments on commit e8a0b53

Please sign in to comment.