Commit 242f3122 authored by Vitaly Kuznetsov's avatar Vitaly Kuznetsov Committed by Greg Kroah-Hartman

Drivers: hv: fcopy: 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 FCOPY 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 8efe78fd
...@@ -98,6 +98,8 @@ static void fcopy_work_func(struct work_struct *dummy) ...@@ -98,6 +98,8 @@ static void fcopy_work_func(struct work_struct *dummy)
if (down_trylock(&fcopy_transaction.read_sema)) if (down_trylock(&fcopy_transaction.read_sema))
; ;
hv_poll_channel(fcopy_transaction.fcopy_context,
hv_fcopy_onchannelcallback);
} }
static int fcopy_handle_handshake(u32 version) static int fcopy_handle_handshake(u32 version)
...@@ -117,8 +119,8 @@ static int fcopy_handle_handshake(u32 version) ...@@ -117,8 +119,8 @@ static int fcopy_handle_handshake(u32 version)
pr_info("FCP: user-mode registering done. Daemon version: %d\n", pr_info("FCP: user-mode registering done. Daemon version: %d\n",
version); version);
fcopy_transaction.active = false; fcopy_transaction.active = false;
if (fcopy_transaction.fcopy_context) hv_poll_channel(fcopy_transaction.fcopy_context,
hv_fcopy_onchannelcallback(fcopy_transaction.fcopy_context); hv_fcopy_onchannelcallback);
in_hand_shake = false; in_hand_shake = false;
return 0; return 0;
} }
...@@ -226,6 +228,7 @@ void hv_fcopy_onchannelcallback(void *context) ...@@ -226,6 +228,7 @@ void hv_fcopy_onchannelcallback(void *context)
fcopy_transaction.fcopy_context = context; fcopy_transaction.fcopy_context = context;
return; return;
} }
fcopy_transaction.fcopy_context = NULL;
vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 2, &recvlen, vmbus_recvpacket(channel, recv_buffer, PAGE_SIZE * 2, &recvlen,
&requestid); &requestid);
...@@ -333,8 +336,11 @@ static ssize_t fcopy_write(struct file *file, const char __user *buf, ...@@ -333,8 +336,11 @@ static ssize_t fcopy_write(struct file *file, const char __user *buf,
* Complete the transaction by forwarding the result * Complete the transaction by forwarding the result
* to the host. But first, cancel the timeout. * to the host. But first, cancel the timeout.
*/ */
if (cancel_delayed_work_sync(&fcopy_work)) if (cancel_delayed_work_sync(&fcopy_work)) {
fcopy_respond_to_host(response); fcopy_respond_to_host(response);
hv_poll_channel(fcopy_transaction.fcopy_context,
hv_fcopy_onchannelcallback);
}
return sizeof(int); return sizeof(int);
} }
......
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