io_u: only rewind file position if it's non-zero
authorJens Axboe <axboe@kernel.dk>
Tue, 13 Mar 2018 17:49:55 +0000 (11:49 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 13 Mar 2018 17:49:55 +0000 (11:49 -0600)
commit69b98f11d62cb12482130fac79b8ebf00c0bb139
tree030aebc2e7de6fbfdbc39e2274bdee630eaa4341
parent26532556b53e08cc5ccf190134a1f782e82a7ef0
io_u: only rewind file position if it's non-zero

This:

bs=8k
rw=read:-4k

is supposed to read 0..8k, then add 8k and subtract 4k, ending
up with a next read at 4k..12k and so forth. But we rewind too
quickly, and the first IO fails as being out-of-bounds.

Fixes: c22825bb537af ("Fix backwards reads with --size smaller than the file size")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_u.c