Re: [dm-devel] [PATCH -next v2 4/6] md: refactor idle/frozen_sync_thread() to fix deadlock

From
Xiao Ni <hidden>
Date
2023-06-15 09:15:25
Also in
dm-devel, lkml
Reply to
Yu Kuai, 2023-06-15
On Thu, Jun 15, 2023 at 5:05 PM Yu Kuai [off-list ref] wrote:
Hi,

在 2023/06/15 16:17, Xiao Ni 写道:
quoted
quoted
Thanks for the example. I can understand the usage of it. It's the
side effect that removes the mutex protection for idle_sync_thread.

There is a problem. New sync thread is started in md_check_recovery.
After your patch, md_reap_sync_thread is called in md_check_recovery
too. So it looks like they can't happen at the same time?
Of course they can't. md_check_recovery() can only do one thing at a
time.
quoted
After thinking a while, there is still a race possibility.

md_reap_sync_thread is called in pers deamon (e.g. raid10d ->
md_check_recovery) and md_check_recovery returns. Before
idle_sync_thread is woken, the new sync thread can be started in
md_check_recovery again.

But it's really strange, when one people echo idle to sync_action.
It's better to add some messages to notify the users that they need to
echo idle to sync_action again to have a try. Is there a way that
md_reap_sync_thread can wait idle_sync_thread?
I don't think this is a problem, echo idle only make sure to interupt
current sync_thread, there is no gurantee that sync_thread is not
running after "echo idle" is done with or without this patchset, before
this patchset, new sync thread can still start after the mutex is
released.

User shoud "echo forzen" instead of "echo idle" if they really what to
avoid new sync_thread to start.
Thanks for all the explanations and patience.

Regards
Xiao
Thanks,
Kuai
quoted
Regards
Xiao
quoted
Regards
Xiao
quoted
Thanks,
Kuai

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
.
  
Thread (37 messages) 37 messages, 3 authors, last reply 2023-06-16
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help