From: "K. Y. Srinivasan" <kys@microsoft.com>
To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com,
vkuznets@redhat.com
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Subject: [PATCH V2 4/6] Drivers: hv: vmbus: Remove the channel from the channel list(s) on failure
Date: Sat, 28 Feb 2015 11:18:19 -0800 [thread overview]
Message-ID: <1425151101-3679-4-git-send-email-kys@microsoft.com> (raw)
In-Reply-To: <1425151101-3679-1-git-send-email-kys@microsoft.com>
Properly rollback state in vmbus_pocess_offer() in the failure paths.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
---
drivers/hv/channel_mgmt.c | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 6c1f792..cc6996a 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -384,7 +384,7 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
&newchannel->offermsg.offer.if_instance,
newchannel);
if (!newchannel->device_obj)
- goto err_free_chan;
+ goto err_deq_chan;
/*
* Add the new device to the bus. This will kick off device-driver
@@ -396,15 +396,26 @@ static void vmbus_process_offer(struct vmbus_channel *newchannel)
pr_err("unable to add child device object (relid %d)\n",
newchannel->offermsg.child_relid);
- spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
- list_del(&newchannel->listentry);
- spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
kfree(newchannel->device_obj);
- goto err_free_chan;
+ goto err_deq_chan;
}
return;
+err_deq_chan:
+ spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
+ list_del(&newchannel->listentry);
+ spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
+
+ if (newchannel->target_cpu != get_cpu()) {
+ put_cpu();
+ smp_call_function_single(newchannel->target_cpu,
+ percpu_channel_deq, newchannel, true);
+ } else {
+ percpu_channel_deq(newchannel);
+ put_cpu();
+ }
+
err_free_chan:
free_channel(newchannel);
}
--
1.7.4.1
next prev parent reply other threads:[~2015-02-28 18:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-28 18:18 [PATCH V2 0/6] Drivers: hv: vmbus: Cleanup channel rescind handling K. Y. Srinivasan
2015-02-28 19:18 ` [PATCH V2 1/6] Drivers: hv: vmbus: Properly handle child device remove K. Y. Srinivasan
2015-02-28 19:18 ` [PATCH V2 2/6] Drivers: hv: vmbus: Introduce a function to remove a rescinded offer K. Y. Srinivasan
2015-02-28 19:18 ` [PATCH V2 3/6] Drivers: hv: vmbus: Handle both rescind and offer messages in the same context K. Y. Srinivasan
2015-02-28 19:18 ` K. Y. Srinivasan [this message]
2015-02-28 19:18 ` [PATCH V2 5/6] Drivers: hv: util: On device remove, close the channel after de-initializing the service K. Y. Srinivasan
2015-02-28 19:18 ` [PATCH V2 6/6] Drivers: hv: vmbus: Get rid of some unnecessary messages K. Y. Srinivasan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1425151101-3679-4-git-send-email-kys@microsoft.com \
--to=kys@microsoft.com \
--cc=apw@canonical.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olaf@aepfle.de \
--cc=vkuznets@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome