Thread (3 messages) 3 messages, 3 authors, 2023-02-24

Re: question about 5e8daf906f89 ("md: Flush workqueue md_rdev_misc_wq in md_alloc()”)

From: Logan Gunthorpe <logang@deltatee.com>
Date: 2023-02-24 16:44:29


On 2023-02-23 19:11, Hou Tao wrote:
Hi,

On 2/10/2023 10:10 AM, Li Nan wrote:
quoted
Hi,
Commit log says there is race condition in md_rdev_misc_wq, but I find nothing
wrong with it. Could you tell me how to trigger the bug?

Thansks,
nan.
We want to back-port commit 5e8daf906f89 ("md: Flush workqueue md_rdev_misc_wq
in md_alloc()") into v5.10 LTS, but only judging from its commit message, we
don't know whether it is a good candidate or not. According to my understanding,
the commit tries to wait for the deletion and the release of rdev kobject. The
release of rdev kobject will call rdev_free() to free the allocated memory and
it will not being related with any race, so I think the race mentioned in commit
message must be related with the deletion of rdev kobject. Because the parent of
rdev kobject is mddev and rdev kobject must have been acquired one reference of
mddev kobject, so if the deletion of rdev kobject doesn't completes,
md_kobj_release() and its callee del_gendisk() will be not called, right ? If
the previous created mddev has not already called del_gendisk(), the current
creation of mddev with the same name will fail in add_disk() or kobject_add(). I
think this is the mentioned race in the commit message, right ? If that is the
case, v5.10 LTS also have the same race problem. We will try to reproduce the
problem and post it to v5.10 LTS.

Yes, that sounds correct. I expect v5.10 will have the same problem and
it is a good candidate to back port.

Logan

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help