qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Fam Zheng <famz@redhat.com>
Cc: kwolf@redhat.com, pbonzini@redhat.com, imain@redhat.com,
	qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [RFC PATCH 2/4] nbd: call drive_put_ref() only if dinfo exists
Date: Wed, 21 Aug 2013 14:47:12 +0200	[thread overview]
Message-ID: <20130821124712.GA11975@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1375071932-31627-3-git-send-email-famz@redhat.com>

On Mon, Jul 29, 2013 at 12:25:30PM +0800, Fam Zheng wrote:
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  blockdev-nbd.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/blockdev-nbd.c b/blockdev-nbd.c
> index 95f10c8..c75df19 100644
> --- a/blockdev-nbd.c
> +++ b/blockdev-nbd.c
> @@ -72,7 +72,10 @@ static void nbd_close_notifier(Notifier *n, void *data)
>  static void nbd_server_put_ref(NBDExport *exp)
>  {
>      BlockDriverState *bs = nbd_export_get_blockdev(exp);
> -    drive_put_ref(drive_get_by_blockdev(bs));
> +    DriveInfo *dinfo = drive_get_by_blockdev(bs);
> +    if (dinfo) {
> +        drive_put_ref(dinfo);
> +    }

This doesn't make sense to me.  If we hold a reference, we must release
it.

Once your refcount series is applied, NBD should be able to hold just
the BDS refcount.  Then we don't care about DriveInfo at all anymore
besides looking up the BDS when the user creates an export.

Stefan

  reply	other threads:[~2013-08-21 12:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-29  4:25 [Qemu-devel] [RFC PATCH 0/4] hmp/qmp: add snapshot option to nbd export Fam Zheng
2013-07-29  4:25 ` [Qemu-devel] [RFC PATCH 1/4] block/backup: delete target after completion callback Fam Zheng
2013-08-21 18:37   ` Eric Blake
2013-07-29  4:25 ` [Qemu-devel] [RFC PATCH 2/4] nbd: call drive_put_ref() only if dinfo exists Fam Zheng
2013-08-21 12:47   ` Stefan Hajnoczi [this message]
2013-07-29  4:25 ` [Qemu-devel] [RFC PATCH 3/4] qmp: Add "snapshot=" option to nbd-server-add Fam Zheng
2013-08-21 13:02   ` Stefan Hajnoczi
2013-08-21 18:40     ` Eric Blake
2013-08-22  8:53     ` Fam Zheng
2013-08-22  9:22       ` Paolo Bonzini
2013-08-22  9:42         ` Fam Zheng
2013-08-26  8:07         ` Fam Zheng
2013-08-21 18:42   ` Eric Blake
2013-07-29  4:25 ` [Qemu-devel] [RFC PATCH 4/4] hmp: add -s switch to nbd_server_add Fam Zheng

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=20130821124712.GA11975@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=famz@redhat.com \
    --cc=imain@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).