mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miles Chen <miles.chen@mediatek.com>
To: <alice.chao@mediatek.com>
Cc: <cc.chou@mediatek.com>, <chaotian.jing@mediatek.com>,
	<chun-hung.wu@mediatek.com>, <jejb@linux.ibm.com>,
	<jiajie.hao@mediatek.com>, <jonathan.hsu@mediatek.com>,
	<lin.gui@mediatek.com>, <linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-scsi@vger.kernel.org>, <martin.petersen@oracle.com>,
	<matthias.bgg@gmail.com>, <peter.wang@mediatek.com>,
	<powen.kao@mediatek.com>, <qilin.tan@mediatek.com>,
	<stanley.chu@mediatek.com>, <wsd_upstream@mediatek.com>,
	<yanxu.wei@mediatek.com>
Subject: Re: [PATCH 1/1] scsi: Fix racing between dev init and dev reset
Date: Fri, 4 Mar 2022 06:58:18 +0800	[thread overview]
Message-ID: <20220303225818.12752-1-miles.chen@mediatek.com> (raw)
In-Reply-To: <20220303075527.25258-2-alice.chao@mediatek.com>

Hi Alice,

> Device reset thread uses kobject_uevent_env() to get kobj.parent
> after scsi_evt_emit(), and it races with device init thread which
> calls device_add() to create kobj.parent before kobject_uevent_env().
> 
> Device reset call trace:
> fill_kobj_path
> kobject_get_path
> kobject_uevent_env
> scsi_evt_emit			<- add wait_event()
> scsi_evt_thread
> 
> Device init call trace:
> fill_kobj_path
> kobject_get_path
> kobject_uevent_env
> device_add				<- create kobj.parent
> scsi_target_add
> scsi_sysfs_add_sdev
> scsi_add_lun
> scsi_probe_and_add_lun
> 
> These two jobs are scheduled asynchronously, we can't guaranteed that
> kobj.parent will be created in device init thread before device reset
> thread calls kobj_get_path().
> 
> To resolve the racing issue between device init thread and device
> reset thread, we use wait_event() in scsi_evt_emit() to wait for
> device_add() to complete the creation of kobj.parent.
> 
> Signed-off-by: Alice Chao <alice.chao@mediatek.com>
> Change-Id: I2848cf054186739d3a125a0635dbed5539557e64

please remove Change-Id here

thanks,
Miles

      reply	other threads:[~2022-03-03 22:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03  7:55 Alice Chao
2022-03-03  7:55 ` Alice Chao
2022-03-03 22:58   ` Miles Chen [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=20220303225818.12752-1-miles.chen@mediatek.com \
    --to=miles.chen@mediatek.com \
    --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=jonathan.hsu@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®