Received: by 10.223.185.116 with SMTP id b49csp2941958wrg; Mon, 12 Feb 2018 18:15:00 -0800 (PST) X-Google-Smtp-Source: AH8x227l2Z0lMrp0hTqdswU7yZzhZqpA20MNWxpYcb25IlEwY2VWzlTi83rp2/wFJHJ6ZPVCKx+0 X-Received: by 10.98.92.1 with SMTP id q1mr13321616pfb.238.1518488100297; Mon, 12 Feb 2018 18:15:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518488100; cv=none; d=google.com; s=arc-20160816; b=JQZj0bVfuUZlViejm3ng3x0xeOx2sqPzE2df0Uy6HS3+38daqa+FnykbTJhCeO0d74 3eYOJ6dbAA0obURxDnWQaAKRIWOD+oIC0JFG+WzaXRfvSFNtHWTc8p+nqZuWStNJp3bp l0c+sq3HNUzwQpbXKAFZ4AuDa6b6PGmTaJAfya5zkuOpDDi167PUuoqnhno8juOl3CbC 2SgcDwN2EZM5zx+Qf06PPaHF8CG3/HRvShxLPjJ0xyUy0fwGUc9DQBOJACaQot4k/FVh AzBkansC3JURTiEtbAGjrbwZmrvFsZ0LEtyctINjt+2eLy4dX1XLnXkxhG3+lbtEP9G8 tGZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:arc-authentication-results; bh=VM+MgCV0iJWPK4Lo1gXMTJXEn6pw+8iEB42okPkfcBk=; b=zbzavOR07ijx/WUcdxh7qPe6OWwI8de2tCaCdI1xUOxiFGFqNFsCXB1p1fdjB52Olf 7oni0qeQrlFSrpFj5JGsBU9HGBnRIsaojJF/DvJaEQkCNVOXETX9VYl3qdjtlUptdJXX MYFDp2hDp4kSMJZSKeodGObJTIktsur8qf+ZGfs1k4Y6PerfmoAYF7adjfDNr/dPS8BO HqsZpwKBAYjpsK+kHIEr+is4mRpKf1EYYlUwlSIisxjHjoIBRoCPjRa9uGXXrNfs8YUf nF8DTIQCjHL9gPKpgsvbVZSCAtHQKF/SOwo9v1kULK9FvsWg8WKivUGJaKPHxYgpF83d 0Q9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 91-v6si724443plh.570.2018.02.12.18.14.46; Mon, 12 Feb 2018 18:15:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933339AbeBMCOB (ORCPT + 99 others); Mon, 12 Feb 2018 21:14:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:54210 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933132AbeBMCN7 (ORCPT ); Mon, 12 Feb 2018 21:13:59 -0500 Received: from localhost.localdomain (unknown [12.130.117.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6C9BD217B6; Tue, 13 Feb 2018 02:13:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C9BD217B6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=sstabellini@kernel.org From: Stefano Stabellini To: boris.ostrovsky@oracle.com, jgross@suse.com Cc: sstabellini@kernel.org, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, Stefano Stabellini Subject: [PATCH v2 2/2] pvcalls-front: wait for other operations to return when release passive sockets Date: Mon, 12 Feb 2018 18:13:47 -0800 Message-Id: <1518488027-22386-2-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1518488027-22386-1-git-send-email-sstabellini@kernel.org> References: <1518488027-22386-1-git-send-email-sstabellini@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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 Acked-by: Juergen Gross --- 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 163bf8c..7e67fb7 100644 --- a/drivers/xen/pvcalls-front.c +++ b/drivers/xen/pvcalls-front.c @@ -1020,6 +1020,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