From 7459b081a81e8cc718731d3fb6428e3737ea49e1 Mon Sep 17 00:00:00 2001 From: "K. Y. Srinivasan" Date: Thu, 25 Aug 2011 09:49:01 -0700 Subject: [PATCH] --- yaml --- r: 267947 b: refs/heads/master c: 5289d3d160e8d5c63974502696ab5def71891f18 h: refs/heads/master i: 267945: b2d78ae24fb29feec31a3280a3958d8753c86218 267943: 2643805b36139375045fe1e94094a7366175dd02 v: v3 --- [refs] | 2 +- trunk/arch/x86/include/asm/hyperv.h | 1 + trunk/drivers/staging/hv/connection.c | 18 +++++++++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 1fcba51d292d..5a6ec747c485 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0293e5cabcd9067f35a64575922470b92d642d0e +refs/heads/master: 5289d3d160e8d5c63974502696ab5def71891f18 diff --git a/trunk/arch/x86/include/asm/hyperv.h b/trunk/arch/x86/include/asm/hyperv.h index 5df477ac3af7..b80420bcd09d 100644 --- a/trunk/arch/x86/include/asm/hyperv.h +++ b/trunk/arch/x86/include/asm/hyperv.h @@ -189,5 +189,6 @@ #define HV_STATUS_INVALID_HYPERCALL_CODE 2 #define HV_STATUS_INVALID_HYPERCALL_INPUT 3 #define HV_STATUS_INVALID_ALIGNMENT 4 +#define HV_STATUS_INSUFFICIENT_BUFFERS 19 #endif diff --git a/trunk/drivers/staging/hv/connection.c b/trunk/drivers/staging/hv/connection.c index 0e7efce31282..a88ad7072566 100644 --- a/trunk/drivers/staging/hv/connection.c +++ b/trunk/drivers/staging/hv/connection.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -268,10 +269,25 @@ void vmbus_on_event(unsigned long data) int vmbus_post_msg(void *buffer, size_t buflen) { union hv_connection_id conn_id; + int ret = 0; + int retries = 0; conn_id.asu32 = 0; conn_id.u.id = VMBUS_MESSAGE_CONNECTION_ID; - return hv_post_message(conn_id, 1, buffer, buflen); + + /* + * hv_post_message() can have transient failures because of + * insufficient resources. Retry the operation a couple of + * times before giving up. + */ + while (retries < 3) { + ret = hv_post_message(conn_id, 1, buffer, buflen); + if (ret != HV_STATUS_INSUFFICIENT_BUFFERS) + return ret; + retries++; + msleep(100); + } + return ret; } /*