Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751038AbdFTROS (ORCPT ); Tue, 20 Jun 2017 13:14:18 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:48869 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750823AbdFTROR (ORCPT ); Tue, 20 Jun 2017 13:14:17 -0400 Subject: Re: [PATCH v4 13/18] xen/pvcalls: implement release command To: Stefano Stabellini , xen-devel@lists.xen.org References: <1497553787-3709-1-git-send-email-sstabellini@kernel.org> <1497553787-3709-13-git-send-email-sstabellini@kernel.org> Cc: linux-kernel@vger.kernel.org, jgross@suse.com, Stefano Stabellini From: Boris Ostrovsky Message-ID: Date: Tue, 20 Jun 2017 13:15:51 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1497553787-3709-13-git-send-email-sstabellini@kernel.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 840 Lines: 26 > + > +static int pvcalls_back_release_passive(struct xenbus_device *dev, > + struct pvcalls_fedata *fedata, > + struct sockpass_mapping *mappass) > +{ > + if (mappass->sock->sk != NULL) { > + write_lock_bh(&mappass->sock->sk->sk_callback_lock); > + mappass->sock->sk->sk_user_data = NULL; > + mappass->sock->sk->sk_data_ready = mappass->saved_data_ready; > + write_unlock_bh(&mappass->sock->sk->sk_callback_lock); > + } > + down(&fedata->socket_lock); > + radix_tree_delete(&fedata->socketpass_mappings, mappass->id); > + sock_release(mappass->sock); > + flush_workqueue(mappass->wq); > + destroy_workqueue(mappass->wq); > + kfree(mappass); > + up(&fedata->socket_lock); Can you raise the semaphore earlier, once the mapping is deleted from the tree? Also, why are you not locking the tree in pvcalls_back_accept()? -boris