From a9f70b1f50879346fb065497951352ad4e1e0f11 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Mon, 8 Jul 2013 20:32:50 -0400 Subject: [PATCH] Make sure io_u->buflen is aligned to the verify_interval If you specify verify and bs_unaligned you can make fio blow up in interesting ways. This is because the verify code assumes that the buflens will be bs aligned and therefore aligned to the verify_interval. However this isn't the case for bs_unaligned. So to fix this make sure we are always aligned to verify_interval. This keeps us from reading off the end of our io buf, or worse writing past the end of it and makes this fio job pass properly instead of blowing up. Thanks, Signed-off-by: Josef Bacik Signed-off-by: Jens Axboe --- io_u.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/io_u.c b/io_u.c index 11672cf3..865c5826 100644 --- a/io_u.c +++ b/io_u.c @@ -459,6 +459,10 @@ static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u) } } + if (td->o.do_verify && td->o.verify != VERIFY_NONE) + buflen = (buflen + td->o.verify_interval - 1) & + ~(td->o.verify_interval - 1); + if (!td->o.bs_unaligned && is_power_of_2(minbs)) buflen = (buflen + minbs - 1) & ~(minbs - 1); -- 2.25.1