Thread (66 messages) 66 messages, 5 authors, 2024-02-29

Re: [PATCH v5 04/14] md: don't register sync_thread for reshape directly

From: Yu Kuai <hidden>
Date: 2024-02-28 12:44:19
Also in: dm-devel, lkml
Subsystem: software raid (multiple disks) support, the rest · Maintainers: Song Liu, Yu Kuai, Linus Torvalds

Hi,

在 2024/02/28 20:07, Xiao Ni 写道:
I have a question here. Is it the reason sync_thread can't run 
md_do_sync because kthread_should_stop, so it doesn't have the chance to 
set MD_RECOVERY_DONE? Why creating sync thread in md_check_recovery 
doesn't have this problem? Could you explain more about this?
raid10_run() only register sync_thread, without calling
md_wakeup_thread() to set the bit 'THREAD_WAKEUP', md_do_sync() will not
be executed.

raid5 defines 'pers->start' hence md_start() will call
md_wakeup_thread().

md_start_sync() will always call md_wakeup_thread() hence there is no
such problem.

BTW, this patch fix the same problem as you mentioned in your other
thread:
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 2266358d8074..54790261254d 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -4904,6 +4904,7 @@ static void stop_sync_thread(struct mddev *mddev, 
bool locked, bool check_seq)
  	 * never happen
  	 */
  	md_wakeup_thread_directly(mddev->sync_thread);
+	md_wakeup_thread(mddev->sync_thread);
  	if (work_pending(&mddev->sync_work))
  		flush_work(&mddev->sync_work);

However, I think the one to register sync_thread is responsible to wake
it up.

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