From: Stefano Stabellini <sstabellini@kernel.org>
To: boris.ostrovsky@oracle.com, jgross@suse.com
Cc: sstabellini@kernel.org, xen-devel@lists.xenproject.org,
linux-kernel@vger.kernel.org,
Stefano Stabellini <stefano@aporeto.com>
Subject: [PATCH v3 2/2] pvcalls-front: wait for other operations to return when release passive sockets
Date: Wed, 14 Feb 2018 10:28:24 -0800 [thread overview]
Message-ID: <1518632904-20267-2-git-send-email-sstabellini@kernel.org> (raw)
In-Reply-To: <1518632904-20267-1-git-send-email-sstabellini@kernel.org>
Passive sockets can have ongoing operations on them, specifically, we
have two wait_event_interruptable calls in pvcalls_front_accept.
Add two wake_up calls in pvcalls_front_release, then wait for the
potential waiters to return and release the sock_mapping refcount.
Signed-off-by: Stefano Stabellini <stefano@aporeto.com>
Acked-by: Juergen Gross <jgross@suse.com>
---
drivers/xen/pvcalls-front.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/xen/pvcalls-front.c b/drivers/xen/pvcalls-front.c
index 18d1bac..ca5b773 100644
--- a/drivers/xen/pvcalls-front.c
+++ b/drivers/xen/pvcalls-front.c
@@ -1018,6 +1018,12 @@ int pvcalls_front_release(struct socket *sock)
pvcalls_front_free_map(bedata, map);
} else {
+ wake_up(&bedata->inflight_req);
+ wake_up(&map->passive.inflight_accept_req);
+
+ while (atomic_read(&map->refcount) > 1)
+ cpu_relax();
+
spin_lock(&bedata->socket_lock);
list_del(&map->list);
spin_unlock(&bedata->socket_lock);
--
1.9.1
next prev parent reply other threads:[~2018-02-14 18:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-14 18:26 [PATCH v3 0/2] pvcalls-front improvements Stefano Stabellini
2018-02-14 18:28 ` [PATCH v3 1/2] pvcalls-front: introduce a per sock_mapping refcount Stefano Stabellini
2018-02-14 18:28 ` Stefano Stabellini [this message]
2018-02-15 9:49 ` Juergen Gross
2018-02-15 17:28 ` [PATCH v3 0/2] pvcalls-front improvements Juergen Gross
2018-02-15 18:30 ` Stefano Stabellini
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=1518632904-20267-2-git-send-email-sstabellini@kernel.org \
--to=sstabellini@kernel.org \
--cc=boris.ostrovsky@oracle.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stefano@aporeto.com \
--cc=xen-devel@lists.xenproject.org \
/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
all inboxes | Powered by JetHome®