From: Bart Van Assche <bvanassche@acm.org>
To: Alice Chao <alice.chao@mediatek.com>,
jejb@linux.ibm.com, martin.petersen@oracle.com,
matthias.bgg@gmail.com, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Cc: stanley.chu@mediatek.com, peter.wang@mediatek.com,
chun-hung.wu@mediatek.com, powen.kao@mediatek.com,
cc.chou@mediatek.com, chaotian.jing@mediatek.com,
jiajie.hao@mediatek.com, qilin.tan@mediatek.com,
lin.gui@mediatek.com, yanxu.wei@mediatek.com,
wsd_upstream@mediatek.com
Subject: Re: [PATCH v4 1/1] scsi: Fix racing between dev init and dev reset
Date: Fri, 15 Apr 2022 21:49:51 -0700 [thread overview]
Message-ID: <3164cd23-28b5-e971-c7a9-1b565b344ed5@acm.org> (raw)
In-Reply-To: <20220415061243.30229-2-alice.chao@mediatek.com>
On 4/14/22 23:12, Alice Chao wrote:
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index 0a70aa763a96..abf9a71ed77c 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -2461,6 +2461,7 @@ static void scsi_evt_emit(struct scsi_device *sdev, struct scsi_event *evt)
> break;
> case SDEV_EVT_POWER_ON_RESET_OCCURRED:
> envp[idx++] = "SDEV_UA=POWER_ON_RESET_OCCURRED";
> + wait_event(sdev->host->host_wait, sdev->sdev_gendev.kobj.parent != NULL);
> break;
> default:
> /* do nothing */
> diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
> index f4e6c68ac99e..431f229ac435 100644
> --- a/drivers/scsi/scsi_scan.c
> +++ b/drivers/scsi/scsi_scan.c
> @@ -1904,6 +1904,7 @@ static void do_scsi_scan_host(struct Scsi_Host *shost)
> } else {
> scsi_scan_host_selected(shost, SCAN_WILD_CARD, SCAN_WILD_CARD,
> SCAN_WILD_CARD, 0);
> + wake_up(&shost->host_wait);
> }
> }
The above patch can only work if scanning a host is followed by a POWER
ON unit attention. I don't think that is guaranteed. Additionally, what
will happen with the wait loop if the device generates a POWER on unit
attention after the device has been removed from its parent?
kobject_del() clears the parent pointer. device_del() calls
kobject_del(). scsi_remove_device() calls device_del() before the
request queue is destroyed.
Thanks,
Bart.
prev parent reply other threads:[~2022-04-16 4:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-15 6:12 Alice Chao
2022-04-16 4:49 ` Bart Van Assche [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=3164cd23-28b5-e971-c7a9-1b565b344ed5@acm.org \
--to=bvanassche@acm.org \
--cc=alice.chao@mediatek.com \
--cc=cc.chou@mediatek.com \
--cc=chaotian.jing@mediatek.com \
--cc=chun-hung.wu@mediatek.com \
--cc=jejb@linux.ibm.com \
--cc=jiajie.hao@mediatek.com \
--cc=lin.gui@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=matthias.bgg@gmail.com \
--cc=peter.wang@mediatek.com \
--cc=powen.kao@mediatek.com \
--cc=qilin.tan@mediatek.com \
--cc=stanley.chu@mediatek.com \
--cc=wsd_upstream@mediatek.com \
--cc=yanxu.wei@mediatek.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
all inboxes | Powered by JetHome®