Fix a potentially infinite loop in check_overlap()
authorBart Van Assche <bvanassche@acm.org>
Sat, 13 Jun 2020 18:23:39 +0000 (11:23 -0700)
committerBart Van Assche <bvanassche@acm.org>
Sat, 4 Jul 2020 04:20:30 +0000 (21:20 -0700)
commitc76b661c50fdd085f8ac08c0028b5083b238b8e8
treeda05dd96e8f875d384a7c9c16ee824bc29655b6d
parent0a9b8988fab0c3365431cef19391c6f2e7b9b509
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>
rate-submit.c