qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Node deletion in aio_set_fd_handler


From: Paolo Bonzini
Subject: Re: [Qemu-devel] Node deletion in aio_set_fd_handler
Date: Fri, 3 Aug 2018 08:13:58 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 03/08/2018 04:42, Fam Zheng wrote:
> Paolo, is this else branch dead code (or bug?):
> 
>         /* If the lock is held, just mark the node as deleted */
>         if (qemu_lockcnt_count(&ctx->list_lock)) {
>             node->deleted = 1;
>             node->pfd.revents = 0;
>         } else {
>             /* Otherwise, delete it for real.  We can't just mark it as
>              * deleted because deleted nodes are only cleaned up while
>              * no one is walking the handlers list.
>              */
>             QLIST_REMOVE(node, node);
>             deleted = true;
>         }
> 
> Since we are in a qemu_lockcnt_lock/unlock section?

No, qemu_lockcnt_count returns the number of nested qemu_lockcnt_inc/dec
(read-side) sections.  lock/unlock is for the write side.

The comment should be improved (e.g. "if a read is in progress, just
mark the node as deleted").

Paolo



reply via email to

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