[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Node deletion in aio_set_fd_handler
From: |
Fam Zheng |
Subject: |
Re: [Qemu-devel] Node deletion in aio_set_fd_handler |
Date: |
Fri, 3 Aug 2018 14:36:18 +0800 |
User-agent: |
Mutt/1.10.0 (2018-05-17) |
On Fri, 08/03 08:13, Paolo Bonzini wrote:
> 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").
Yeah, that explains! Agree about the comment, I'll send a patch then. Thanks.
Fam