From: John Garry <john.garry@linux.dev>
To: Bart Van Assche <bvanassche@acm.org>,
"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi@vger.kernel.org,
syzbot+1f678bd2872aefb11d8a@syzkaller.appspotmail.com,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K. Petersen" <mkp@kernel.org>
Subject: Re: [PATCH] scsi: core: Make SCSI host scan interruptible
Date: Mon, 21 Sep 2026 09:50:30 +0100 [thread overview]
Message-ID: <b0768abb-8ecf-4622-bbf3-1b3d8f926ef5@linux.dev> (raw)
In-Reply-To: <74786683eadc0a32ab335373ead8dd76a9d5a342.1789157339.git.bvanassche@acm.org>
On 9/11/26 21:11, Bart Van Assche wrote:
> Writing to the sysfs "scan" attribute serializes SCSI host scans via
> shost->scan_mutex. In virtualized environments such as virtio-scsi with
> 256 target IDs, scanning non-existent targets repeatedly allocates and
> destroys temporary scsi_devices. Each iteration transitions the shared tag
> queue state and freezes request queues, causing a full bus scan to take
> tens of seconds.
So does this scan use all wildcard "- - -"?
>
> When multiple processes initiate host scans concurrently, waiter tasks
> sleep in TASK_UNINTERRUPTIBLE on shost->scan_mutex. If the waiting tasks
> receive signals such as SIGKILL, they cannot wake up until the mutex is
> acquired, easily exceeding the hung task timeout and triggering
> khungtaskd warnings ("INFO: task hung in scsi_scan_host_selected").
> Furthermore, once a task finally acquires the mutex, it continues to
> perform the full scan even if a fatal signal is already pending.
>
> Fix this by:
> 1. Use mutex_lock_interruptible() instead of mutex_lock() in
> scsi_scan_host_selected(), allowing waiting tasks to sleep in
> TASK_INTERRUPTIBLE and immediately wake up with -EINTR on signals.
> 2. Check signal_pending(current) in scsi_scan_host_selected(),
> scsi_scan_channel(), __scsi_scan_target(), scsi_report_lun_scan(),
> and scsi_sequential_lun_scan() to abort scanning early when a signal
> is delivered.
If you want to be able to cancel a scan which is in progress, then why
run it in the first place? I don't understand how this helps.
prev parent reply other threads:[~2026-09-21 8:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 20:11 [PATCH] scsi: core: Make SCSI host scan interruptible Bart Van Assche
2026-09-11 20:23 ` sashiko-bot
2026-09-11 21:18 ` Bart Van Assche
2026-09-17 1:19 ` Stanley Jhu
2026-09-18 22:19 ` Bart Van Assche
2026-09-21 8:50 ` John Garry [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b0768abb-8ecf-4622-bbf3-1b3d8f926ef5@linux.dev \
--to=john.garry@linux.dev \
--cc=James.Bottomley@HansenPartnership.com \
--cc=bvanassche@acm.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=mkp@kernel.org \
--cc=syzbot+1f678bd2872aefb11d8a@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox