rk: revert to v3.10
[firefly-linux-kernel-4.4.55.git] / drivers / hv / channel_mgmt.c
index edf8995cb3b3c7f8fd6af87f881ec654a91db975..21ef68934a20bba366c1ea1c5be9705f0fafe6fa 100644 (file)
@@ -648,7 +648,7 @@ int vmbus_request_offers(void)
 {
        struct vmbus_channel_message_header *msg;
        struct vmbus_channel_msginfo *msginfo;
-       int ret;
+       int ret, t;
 
        msginfo = kmalloc(sizeof(*msginfo) +
                          sizeof(struct vmbus_channel_message_header),
@@ -656,6 +656,8 @@ int vmbus_request_offers(void)
        if (!msginfo)
                return -ENOMEM;
 
+       init_completion(&msginfo->waitevent);
+
        msg = (struct vmbus_channel_message_header *)msginfo->msg;
 
        msg->msgtype = CHANNELMSG_REQUESTOFFERS;
@@ -669,6 +671,14 @@ int vmbus_request_offers(void)
                goto cleanup;
        }
 
+       t = wait_for_completion_timeout(&msginfo->waitevent, 5*HZ);
+       if (t == 0) {
+               ret = -ETIMEDOUT;
+               goto cleanup;
+       }
+
+
+
 cleanup:
        kfree(msginfo);