From: Benjamin Block <bblock@linux.ibm.com>
To: Ye Bin <yebin@huaweicloud.com>
Cc: jejb@linux.ibm.com, martin.petersen@oracle.com,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
Ye Bin <yebin10@huawei.com>
Subject: Re: [PATCH] scsi: fix hung_task when change host from recovery to running via sysfs
Date: Tue, 21 Mar 2023 14:22:37 +0000 [thread overview]
Message-ID: <20230321142237.GC311313@t480-pf1aa2c2.fritz.box> (raw)
In-Reply-To: <20230321084204.1860900-1-yebin@huaweicloud.com>
On Tue, Mar 21, 2023 at 04:42:04PM +0800, Ye Bin wrote:
> From: Ye Bin <yebin10@huawei.com>
>
> When do follow test:
> Step1: echo "recovery" > /sys/class/scsi_host/host0/state
Hmm, that make me wonder, what potential use-case this is for? Just
testing?
For SDEVs we explicitly filter what states can be set from user-space.
Only `SDEV_RUNNING` and `SDEV_OFFLINE` can be set in
`store_state_field()`.
There is probably quite a few other bad things you can do with this
interface by using any of the other states used for device destruction
or EH, and then trigger I/O or said destruction/EH otherwise.
Not sure handling this one special case of `SHOST_RECOVERY` is quite
enough.
> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
> index ee28f73af4d4..ae6b1476b869 100644
> --- a/drivers/scsi/scsi_sysfs.c
> +++ b/drivers/scsi/scsi_sysfs.c
> @@ -216,6 +216,9 @@ store_shost_state(struct device *dev, struct device_attribute *attr,
>
> if (scsi_host_set_state(shost, state))
> return -EINVAL;
> + else
> + wake_up(&shost->host_wait);
> +
> return count;
> }
>
> --
> 2.31.1
>
--
Best Regards, Benjamin Block / Linux on IBM Z Kernel Development
IBM Deutschland Research & Development GmbH / https://www.ibm.com/privacy
Vors. Aufs.-R.: Gregor Pillen / Geschäftsführung: David Faller
Sitz der Ges.: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
next prev parent reply other threads:[~2023-03-21 14:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-21 8:42 [PATCH] scsi: fix hung_task when change host from recovery to running via sysfs Ye Bin
2023-03-21 14:22 ` Benjamin Block [this message]
2023-03-22 1:24 ` yebin (H)
2023-03-23 10:21 ` Benjamin Block
2023-03-23 15:57 ` Mike Christie
2023-03-23 16:12 ` Mike Christie
2023-03-24 1:41 ` yebin (H)
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=20230321142237.GC311313@t480-pf1aa2c2.fritz.box \
--to=bblock@linux.ibm.com \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=yebin10@huawei.com \
--cc=yebin@huaweicloud.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;
as well as URLs for NNTP newsgroup(s).