Skip to content

Commit

Permalink
Fix "verify bad_hdr rand_seed" for requeued I/Os
Browse files Browse the repository at this point in the history
On configurations that can cause I/Os to be internally requeued from
FIO_Q_BUSY such as '--iodepth_batch_complete_max', and the workload has
verify enabled, the subsequent verification of the data fails with a bad
verify rand_seed because the pattern for the I/O is generated twice for
the same I/O, causing the seed to become out of sync when the verify is
later performed. The seed is generate twice because do_io() handles the
I/O twice, first when it originates the I/O and again when it later gets
the same I/O back from get_io_u() after it's is pulled from the requeue
list, which is where the first submission landed due to the workload
reaching '--iodepth_batch_complete_max'.

The fix is for do_io() to track when it has generated the verify pattern
for an I/O via a new io_u flag 'IO_U_F_PATTERN_DONE', avoiding a second
call to populate_verify_io_u() when that flag is detected.

Link: axboe#1526

Signed-off-by: Adam Horshack (horshack@live.com)
  • Loading branch information
horshack-dpreview committed Feb 27, 2023
1 parent 6946ad5 commit ad21b61
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -1040,8 +1040,11 @@ static void do_io(struct thread_data *td, uint64_t *bytes_done)
}

if (io_u->ddir == DDIR_WRITE && td->flags & TD_F_DO_VERIFY) {
io_u->numberio = td->io_issues[io_u->ddir];
populate_verify_io_u(td, io_u);
if (!(io_u->flags & IO_U_F_PATTERN_DONE)) {
io_u_set(td, io_u, IO_U_F_PATTERN_DONE);
io_u->numberio = td->io_issues[io_u->ddir];
populate_verify_io_u(td, io_u);
}
}

ddir = io_u->ddir;
Expand Down
2 changes: 1 addition & 1 deletion io_u.c
Original file line number Diff line number Diff line change
Expand Up @@ -2004,7 +2004,7 @@ static void io_completed(struct thread_data *td, struct io_u **io_u_ptr,
dprint_io_u(io_u, "complete");

assert(io_u->flags & IO_U_F_FLIGHT);
io_u_clear(td, io_u, IO_U_F_FLIGHT | IO_U_F_BUSY_OK);
io_u_clear(td, io_u, IO_U_F_FLIGHT | IO_U_F_BUSY_OK | IO_U_F_PATTERN_DONE);

/*
* Mark IO ok to verify
Expand Down
1 change: 1 addition & 0 deletions io_u.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ enum {
IO_U_F_TRIMMED = 1 << 5,
IO_U_F_BARRIER = 1 << 6,
IO_U_F_VER_LIST = 1 << 7,
IO_U_F_PATTERN_DONE = 1 << 8,
};

/*
Expand Down

0 comments on commit ad21b61

Please sign in to comment.