[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 4 Mar 2022 06:58:18 +0800
From: Miles Chen <miles.chen@...iatek.com>
To: <alice.chao@...iatek.com>
CC: <cc.chou@...iatek.com>, <chaotian.jing@...iatek.com>,
<chun-hung.wu@...iatek.com>, <jejb@...ux.ibm.com>,
<jiajie.hao@...iatek.com>, <jonathan.hsu@...iatek.com>,
<lin.gui@...iatek.com>, <linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>,
<linux-mediatek@...ts.infradead.org>, <linux-scsi@...r.kernel.org>,
<martin.petersen@...cle.com>, <matthias.bgg@...il.com>,
<peter.wang@...iatek.com>, <powen.kao@...iatek.com>,
<qilin.tan@...iatek.com>, <stanley.chu@...iatek.com>,
<wsd_upstream@...iatek.com>, <yanxu.wei@...iatek.com>
Subject: Re: [PATCH 1/1] scsi: Fix racing between dev init and dev reset
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@...iatek.com>
> Change-Id: I2848cf054186739d3a125a0635dbed5539557e64
please remove Change-Id here
thanks,
Miles
Powered by blists - more mailing lists