From 62ac66490f5077e5fca1bd5b49165147cafc5a0d Mon Sep 17 00:00:00 2001 From: Shin'ichiro Kawasaki Date: Sat, 10 Jun 2023 08:59:14 +0900 Subject: [PATCH] zbd: avoid Coverity defect report 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 Link: https://lore.kernel.org/r/20230609235914.1376567-1-shinichiro.kawasaki@wdc.com Signed-off-by: Jens Axboe --- zbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zbd.c b/zbd.c index 9455140a..7fcf1ec4 100644 --- a/zbd.c +++ b/zbd.c @@ -1547,11 +1547,11 @@ retry: 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; } -- 2.25.1