Re: [PATCH] scsi: core: Protect host_busy reads against tag set teardown

From: Shuo Qin

Date: Wed Dec 02 2026 - 21:42:13 EST


Hi Bart,

> ... adding a kref_get() call before scsi_remove_host() and a kref_put()
> call after shost_busy has been removed?

I scoped the tag-set reference to show_host_busy() so that each read
pins the tag set only while it walks the busy requests.

If you mean taking an extra tag-set reference before
scsi_remove_host() and dropping it after host_busy is removed,
scsi_remove_host() would wait indefinitely with the current ordering.
It waits for tagset_freed before unregistering shost_dev, so it
cannot reach the point where host_busy is removed while that reference
is held.

Did you have in mind removing host_busy and waiting for any active
callbacks to finish before dropping the host's tag-set reference?
I can rework the patch that way if that's what you had in mind.

The original patch is available here:
https://lore.kernel.org/r/20261202120443.15341-1-23159100078@xxxxxxxxxxxxxxxxx

Thanks,
Shuo