Re: [PATCH 4/4] io-wq: fix potential race of acct->nr_workers

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

 



On 9/11/21 1:40 PM, Hao Xu wrote:
> Given max_worker is 1, and we currently have 1 running and it is
> exiting. There may be race like:
>  io_wqe_enqueue                   worker1
>                                no work there and timeout
>                                unlock(wqe->lock)
>  ->insert work
>                                -->io_worker_exit
>  lock(wqe->lock)
>  ->if(!nr_workers) //it's still 1
>  unlock(wqe->lock)
>     goto run_cancel
>                                   lock(wqe->lock)
>                                   nr_workers--
>                                   ->dec_running
>                                     ->worker creation fails
>                                   unlock(wqe->lock)
> 
> We enqueued one work but there is no workers, causes hung.

This one also looks good, applied.

-- 
Jens Axboe




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux