summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2014-08-27 16:25:32 -0700
committerJiri Slaby <jslaby@suse.cz>2014-10-31 15:11:14 +0100
commit37bc0b98d04c7630543a0c5d4e78859db6db275f (patch)
tree4a5ce424b88325f5a1de880f4c8f93d7a8922b6d
parent9c07ce2f1e4468aa013a52bd9b788b3b1f8cbff3 (diff)
Drivers: hv: vmbus: Cleanup vmbus_teardown_gpadl()
commit 66be653083057358724d56d817e870e53fb81ca7 upstream. Eliminate calls to BUG_ON() by properly handling errors. In cases where rollback is possible, we will return the appropriate error to have the calling code decide how to rollback state. In the case where we are transferring ownership of the guest physical pages to the host, we will wait for the host to respond. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Tested-by: Sitsofe Wheeler <sitsofe@yahoo.com> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
-rw-r--r--drivers/hv/channel.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 6de6c98ce6eb..d7b0e35cbd81 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -476,7 +476,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
struct vmbus_channel_gpadl_teardown *msg;
struct vmbus_channel_msginfo *info;
unsigned long flags;
- int ret, t;
+ int ret;
info = kmalloc(sizeof(*info) +
sizeof(struct vmbus_channel_gpadl_teardown), GFP_KERNEL);
@@ -498,11 +498,12 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
ret = vmbus_post_msg(msg,
sizeof(struct vmbus_channel_gpadl_teardown));
- BUG_ON(ret != 0);
- t = wait_for_completion_timeout(&info->waitevent, 5*HZ);
- BUG_ON(t == 0);
+ if (ret)
+ goto post_msg_err;
+
+ wait_for_completion(&info->waitevent);
- /* Received a torndown response */
+post_msg_err:
spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_del(&info->msglistentry);
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);