[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v10 14/21] jobs: protect job.aio_context with BQL and job_mut
From: |
Emanuele Giuseppe Esposito |
Subject: |
Re: [PATCH v10 14/21] jobs: protect job.aio_context with BQL and job_mutex |
Date: |
Wed, 17 Aug 2022 15:10:38 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 |
Am 17/08/2022 um 10:04 schrieb Emanuele Giuseppe Esposito:
>>> + /* protect against read in job_do_yield_locked */
>>> + JOB_LOCK_GUARD();
>>> + /* ensure the coroutine is quiescent while the AioContext is changed */
>>> + assert(job->pause_count > 0);
>> job->pause_count only shows that pausing was requested. The coroutine is
>> only really quiescent if job->busy == false, too.
>>
>> Or maybe job->paused is actually the one you want here.
> I think job->paused works too.
>
Actually it doesn't. At least test-block-iothread
test_propagate_mirror() fails, for both job->paused and !job->busy. I
think the reason is that if we wait for the flag to be set, we need to
actually wait that the job gets to the next pause point, because
job_pause() doesn't really pause the job, it just kind of "schedules"
the pause on next pause point.
So, either we leave pause_count > 0, or somehow wait (I was thinking
AIO_WAIT_WHILE(job->paused) but that's probably a very bad idea).
Do you have any suggestion for that?
Maybe Paolo has a better idea on how to do it?
Emanuele