selftests: ublk: make ublk_stop_io_daemon() more reliable
authorMing Lei <ming.lei@redhat.com>
Mon, 3 Mar 2025 12:43:11 +0000 (20:43 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 10 Mar 2025 15:17:13 +0000 (09:17 -0600)
commit9894e0eaae980df1ed3f2e86a487fe4c8ef1ab46
treed43c75dea05f4e5bf497f98ed25f72cf65de6677
parent30c970354ce2a4c6ad3a4c70040accd34082f477
selftests: ublk: make ublk_stop_io_daemon() more reliable

Improve ublk_stop_io_daemon() in the following ways:

- don't wait if ->ublksrv_pid becomes -1, which means that the disk
has been stopped

- don't wait if ublk char device doesn't exist any more, so we can
avoid to rely on inoitfy for wait until the char device is closed

And this way may reduce time of delete command a lot.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Link: https://lore.kernel.org/r/20250303124324.3563605-2-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
tools/testing/selftests/ublk/kublk.c