aboutsummaryrefslogtreecommitdiff
path: root/nbd.c
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2015-02-06 16:06:16 -0500
committerStefan Hajnoczi <stefanha@redhat.com>2015-02-16 14:36:03 +0000
commitf53a829bb9ef14be800556cbc02d8b20fc1050a7 (patch)
tree6b18946eed64c59e72baebabaabe59b98faef0a2 /nbd.c
parentcd2d5541271f1934345d8ca42f5fafff1744eee7 (diff)
nbd: Drop BDS backpointer
Before this patch, the "opaque" pointer in an NBD BDS points to a BDRVNBDState, which contains an NbdClientSession object, which in turn contains a pointer to the BDS. This pointer may become invalid due to bdrv_swap(), so drop it, and instead pass the BDS directly to the nbd-client.c functions which then retrieve the NbdClientSession object from there. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1423256778-3340-2-git-send-email-mreitz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'nbd.c')
-rw-r--r--nbd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/nbd.c b/nbd.c
index e56afbc162..71159aff6a 100644
--- a/nbd.c
+++ b/nbd.c
@@ -874,7 +874,7 @@ void nbd_client_put(NBDClient *client)
{
if (--client->refcount == 0) {
/* The last reference should be dropped by client->close,
- * which is called by nbd_client_close.
+ * which is called by client_close.
*/
assert(client->closing);
@@ -889,7 +889,7 @@ void nbd_client_put(NBDClient *client)
}
}
-void nbd_client_close(NBDClient *client)
+static void client_close(NBDClient *client)
{
if (client->closing) {
return;
@@ -1026,7 +1026,7 @@ void nbd_export_close(NBDExport *exp)
nbd_export_get(exp);
QTAILQ_FOREACH_SAFE(client, &exp->clients, next, next) {
- nbd_client_close(client);
+ client_close(client);
}
nbd_export_set_name(exp, NULL);
nbd_export_put(exp);
@@ -1311,7 +1311,7 @@ done:
out:
nbd_request_put(req);
- nbd_client_close(client);
+ client_close(client);
}
static void nbd_read(void *opaque)