From: Wei Fang <fangwei1@huawei.com>
To: Bart Van Assche <Bart.VanAssche@sandisk.com>,
"jejb@linux.vnet.ibm.com" <jejb@linux.vnet.ibm.com>,
"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"tyasui@redhat.com" <tyasui@redhat.com>
Subject: Re: [PATCH] scsi: avoid a permanent stop of the scsi device's request queue
Date: Wed, 7 Dec 2016 14:59:33 +0800 [thread overview]
Message-ID: <5847B355.2050100@huawei.com> (raw)
In-Reply-To: <BLUPR02MB1683A85CB4376E9904F1B38881850@BLUPR02MB1683.namprd02.prod.outlook.com>
Hi, Bart,
On 2016/12/7 12:40, Bart Van Assche wrote:
> I am aware that commit 5c10e63c943b caused the behavior change. But that
> doesn't mean that a fix has to undo the changes introduced by that
> commit. We do not only want to make sure that the SCSI core works as
> intended but also that the SCSI core code is as easy to comprehend as
> reasonably possible. Adding "&& sdev->sdev_state != SDEV_RUNNING" in
> scsi_internal_device_unblock() would require a long comment to explain
> why that code has been added. I think modifying scsi_sysfs_add_sdev()
> such that it does not unblock devices will result in code that is easier
> to understand.
Agree that we should make the code easier to comprehend if possible :)
If we modify scsi_sysfs_add_sdev() as below:
...
if (scsi_device_created(sdev))
error = scsi_device_set_state(sdev, SDEV_RUNNING);
if (error)
error = scsi_device_set_state(sdev, SDEV_BLOCK);
...
there's a chance that the state will be changed to SDEV_RUNNING.
If a SCSI device is blocked after the check of the device's creating
and before being changed to SDEV_RUNNING state, the state will still
become SDEV_RUNNING. If we fix this problem in this way, we need
introduce a way to synchronize those code.
Actually I don't know quite well about the synchronization of
scsi_device_set_state(). There are so many cases it can be called
simultaneously, will the state become a unpredictable value, or this
is tolerated?
Thanks,
Wei
next prev parent reply other threads:[~2016-12-07 7:03 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-06 9:12 [PATCH] scsi: avoid a permanent stop of the scsi device's request queue Wei Fang
2016-12-06 15:51 ` Bart Van Assche
2016-12-07 1:20 ` Wei Fang
2016-12-07 2:45 ` Bart Van Assche
2016-12-07 3:41 ` Wei Fang
2016-12-07 4:40 ` Bart Van Assche
2016-12-07 6:59 ` Wei Fang [this message]
2016-12-07 16:48 ` Bart Van Assche
2016-12-07 16:55 ` Bart Van Assche
2016-12-07 17:40 ` Ewan D. Milne
2016-12-07 18:16 ` James Bottomley
2016-12-07 19:24 ` Ewan D. Milne
2016-12-07 20:09 ` James Bottomley
2016-12-07 20:30 ` Ewan D. Milne
2016-12-07 23:43 ` James Bottomley
2016-12-08 2:28 ` Wei Fang
2016-12-08 2:33 ` James Bottomley
2016-12-08 3:22 ` Wei Fang
2016-12-08 6:38 ` Wei Fang
2016-12-08 14:04 ` Ewan D. Milne
2016-12-08 15:39 ` James Bottomley
2016-12-09 1:08 ` Wei Fang
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=5847B355.2050100@huawei.com \
--to=fangwei1@huawei.com \
--cc=Bart.VanAssche@sandisk.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=tyasui@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.