Commit 38c06c29 authored by Vitaly Kuznetsov's avatar Vitaly Kuznetsov Committed by Greg Kroah-Hartman

Drivers: hv: vss: process deferred messages when we complete the transaction

In theory, the host is not supposed to issue any requests before be reply to
the previous one. In KVP we, however, support the following scenarios:
1) A message was received before userspace daemon registered;
2) A message was received while the previous one is still being processed.
In VSS we support only the former. Add support for the later, use
hv_poll_channel() to do the job.
Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
Tested-by: default avatarAlex Ng <alexng@microsoft.com>
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 242f3122
...@@ -47,6 +47,7 @@ static struct { ...@@ -47,6 +47,7 @@ static struct {
struct vmbus_channel *recv_channel; /* chn we got the request */ struct vmbus_channel *recv_channel; /* chn we got the request */
u64 recv_req_id; /* request ID. */ u64 recv_req_id; /* request ID. */
struct hv_vss_msg *msg; /* current message */ struct hv_vss_msg *msg; /* current message */
void *vss_context; /* for the channel callback */
} vss_transaction; } vss_transaction;
...@@ -73,6 +74,9 @@ static void vss_timeout_func(struct work_struct *dummy) ...@@ -73,6 +74,9 @@ static void vss_timeout_func(struct work_struct *dummy)
*/ */
pr_warn("VSS: timeout waiting for daemon to reply\n"); pr_warn("VSS: timeout waiting for daemon to reply\n");
vss_respond_to_host(HV_E_FAIL); vss_respond_to_host(HV_E_FAIL);
hv_poll_channel(vss_transaction.vss_context,
hv_vss_onchannelcallback);
} }
static void static void
...@@ -85,13 +89,12 @@ vss_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) ...@@ -85,13 +89,12 @@ vss_cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
if (vss_msg->vss_hdr.operation == VSS_OP_REGISTER) { if (vss_msg->vss_hdr.operation == VSS_OP_REGISTER) {
pr_info("VSS daemon registered\n"); pr_info("VSS daemon registered\n");
vss_transaction.active = false; vss_transaction.active = false;
if (vss_transaction.recv_channel != NULL)
hv_vss_onchannelcallback(vss_transaction.recv_channel);
return;
} }
if (cancel_delayed_work_sync(&vss_timeout_work)) if (cancel_delayed_work_sync(&vss_timeout_work))
vss_respond_to_host(vss_msg->error); vss_respond_to_host(vss_msg->error);
hv_poll_channel(vss_transaction.vss_context,
hv_vss_onchannelcallback);
} }
...@@ -198,9 +201,10 @@ void hv_vss_onchannelcallback(void *context) ...@@ -198,9 +201,10 @@ void hv_vss_onchannelcallback(void *context)
* We will defer processing this callback once * We will defer processing this callback once
* the current transaction is complete. * the current transaction is complete.
*/ */
vss_transaction.recv_channel = channel; vss_transaction.vss_context = context;
return; return;
} }
vss_transaction.vss_context = NULL;
vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 2, &recvlen, vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 2, &recvlen,
&requestid); &requestid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment