Re: [PATCH 2/7] md: fix a race condition when stopping the sync thread

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Thu, 18 Jan 2024, Yu Kuai wrote:

> Hi,
> 
> 在 2024/01/18 2:18, Mikulas Patocka 写道:
> > Note that md_wakeup_thread_directly is racy - it will do nothing if the
> > thread is already running or it may cause spurious wake-up if the thread
> > is blocked in another subsystem.
> 
> No, as the comment said, md_wakeup_thread_directly() is just to prevent
> that md_wakeup_thread() can't wake up md_do_sync() if it's waiting for
> metadata update.

Yes - but what happens if you wake up the thread just a few instructions 
before it is going to sleep for metadata update? wake_up_process does 
nothing on a running process and the thread proceeds with waiting. This is 
what I thought could happen when I was making the patch.

Mikulas

[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux