qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH v4] iothread: fix epollfd leak in the process of


From: WangJie (Pluto)
Subject: Re: [Qemu-block] [PATCH v4] iothread: fix epollfd leak in the process of delIOThread
Date: Thu, 17 May 2018 09:42:15 +0800
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

I agree, wait for a reply from Fam

On 2018/5/16 19:43, Peter Xu wrote:
> On Wed, May 16, 2018 at 07:14:53PM +0800, WangJie (Pluto) wrote:
>> Hi, Peter Xu:
>>      If call aio_epoll_disable() here, aio_epoll_disable() will return 
>> before close ctx->epollfd,
>>     Because the ctx->epoll_enabled is false in the moment.
>>      In the process of addIOThread, aio_context_setup created epoll without 
>> call aio_epoll_try_enable,
>>     so ctx->epoll_enabled have no chance to set true.
> 
> I see that epoll_available will only be set if epollfd != -1, so it
> seems to me to make more sense if we swap the two variables in
> aio_epoll_disable(), from current version:
> 
> static void aio_epoll_disable(AioContext *ctx)
> {
>     ctx->epoll_available = false;
>     if (!ctx->epoll_enabled) {
>         return;
>     }
>     ctx->epoll_enabled = false;
>     close(ctx->epollfd);
> }
> 
> To:
> 
> static void aio_epoll_disable(AioContext *ctx)
> {
>     ctx->epoll_enabled = false;
>     if (!ctx->epoll_available) {
>         return;
>     }
>     ctx->epoll_available = false;
>     close(ctx->epollfd);
> }
> 
> What do you think?  And Fam?
> 
>>
>> On 2018/5/16 16:36, Jie Wang wrote:
>>> +void aio_context_destroy(AioContext *ctx)
>>> +{
>>> +#ifdef CONFIG_EPOLL_CREATE1
>>> +    if (ctx->epollfd >= 0) {
>>> +        close(ctx->epollfd);
>>> +    }
>>> +#endif
>>> +}
>>> +
>>>  void aio_context_set_poll_params(AioContext *ctx, int64_t max_ns,
>>>                                   int64_t grow, int64_t shrink, Error 
>>> **errp)
>>
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]