mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
Drivers: hv: vmbus: Cleanup vmbus_teardown_gpadl()
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> Cc: <stable@vger.kernel.org> Tested-by: Sitsofe Wheeler <sitsofe@yahoo.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
fdeebcc622
commit
66be653083
@ -435,7 +435,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
|
|||||||
struct vmbus_channel_gpadl_teardown *msg;
|
struct vmbus_channel_gpadl_teardown *msg;
|
||||||
struct vmbus_channel_msginfo *info;
|
struct vmbus_channel_msginfo *info;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int ret, t;
|
int ret;
|
||||||
|
|
||||||
info = kmalloc(sizeof(*info) +
|
info = kmalloc(sizeof(*info) +
|
||||||
sizeof(struct vmbus_channel_gpadl_teardown), GFP_KERNEL);
|
sizeof(struct vmbus_channel_gpadl_teardown), GFP_KERNEL);
|
||||||
@ -457,11 +457,12 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
|
|||||||
ret = vmbus_post_msg(msg,
|
ret = vmbus_post_msg(msg,
|
||||||
sizeof(struct vmbus_channel_gpadl_teardown));
|
sizeof(struct vmbus_channel_gpadl_teardown));
|
||||||
|
|
||||||
BUG_ON(ret != 0);
|
if (ret)
|
||||||
t = wait_for_completion_timeout(&info->waitevent, 5*HZ);
|
goto post_msg_err;
|
||||||
BUG_ON(t == 0);
|
|
||||||
|
|
||||||
/* Received a torndown response */
|
wait_for_completion(&info->waitevent);
|
||||||
|
|
||||||
|
post_msg_err:
|
||||||
spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
|
spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
|
||||||
list_del(&info->msglistentry);
|
list_del(&info->msglistentry);
|
||||||
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
|
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
|
||||||
|
Loading…
Reference in New Issue
Block a user