Re: [PATCH v2 2/3] scsi: introduce 'blocked' sysfs api

From: Mike Christie
Date: Tue Mar 28 2023 - 12:07:08 EST


On 3/28/23 9:34 AM, Ye Bin wrote:
> From: Ye Bin <yebin10@xxxxxxxxxx>
>
> Introduce 'blocked' sysfs api to control scsi host blocking IO.
> Use this founction for test. Perhaps we can use this to do some fault
> recovery or firmware upgrades, as long as the driver support is good,

If it's for testing only then do people like a debugfs type of interface
is better?

If it's for actual production use like firmware upgrades and they can't
handle IO while they are doing the upgrade, then I think you need to do
more than just set a bit to prevent new IO. You also need to handle cmds
that have passed the scsi_queue_rq ready checks and have not been processed
by the driver's queuecommand. Also there are some issues like cmds can
still timeout and so you will get scsi_host_template->eh* calls still.


>
> diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
> index 587cc767bb67..3e916dbac1cb 100644
> --- a/include/scsi/scsi_host.h
> +++ b/include/scsi/scsi_host.h
> @@ -659,6 +659,9 @@ struct Scsi_Host {
> /* The transport requires the LUN bits NOT to be stored in CDB[1] */
> unsigned no_scsi2_lun_in_cdb:1;
>
> + /* True host will blocking IO */
> + unsigned host_blockio:1;
> +

Maybe rename to host_user_blocked to match the host_self_blocked naming.

I would make the comment similar to host_self_blocked's comment but
instead of the host requesting it userspace did.

> /*
> * Optional work queue to be utilized by the transport
> */