From: "Daniel P. Berrange" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <famz@redhat.com>,
qemu-block@nongnu.org
Subject: [Qemu-devel] [PATCH] nbd: use client_close() when negotiate phase fails
Date: Tue, 19 Jan 2016 11:50:08 +0000 [thread overview]
Message-ID: <1453204208-10776-1-git-send-email-berrange@redhat.com> (raw)
When nbd_negotiate() fails, nbd_co_client_start() is
directly calling client->close(). This eventually
ends up calling nbd_client_put(), which does an
assert(client->closing). Unfortunately we have not
set the 'closing' flag, so the code now aborts. This
bug was accidentally introduced in
commit ee7d7aabdaea4484e069cb99c9fc54e8cb24b56f
Author: Fam Zheng <famz@redhat.com>
Date: Thu Jan 14 16:41:01 2016 +0800
nbd: Always call "close_fn" in nbd_client_new
The simple fix is to not directly call client->close()
but instead call the client_close() method, which
takes care todo the right sequence of steps to close
the client.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
nbd/server.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/nbd/server.c b/nbd/server.c
index eead339..c29ba5f 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -1080,8 +1080,7 @@ static coroutine_fn void nbd_co_client_start(void *opaque)
nbd_export_get(exp);
}
if (nbd_negotiate(data)) {
- shutdown(client->sock, 2);
- client->close(client);
+ client_close(client);
goto out;
}
qemu_co_mutex_init(&client->send_lock);
--
2.5.0
next reply other threads:[~2016-01-19 11:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-19 11:50 Daniel P. Berrange [this message]
2016-01-19 12:08 ` [Qemu-devel] [PATCH] nbd: use client_close() when negotiate phase fails Paolo Bonzini
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=1453204208-10776-1-git-send-email-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=famz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--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).