qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Node deletion in aio_set_fd_handler
Date: Fri, 3 Aug 2018 14:36:18 +0800	[thread overview]
Message-ID: <20180803063618.GD16395@lemon.usersys.redhat.com> (raw)
In-Reply-To: <2b1415a5-9553-386b-6cb5-8da000ac71da@redhat.com>

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

      reply	other threads:[~2018-08-03  6:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-03  2:42 [Qemu-devel] Node deletion in aio_set_fd_handler Fam Zheng
2018-08-03  6:13 ` Paolo Bonzini
2018-08-03  6:36   ` Fam Zheng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180803063618.GD16395@lemon.usersys.redhat.com \
    --to=famz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).