mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 2/2] pvcalls-front: wait for other operations to return when release passive sockets
Date: Mon,  5 Feb 2018 14:51:47 -0800	[thread overview]
Message-ID: <1517871107-15349-2-git-send-email-sstabellini@kernel.org> (raw)
In-Reply-To: <1517871107-15349-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>
---
 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 164d3ad..d32cac5 100644
--- a/drivers/xen/pvcalls-front.c
+++ b/drivers/xen/pvcalls-front.c
@@ -1017,6 +1017,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

  reply	other threads:[~2018-02-05 22:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-05 22:51 [PATCH 0/2] pvcalls-front improvements Stefano Stabellini
2018-02-05 22:51 ` [PATCH 1/2] pvcalls-front: introduce a per sock_mapping refcount Stefano Stabellini
2018-02-05 22:51   ` Stefano Stabellini [this message]
2018-02-12 13:39     ` [PATCH 2/2] pvcalls-front: wait for other operations to return when release passive sockets Juergen Gross
2018-02-13  2:07       ` Stefano Stabellini
2018-02-12 13:14   ` [PATCH 1/2] pvcalls-front: introduce a per sock_mapping refcount Juergen Gross
2018-02-13  2:06     ` 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=1517871107-15349-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

Powered by JetHome