Coverity reported a defect related to the local variable "in_flight":
Using an unreliable value of "in_flight" inside the second locked
section. If the data that "in_flight" depends on was changed by
another thread, this use might be incorrect.
The variable "in_flight" is thread local and other threads can not
change its value. Then the report should be false-positive. Just to
suppress the report, change reference timing of the valuable.
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Link: https://lore.kernel.org/r/20230609235914.1376567-1-shinichiro.kawasaki@wdc.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
dprint(FD_ZBD,
"%s(%s): wait zone write and retry write target zone selection\n",
__func__, f->file_name);
+ should_retry = in_flight;
pthread_mutex_unlock(&zbdi->mutex);
zone_unlock(z);
io_u_quiesce(td);
zone_lock(td, f, z);
- should_retry = in_flight;
goto retry;
}