diff options
author | K. Y. Srinivasan <kys@microsoft.com> | 2014-08-27 16:25:31 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-09-23 23:30:38 -0700 |
commit | fdeebcc62279119dbeafbc1a2e39e773839025fd (patch) | |
tree | 73332aa1af3d3c3a988a9bda73541c9361e424ac /drivers/hv | |
parent | 06c88b0d7ad87540405aea7f91d98ef43be04c95 (diff) | |
download | linux-fdeebcc62279119dbeafbc1a2e39e773839025fd.tar.bz2 |
Drivers: hv: vmbus: Cleanup vmbus_post_msg()
Posting messages to the host can fail because of transient resource
related failures. Correctly deal with these failures and increase the
number of attempts to post the message before giving up.
In this version of the patch, I have normalized the error code to
Linux error code.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Cc: <stable@vger.kernel.org>
Tested-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv')
-rw-r--r-- | drivers/hv/connection.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c index ae22e3c1fc4c..e206619b946e 100644 --- a/drivers/hv/connection.c +++ b/drivers/hv/connection.c @@ -427,10 +427,21 @@ int vmbus_post_msg(void *buffer, size_t buflen) * 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) + while (retries < 10) { + ret = hv_post_message(conn_id, 1, buffer, buflen); + + switch (ret) { + case HV_STATUS_INSUFFICIENT_BUFFERS: + ret = -ENOMEM; + case -ENOMEM: + break; + case HV_STATUS_SUCCESS: return ret; + default: + pr_err("hv_post_msg() failed; error code:%d\n", ret); + return -EINVAL; + } + retries++; msleep(100); } |