Fix a potentially infinite loop in check_overlap()
If the following happens:
* check_overlap() finds an overlap.
* All other threads finish after the overlap has been found and before
the next iteration of the do/while loop starts.
Then the do/while loop in check_overlap() will iterate forever. Fix this
by rewriting check_overlap() such that this cannot happen.
This patch fixes the following Coverity complaint:
CID 184174 (#2 of 2): Double lock (LOCK)
Fixes:
c06379a65d46 ("fio: enable overlap checking with offload submission")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>