]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests/ublk: fix IO thread idle check
authorMing Lei <ming.lei@redhat.com>
Tue, 13 Jan 2026 08:58:00 +0000 (16:58 +0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 21 Jan 2026 14:54:55 +0000 (07:54 -0700)
Include cmd_inflight in ublk_thread_is_done() check. Without this,
the thread may exit before all FETCH commands are completed, which
may cause device deletion to hang.

Fixes: 6aecda00b7d1 ("selftests: ublk: add kernel selftests for ublk")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
tools/testing/selftests/ublk/kublk.c

index 185ba553686abea11e90919da7518fb07227915e..f52431fe9b6cb90199796117a28526160dd71874 100644 (file)
@@ -753,7 +753,7 @@ static int ublk_thread_is_idle(struct ublk_thread *t)
 
 static int ublk_thread_is_done(struct ublk_thread *t)
 {
-       return (t->state & UBLKS_T_STOPPING) && ublk_thread_is_idle(t);
+       return (t->state & UBLKS_T_STOPPING) && ublk_thread_is_idle(t) && !t->cmd_inflight;
 }
 
 static inline void ublksrv_handle_tgt_cqe(struct ublk_thread *t,